Posts

Showing posts from September, 2011

C# wpf binding to a binding -

i'm writing questionnnaire library c# wpf. in have usercontrol called multiplechoiceoption . has dependencyproperty optiontype . if optiontype "combobox" insert combobox. i want able bind itemssource of combobox dependencyproperty of multiplechoiceoption created this: public static readonly dependencyproperty multiplechoicecomboboxitemsproperty = dependencyproperty.register("comboboxitems", typeof(list<string>), typeof(multiplechoiceoption)); ... public list<string> optiontext { { return getvalue(multiplechoiceoptiontextproperty) list<string>; } set { setvalue(multiplechoiceoptiontextproperty, value); } } if optiontype "combobox" add combobox , set binding this: case "combobox": var combobox = new combobox { horizontalalignment = horizontalalignment.right }; var b = new binding()

esb - Suitabaility of API solutions for consuming external APIs -

lets have api management solution ibm, or wso2, od mulesoft. in papers can see scenarios, api tools used publishing internal services outside world. can use same solution when want consume external services internall systems? api management tools suitable scenario? or should rather use internal esb common contact point consuming external services? i think possible in solutions mulesoft, esb , api management functinality connected in 1 product. of vendors have different products these capabilities. thank you

oracle10g - Missing Mandatory parameters error in oracle form builder -

i'm using oracle 10g version , i'm trying connect oracle developer suite 10g it. when try make form, encounter error after give user,password , host string. error: ora-06604: error occurred @ recursive sql level 1 ora-01009: missing mandatory parameter what should do?

amazon web services - Backup strategy for large number of files -

i working on web application handle close million image files (< 100k in size), uploaded users. application relies on sql database references images. images held on local disk on web application server, looking @ possible solutions backup these images. i'd avoid rsync or creation of single-file archives these slow number of files being considered. complete picture, database backed on nightly basis. the 2 options i've far identified following: create web service on amazon ec2 receives image assets web application @ same time being uploaded users web application. received assets stored on ebs drive snapshotted on nightly basis @ time coincide database backup on database server. ensures data integrity between image backup , database backup. upload images amazon s3 @ same time uploaded web application. the s3 option seems simpler , more scalable solution, concern not possible take snapshot backups of image library coincide database backups. in case of database fai

Make an Iterable array of objects in PHP for Twig -

i'm trying pass array of objects parameter view rendering. problem when try iterate on , check if it's iterable, isn't. this how buil array: public function filtracalciatori($mintiritotali, $mintiriporta, $mingolfatti, $mingolsubiti, $minassist, $minfallifatti, $minfallisubiti, $minpercentualepassaggiriusciti, $minammonizioni, $minespulsioni, $maxtiritotali, $maxtiriporta, $maxgolfatti, $maxgolsubiti, $maxassist, $maxfallifatti, $maxfallisubiti, $maxpercentualepassaggiriusciti, $maxammonizioni, $maxespulsioni) { $statement = $this->conn->prepare( "select calciatore, sum(tiri_totali) tiri_totali, sum(tiri_porta) tiri_porta, sum(falli_fatti) falli_fatti, sum(falli_subiti) falli_subiti, (sum(percentuale_passaggi_riusciti) / count('calciatore')) perce

linux - Python TypeError: 'module' object is not callable -

i run piece of code on mac in idle , works fine. when tried run same code on linux machine command line gave me error: traceback (most recent call last): file "time.py", line 1, in <module> import time file "/home/ugrad/user/time.py", line 3, in <module> t1 = time.time() typeerror: 'module' object not callable here code: import time t1 = time.time() size = 10000000 in range(size): = += 100 *= 35 val = (a == 839248637) t2 = time.time() res = t2-t1 print(res) what doing wrong here? you named file time.py import time loads file instead python time module. change name different - ie. time-test.py

mongodb count value of one field based on other -

i have collection named genre_collection of following structure : user | genres ---------------- 1 | comedy 1 | action 1 | thriller 1 | comedy 1 | action 2 | war 2 | adventure 2 | war 2 | thriller i'm trying find count each genre each user i.e. ideal final result : 1 | comedy |2 1 | action |1 1 | thriller |1 2 | war |2 2 | adventure |1 2 | thriller |1 any helps useful. you can aggregation using $group try : db.genre_collection.aggregate([ { $group:{ _id:{ genre:"$genres", user:"$user" }, count:{ $sum:1 } } } ]) output: { "_id" : { "genre" : "adventure", "user" : 2 }, "count" : 1 } { "_id" : { "genre" : "action", "user" : 1 }, "count" : 2 } { "_id" : { &

nvenc - Unable to compile ffmpeg to support NVIDIA hardware acceleration -

i trying compile ffmpeg support nvidia hardware acceleration. getting following errors: libavcodec/cuvid.c: in function ‘check_cu’: libavcodec/cuvid.c:83:5: error: implicit declaration of function ‘cugeterrorname’ [-werror=implicit-function-declaration] cugeterrorname(err, &err_name); ^ libavcodec/cuvid.c:84:5: error: implicit declaration of function ‘cugeterrorstring’ [-werror=implicit-function-declaration] cugeterrorstring(err, &err_string); i have installed cuda following instruction on nvidia developer forum. configuration used is: ./configure --enable-nonfree --enable-nvenc --enable-cuda --enable-cuvid --enable-libx264 --enable-gpl the gpu on laptop nvidia corporation gm108m [geforce 840m]. try install cuda utility: $ wget http://developer.download.nvidia.com/compute/redist/ffmpeg/1511-patch/cudautils.zip $ unzip cudautils.zip $ cd cudautils $ make and add in configuration: --extra-cflags=-i../cudautils --extra-ldflags=-l../cudautils

ios - Layout for class -

i have problem regarding link between 2 blocks of code change annotation image. new swift, having hard time trying figure on mapview. i've given code in function print string when runs, string not showing in nslog. mean that, function not being run @ all? appreciate suggestions went wrong. thank you class viewcontroller2: uiviewcontroller { @iboutlet var mapview: mkmapview! override func viewdidload() { super.viewdidload() //location first pin let locationone = cllocationcoordinate2dmake(-47.016945, 167.852095) //location map centering let locationnz = cllocationcoordinate2dmake(-43.937462, 170.507813) let span = mkcoordinatespanmake(9, 9) let region = mkcoordinateregion(center: locationnz, span: span) mapview.setregion(region, animated: true) //create annotation 1 let annotation = mkpointannotation() annotation.coordinate = locationone annotation.subtitle = "park" annotation.title = "rakiura national park" //add annotation map mapview.addannotation(a

java - jenkins permission resetting Without restarting the server -

i want jenkins permission resetting without restarting server. permission file path : jenkins_home/config.xml. i revise config.xml jenkins permission unchanged. server restarting after jenkins permission changed. i searched jenkins api.... jenkins job api exist... user permission api not exist. i searched jenkins javadoc... permission class user permission confirm setting not exist... help me.... i want change config.xml , jenkins permission changed...

c# - Dynamic Linq Querystring not working with mixed operators along with contains -

Image
i have used dynamic linq in application , unfortunately it's not working. here sample code. list<string> contains = new list<string>() { "poland", "ecuador" }; list<object> array = new list<object>(); array.add("austria"); array.add("eritrea"); array.add(contains); //this works var data0 = contact.getcontactslist().asqueryable().where("@0.contains(outerit.country)", array); //this not work var data = contact.getcontactslist().asqueryable().where("country.equals(@0) or it.country.equals(@1) or @3.contains(outerit.country)", array.toarray()); i have list of contacts related countries. can see have used mixed operators i.e equals , contains. if contains used separately works correct. tried new thing here, using both equals , contains operators same query string. have attached image describing output or data0 , error while processing data thank you. i made silly mistake there. c

ios - What will happen if my class conforms to two protocols having same property? -

let's have 2 protocols @protocol playlist<nsobject> @property(nonatomic, copy) nsstring *title; @property(nonatomic, assign) nsuinteger trackcount; @end and as @protocol album<nsobject> @property(nonatomic, copy) nsstring *name; @property(nonatomic, assign) nsuinteger trackcount; @end and there class conforms these protocols .h file @interface musiclibrary <playlist, album> @end .m file @implementation musiclibrary @synthesize title; @synthesize name; @synthesize trackcount; @end which trackcount property refer to? can use trackcount twice? it surely not give compile time error. it looks me modeling data wrong. way have setup musiclibrary both playlist , album. think more correct model have musiclibrary containing many playlist , many albums. like: @property (nonatomic, strong) nsarray<album>* albums; @property (nonatomic, strong) nsarray<playlist>* playlists;

c - Warning initialization makes integer from pointer without a cast with fgets -

this question has answer here: (why) using uninitialized variable undefined behavior? 7 answers i want want read character string, on stdin, have chosen fgets. got warning: initialization makes integer pointer without cast. here code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stddef.h> #define max_linia 301 int main(int argc,char *argv[]){ char *buffer; printf("enter input\n"); if (fgets(buffer,max_linia-1,stdin)==null) printf("error") else printf("%s", buffer); return 0: } you using buffer without initialising it, causes undefined behaviour. you don't need use pointer, , can use char array instead (given max size defined): char buffer[max_linia]; the fgets better written as: if(fgets(buffer,sizeof(buffer),stdin)==null)

node.js - server side rendering rendering and optimisations in react node app -

i have file: import react, {component, proptypes} 'react'; import reactdom 'react-dom/server'; import serialize 'serialize-javascript'; import helmet 'react-helmet'; import googletagmanager '../../src/components/commons/footer/googletagmanager' /** * wrapper component containing html metadata , boilerplate tags. * used in server-side code wrap string output of * rendered route component. * * thing component doesn't (and can't) include * html doctype declaration, added rendered output * server.js file. */ class html extends component { constructor(props){ super(props); this.zopimintegration = this.zopimintegration.bind(this); } render() { const {assets, component, store, html} = this.props; const content = component ? reactdom.rendertostring(component) : ''; return ( <html lang="en-us"> <head> {object.keys(assets.styles).map((style, key) =>

Adding header line to export csv in Python -

i want add header line final output csv python. how can that? first removing header of main file items.csv because @ end python adds 'target' word header too. after adding word want write new header. here code: import csv itertools import islice import os open('items.csv') sample, open('items_50.csv', "w") out: csv1=csv.reader(sample) header = next(csv1, none) csv_writer = csv.writer(out) sirali = sorted(csv1, key=lambda x:int(x[0]), reverse=true) csv_writer.writerows(islice(sirali,50)) file1=open('items_50.csv','rb') readfile=csv.reader(file1,) file2=open('final.csv','wb') writefile=csv.writer(file2,delimiter='"') result=() row in readfile: result= [row[0]+','+row[1]+','+row[2]+','+row[3]+'target'] writefile.writerow(result) file1.close() file2.close() an example final.csv right now: 0,apple,orange,gettarget 25,steven,jack,s

c# - Style at User Control strange behavior -

Image
such strange thing happens here. i'm using wpf xaml, , created user control, kind textbox image in right upper corner. here xaml code of control: <usercontrol x:class="stirnradprogramm.classes.controls.textboxwithimage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:stirnradprogramm.classes.controls" x:name="parent"> <grid datacontext="{binding elementname=parent}" margin="0"> <grid.columndefinitions> <columndefinition width="1*"/> <columndefinition width="15"/> </grid.columndefinitions> <grid.rowdefinitions>

c# - MVVM Command selects the last added item -

i have viewmodel command. last added item editable command. makes sense when @ ode. it's not want. want selected item edited. i'll sketch problem: i have model, named part public class part { private string _partcode; private string _description; public string partcode { { return _partcode.trim(); } set { _partcode = value; } } public string description { { return _description; } set { _description = value; } } } a viewmodel command, named partviewmodel /// <summary> /// returns viewmodel containing parts. /// </summary> /// <param name="dt">database use.</param> public partviewmodel(databasetype dt) { generateviewmodelforallparts(dt); } private async void generateviewmodelforallparts(databasetype dt) { using (nexuswcfserviceclient client = new nexuswcfserviceclient()) foreach (part item in await clie

python - How can I generate a pseudo-random list of 1s and -1s? -

i want generate pseudo-random list of 10 numbers seeded seed. want list has 1s , -1s , probability of each 1 0.5. import numpy np np.random.seed(0) np.random.randint(2, size=(10,)) i don´t distribution of 1s , -1s, of 1s , 0s... , don´t know if probability of each number 1/2. any clue? as @jtbandes said, np.random.choice function help: import numpy np np.random.seed(0) np.random.choice([-1,1], size=(10,))

elasticsearch - How to save the elastocsearch database? -

in work, several simulations every time use kibana elasticsearch analyze results. so, need save elasticsearch database every time in order reuse again. how can do please? it sounds document ids setup such aren't time based , being overwritten on each run. without knowing details of configuration file, it's hard more.

javascript - get positions of given elements in a 2d array in Ramda -

i have array data, ie. const data = [[ , '+', ], ['+', , '+'], [ , , '+']] i'd [x, y] coordinates of every element '+': const expected = [[1, 0], [0, 1], [2, 1], [2, 2]] how can in ramda? i knocked out code works: const gethorizontalposition = r.map(r.addindex(r.reduce) ( (xs, el, idx) => r.equals('+', el) ? r.append(idx, xs) : xs, [] )) const combinewithverticalposition = r.addindex(r.chain) ( (xs, y) => r.map( (x) => [x, y] )(xs) ) pipe(gethorizontalposition, combinewithverticalposition)(data) but, can see, it's ugly , not readable. how can more elegantly? link code in ramda repl as may have noticed, ramda not index handling. can't come particularly nice solution. something work, seems less elegant 2 reducers 1 mentioned in comment: pipe(addindex(map)((xs, i) => pipe( map(equals('+')), addindex(map)((x, j) => x

vue.js - How to add a property with the same name in VueJS? -

so using component framework vue2 named vuetify , having problem regarding class of input textbox. so in textbox component, code is: <template lang="pug"> div( class="input-group" v-bind:class="classes" ) label( v-bind:for="id" v-html="label" ) input( v-bind:id="id" v-bind:name="name" v-bind:placeholder="placeholder" v-bind:required="required" v-bind:type="type" v-bind:value="inputvalue" ref="input" ) </template> now want add class in text input because want date , using flatpickr plugin. name of class flatpickr. way use component this: <v-text-input id="someid" label="somelabel" v-model="somemodel"></v-text-input> and if try add class random this: <v-text-input id="someid" label="somelabel" v-

c# - Is there a better way to get lists to load without using ObservableCollection? -

we using telerik's radgridview display data, binding lists of business objects. of data loaded such [detaillist] // 20+ lists public list<businessobject> businessobjects { get; } = new list<businessobject>(); private void filldetail(objectcontaininglotsofinfo object) { try { this.businessobjects.addrange(object.businessobjects.linq); // linq sort of filter or selectmany statement. this.refreshlists(); } catch (exception exception) { trace.writeline(exception); this.errormessage = exception.message;exception.message)); } } private void refreshlists() { var properties = this.gettype().getproperties().where(prop => prop.isdefined(typeof(detaillist), false)); foreach (propertyinfo item in properties) { trace.writeline($"refreshing detaillist.{item.name} property {this.identifier}");

php - what is wrong with my bootstrap drop down menu? -

whenever click on item has drop down, doesnt work... know why? first time using php , trying inventory system... have no idea problem here code <!doctype html> <html> <head> <title>servicio de manejo de inventarios</title> <!-- bootstrap --> <link rel="stylesheet" type="text/css" href="assets/bootstrap/css/bootstrap.min.css"> <!-- bootstrap theme --> <link rel="stylesheet" type="text/css" href="assets/bootstrap/css/bootstrap-theme.min.css"> <!-- font awesome --> <link rel="stylesheet" type="text/css" href="assets/font-awesome/css/font-awesome.min.css"> <!-- custom css --> <link rel="stylesheet" type="text/css" href="custom/css/custom.css"> <!-- datatables--> <script type="text/javascript" scr="assets/plugins/datata

javascript - How can i change the innerHTML of a list item? -

ok have code of html <ul class="wsite-menu-default"> <li id="lis1" class="wsite-menu-item-wrap wsite-nav-1" style="position: relative;"> <a href="#" class="wsite-menu-item" style="position: relative;"> home </a> </li> <li id="lis2" class="wsite-menu-item-wrap wsite-nav-2" style="position: relative;"> <a href="#" class="wsite-menu-item" style="position: relative;"> images </a> </li> <li id="lis3" class="wsite-menu-item-wrap wsite-nav-3" style="position: relative;"> <a href="#" class="wsite-menu-item" style="position: relative;"> facilities </a> </li> <li id="lis4" class="wsite-menu-item-wrap wsite-nav-4" style="position: relative;"> <a href="#" class=

python - Accessing extra data in a sqlalchemy associated object -

the user object can involved project in many different ways, specified job association table. in template file, i'm trying loop through of projects in current_user.projects , each one, specify job user in project... can't syntax right. models class project(db.model): id = db.column(db.integer(), primary_key=true) title = db.column(db.string(80)) users = db.relationship("job", back_populates="project") class user(db.model, usermixin): id = db.column(db.integer, primary_key=true) first_name = db.column(db.string(155)) last_name = db.column(db.string(155)) email = db.column(db.string(255), unique=true) password = db.column(db.string(255)) projects = db.relationship("job", back_populates="user") # defines user's role related each assigned project class job(db.model): __tablename__ = 'job' user_id = db.column(db.integer, db.foreignkey('user.id'), primary_key=true)

javascript - Makes 2 states share a part of resolve -

i have defined 2 states follows: app.config(['$stateprovider', function ($stateprovider) { $stateprovider .state('edit', { url: '/edit/{id}', templateurl: '/htmls/h1.html', controller: 'samectrl', onenter: ...sameonenter... resolve: { ...commonresolve... } }) .state('addinedit', { url: '/addin/edit/{id}', templateurl: '/htmls/h2.html', controller: 'samectrl', onenter: ...sameonenter... resolve: { special: [ ... ], ...commonresolve... } }) }]) so share same controller, same onenter , , have very long , common part resolve (which chain of resolves: first: function (...){...}, second: function (...){...}, ... ). know how rewrite them don't have write commonresolve twice?

java - I have checked manually in my db but my list is returning empty? -

i have tried travels db source_name, destination particular. want travels list db using prepared statement. unable same. package com.indiabus1.dao; import java.sql.connection; import java.sql.preparedstatement; import java.sql.resultset; import java.sql.sqlexception; import java.util.arraylist; import java.util.list; import com.indiabus1.beans.*; import com.indiabus1.dao.*; import com.indiabus1.*; import com.indiabus1.dao.connectionfactory; import com.indiabus1.beans.busselectionbeans; public class busselectiondao { connection connection; public busselectiondao(){} private static connection getconnection() throws sqlexception, classnotfoundexception { connection con = connectionfactory. getinstance().getconnection(); return con; } public static list<busselectionbeans> getrecords( string s, string s2){ list<busselectionbeans> list=new arraylist<busselectionbeans>(); try{ connection co

php magic setters - modified child properties -

lets say, have following php class: class product { protected $data = array(); protected $modified = false; public function __construct($data) { $this->data = $data; } public function & __get($name) { if(array_key_exists($name, $this->data)) { return $this->data->$name; } $null = null; return $null; } public function __set($name, $value) { $this->data->$name = $value; $this->modified = true; } } $obj = new product([]); if set value (for example $obj->name = "name"; ), class property $modified set true. thats want achive. but somehow possible, "track" modifications, if done in object values? example: $property = new stdclass(); $property->name = "name of prop"; $obj = new product([ "name" => "name", "someobject" => $property ]); // here comes change $obj->s

How can I detect new row or updated row in Google Sheets through the api? -

can me figure out how detect new row or updated row in google sheets through api ? webhook ? i think can of apps script. can use trigger here detect if change in spreadsheet. triggers let apps script run function automatically when event, opening document, occurs. simple triggers set of reserved functions built apps script, function onopen(e), executes when user opens google docs, sheets, or forms file. more information, check related so question .

html - Img src to a link -

is possible make chili img "a href". function of pop working fine, there no "hand", when hover picture. link portfolio html <img src="/images/thumbs/image1.jpg" data-toggle="modal" data-target="#mymodal1" alt="trolltunga, norway" width="300px" height="200px" > <div id="mymodal1" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-body"> <img src="//placehold.it/1000x600" class="img-responsive"> </div> </div> </div> </div> js function centermodal() { $(this).css('display', 'block'); var $dialog = $(this).find("

php - WooCommerce Subscriptions + WP Funds -

i need add funds user's account via account funds on successful renewal of membership via woocommerce subscriptions . is there way via wp functions? ifso how this? have tried following no luck. add_action('processed_subscription_payment', 'custom_add_funds', 10, 2); function custom_add_funds($user_id) { // current user's funds $funds = get_user_meta( $user_id, 'account_funds', true ); // add £40 $funds = $funds + 40; // add funds user update_user_meta( $user_id, 'account_funds', $funds ); } account funds: https://docs.woocommerce.com/document/account-funds/ subscriptions: https://docs.woocommerce.com/document/subscriptions/

ios - How to Implementing MPNowPlayingInfoCenter using AvAudioPlayer -

i in midst of creating ios mobile app client play variety of audio tracks. one of features wanted implement display information currently-playing audio track on lock screen , banner . 1 of simple convenience mobile user , must-have if app has background audio playing. personally, use feature time! you should first observe avplayeritem of avaudioplayer so: [playeritem addobserver:self forkeypath:@"timedmetadata" options:nskeyvalueobservingoptionnew context:nil]; then create global variables: nsstring *title; nsstring *artist; uiimage *artwork; you need function 1 below, observe key path timedmetadata , update infocenter through updateinfocenterwithtitle:andartist:andcover: . - (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context { if ([keypath isequaltostring:@"timedmetadata"]) { (int = 0; < [audioplayer.currentitem.timedmetadata count]; i++)

.Net Core Implementing Redis cashing with master and slave connections -

i need use redis connection master , slave configuration in dot net core . below code configured primary server(master) configured port 6379, , have slave configured 6380. services.addsingleton < idistributedcache > (serviceprovider => new rediscache(new rediscacheoptions { configuration = primaryserver.connectionstring, instancename = primaryserver.instancename })); below configuration: "redissettings": { "primaryserver": { "connectionstring": "127.0.0.1:6379", "instancename": "somename" }, "secondaryserver": { "connectionstring": "127.0.0.1:6380", "instancename": "somename" } } let me know if possible have master , slave setup idistributedcache

ubuntu - Netbeans: Loading an existing cloned GIT repo -

i have large local git repository working on. repository contains several other netbeans projects in it. cannot restructure git repo contain single projects, not belong me. i use graphical netbeans git client on entire repository however, not want reclone repository, or move different path. can somehow load allready cloned repository netbeans ide? for now, hacked defining fake php project in repository's root directory. project contains no php (it's bunch of small c++ projects), wanted root project won't try build anything. as i've found myself in situation many times (start using netbeans after i've cloned , compiled) , looking less "hacky" way this. ps: please don't start offtopic discussion on merits of using git command line. prefer ui git on command line. netbeans choice of git gui ubuntu, other free gui clients have incomplete functionality. you can use favorites "open" directory in netbeans: open favorites wi

angularjs - how to get object in an array with index in a controller angular js -

i need object in array given index in angular js. scope.storelist = [{ 'id':101, 'name':indhu },{ 'id':102, 'name':selvin },{ 'id':103, 'name':indhu1 }]; in if give index value, should give object. tried below code not get: var list = scope.storelist[2]; please 1 it. name values should in string type. $scope.storelist = [{ 'id':101, 'name':"indhu" },{ 'id':102, 'name':"selvin" },{ 'id':103, 'name':"indhu1" }]; console.log("",$scope.storelist[2])

machine learning - Why is Multi-label classification (Binary relevance) is acting up? -

i'm new multi-label classification using binary relevance , having issues explaining result: the result is: [[ 0. 0.] [ 2. 2.]] does mean first case classified [0,0] , 2nd [2,2]? not @ all. or missing else? after gentelmen answers i'm getting following error because of y_train label [2**,0,**3,4] because of zero traceback (most recent call last): file "driver.py", line 22, in <module> clf_dict[i] = clf.fit(x_train, y_tmp) file "c:\users\baderex\anaconda22\lib\site-packages\sklearn\linear_model\logistic.py", line 1154, in fit self.max_iter, self.tol, self.random_state) file "c:\users\baderex\anaconda22\lib\site-packages\sklearn\svm\base.py", line 885, in _fit_liblinear " class: %r" % classes_[0]) valueerror: solver needs samples of @ least 2 classes in data, data contains 1 class: 1 updated code: import numpy np sklearn.linear_model import logisticregression sklearn.metrics import * numer_classes = 5 x_t

macros - VBA PowerPoint to check if a FileNma already exist -

what want check if file name exist , make my modification. tried several methode no 1 work!! can me please finding solution? this wrote 3 different methods: private sub commandbutton21_click() dim lretval long dim objfso object dim checkexists boolean todate = datevalue(now) oldweekday = weekday(todate) select case oldweekday case 1 newfilename = "pt pm weekly " & format(date + 4, "yyyymmdd") case 2 newfilename = "pt pm weekly " & format(date + 3, "yyyymmdd") case 3 newfilename = "pt pm weekly " & format(date + 2, "yyyymmdd") case 4 newfilename = "pt pm weekly " & format(date + 1, "yyyymmdd") case 5 newfilename = "pt pm weekly " & format(date, "yyyymmdd") case 6 newfilename = "pt pm weekly " & format(date + 6, "yyyymmdd") case 7 newfilename = "pt pm weekly " & format(date + 5, "yyyymmdd") end select ownpathnam

url rewriting - Wordpress Rewrite URL not working with rewrite_rules_array filter -

i have in functions.php (wp 4.6.x) rewrite long pretty urls shorter permalinks posts set $home/ ... function kl_add_query_vars($avars) { $avars[] = "urlklcity"; $avars[] = "urlklarea"; $avars[] = "urlcatslug"; $avars[] = "urlcategory"; $avars[] = "urlphonenumber"; //echo "in kl_add_query_vars"; return $avars; } // hook add_query_vars function query_vars add_filter('query_vars', 'kl_add_query_vars'); function kl_add_rewrite_rules($arules) { // matches {home}/{1}/{2}/[3] , nothing else search urls //$anewrules = array('([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)? $'=>'/index.php?? page_id=13988&urlklcity=$matches[1]&urlklarea=$matches[2]&urlcatslug=$matches[3]', $anewrules = array('([^/]+)/([^/]+)/([^/]+)?$' => '/index.php?page_id=13988&urlklcity=$matches[1]&urlklarea=$matches[2]&urlcatslug=$matches[3

search - How to draw a splunk chart depicting no of occurrences for different strings? -

i want draw splunk chart , have following strings in logs: "request id: 552" "request id: 223" "request id: 365" "request id: 552" "request id: 552" "request id: 223" i want create chart x axis values request ids (552,223,365) , y axis values number of occurrences of these request ids. splunk search query work? try query, fill index details in both main search , sub search assuming field-name log, index=... | append[search index=... | eval req_id=ltrim(log,"request id: ")] | stats count(log) req_id_count req_id | table req_id,req_id_count this should work.

email - Why mail not send from my localhost php 7 in codeigniter -

from localhost, cannot send email using gmail account. i've used php 7.0.9 , codeigniter. wrote code in controller is- $this->load->library('email'); $config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl://smtp.googlemail.com'; $config['smtp_port'] = '25'; $config['smtp_user'] = 'xxx@gmail.com'; $config['smtp_pass'] = 'password'; $config['charset'] = 'utf-8'; $config['newline'] = "\r\n"; $config['mailtype'] = 'html'; $config['wordwrap'] = true; $this->email->initialize($config); $this->email->from('xxx@gmail.com'); $this->email->to('aaaa@yahoo.com'); $this->email->subject("welcome xx."); $this->email->message('message body.....'); if ($this->email->send()) { $data['s

Arangodb query to get node-link graph when there is limit on node number -

i have normal graph node-link due requirement, want query out limited number of node (20 example). then, limit 20, query links returned nodeid not in result. how can solve it? current query: for node "for v in 0..100 " + "\"" + _id + "\"" + " entityrelation options {uniquevertices: " + "\"global\"" + "} return v" for links "for v in 0..100 " + "\"" + _id + "\"" + " entityrelation options {uniquevertices: " + "\"global\"" + "} vv, c in inbound v entityrelation return c"

Understanding how software accumulates memory in system -

Image
lately i've been trying understand , track down nasty memory leak in software. this, started monitor memory usage on long periods of time try figure out if there pattern serve clue understand issue. in graphic bellow, virtual memory drawn in purple , % of cpu memory in green, x-axis represent time in seconds. there big spikes occur when video streaming feature activated, doesn't seem issue since software seems able clear these. around second 7500 there big drop because of stand-by feature of system activated few seconds. after system returns normal, clears memory accumulated before.. far makes sense. thing can't understand that, if amount of stored memory decreases, why doesn't %mem decrease? in case, increasing. there not clear correlation between %mem , virtual memory usage. can me understand this? i realized virtual memory not related %mem, since stored in hard-drive , swapped ram when process needs it. memory of process related %mem rss (resid

dropzone.js - Uploading larger file size using Dropzonejs -

i trying use dropzonejs upload music , video files, when tried image files worked fine, upload successful, on trying video , music files gives error: “warning post content of ------- bytes exceeds limit of --------.” have set configuration dropzone seems not solve problem. because i’m working laravel, edited php_ini file of xampp, increase max_file_size , other parameters, did not solve problem either, since i’m running laravel-5.3, it’s evident might have own internal server because wether i’m running xampp or not once start laravel server runs or without starting apache on xampp. do? appreciate. <div class="row"> <div class="col-md-12"> <form action="{{ url('/songs/do-upload') }}" class="dropzone" id="addsongs">{{csrf_field()}} <input type="hidden" name="albums_id" value=" {{$albums->id}} "> </form

npm - Multiple entrypoints in typescript external modules not resolved -

i trying build external module, @example/lib typescript multiple entry points. consume this: import * lib '@example/lib'; import * foobar '@example/lib/foobar'; i can build npm module works correctly setting "target": "es5" , "declaration": true in tsconfig, , pointing "main" , "typings" properties in package.json single source location. if this, can import @example/lib without issue. the problem arises when attempt import @example/lib/foobar . typescript complains "cannot find module @example/lib/foobar ". compiled output, can import submodule fine (after being processed webpack). inside @example/lib project have source files: index.js index.d.ts foobar.js foobar.d.ts and in package.json have: { ... "typings": "index.d.ts" "main": "index.js" ... } what need keep typescript happy (and type checking!) in case? the ab

matrix - Minutiae-based fingerprint matching algorithm -

Image
the problem i need match 2 fingerprints , give score of resemblance. i have posted similar question before, think i've made enough progress warrant new question. the input for each image, have list of minutiae (important points). want match fingerprints matching these 2 lists. when represented graphically, this: a minutia consists of triplet (i, j, theta) where: i row in matrix j column in matrix theta direction. don't use parameter yet in matching algorithm. what have done far for each list, find "dense regions" or "clusters" . areas have more points others, , have written algorithm find them. can explain further if want. shifting second list in order account difference in finger position between both images. neglect differences in finger rotation. shift done aligning barycenters of centers of clusters. (it more reliable barycenter of minutiae) i tried building matrix each list (post-shift) every minutia increments corre