Posts

Showing posts from March, 2015

Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 -

i new maven, want install artifacts local maven, when tried run script.got bellow error. [info] scanning projects...downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom [warning] failed retrieve plugin descriptor org.apache.maven.plugins:maven-clean-plugin:2.5: plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or on e of dependencies not resolved: failed read artifact descriptorfor org.apache.maven.plugins:maven-clean-plugin:jar:2.5 please in resolving issue. need in setting.xml, proxy ip need give poxy been disabled on system.

java - How to use function parameters if function have @Test annotation? -

is there way use parameters in function if function has @test annotation. have function below: @test(@test(priority=1, alwaysrun =true)) public void home_page_flextronics(string susername, string spassword) throws filenotfoundexception { commonfunctions.launchapplication(); commonfunctions.login(susername, spassword); commonfunctions.clickonmodule("customers"); commonfunctions.clickonhome(); commonfunctions.logout(); } however when trying run above code giving me error: method home_page_flextronics requires 2 parameters 0 supplied in @test annotation. if remove parameters , use hardcoded values, working fine , requirement of framework. have gone through other solutions suggest use @parameter annotation or data provider. don't want use want take testdata excel sheet. please let me know if there other way present handle this. in advance. you take @ junit theories (introduct...

jquery - alert in javascript not showing -

<!doctype html> <html> <head> <script type="text/javascript"> if (document.getelementbyid("popup")) { window.alert("hi"); } </script> </head> <body> <h1 id="popup">dfdfs</h1> </body> </html> i have simple javascript shows alert when h1 id exits ,but not getting alert message.code in jquery can help. put <script> tag @ end of body : <!doctype html> <html> <head> </head> <body> <h1 id="popup">dfdfs</h1> <script type="text/javascript"> if (document.getelementbyid("popup")) { window.alert("hi"); } </script> </body> </html>

javascript - Is there a way to detect changes within the same route? -

with iron router, have following route set up: router.route('/:cat', { name: "goods", waiton: function() { session.setdefault('limit', 20) var limit = session.get('limit') || 20 meteor.subscribe('goods', this.params.cat, limit) } }) the idea user can press bunch of buttons change cat (egory), filtering out data remaining on same route. classic stuff. right sets default limit of 20 , user scrolls down, increased. if clicks button change category, doesn't make sense instantly load 100 new items, set limit 20 again. problem is, can't think of way that. removing setdefault use session.set won't work. can think of right logging cat in session , use check if category has been changed, hoping there better way. how using template manage state (instead of sessions , route. for example, using reactivate variable (reactive-var package), , passing category through route template. ...

java - Serlaize case class with the variable inside it in scala with jackson -

i tiring serialize case class using jackson fasterxml , can see constructor parameters after deserialize (taskrequest , tasknamein) not variables inside class (jobsrequests null example): //@jsonignoreproperties(ignoreunknown = true) // tried remove no luck @jsonautodetect case class job(taskrequest: list[taskrequest] = nil,tasknamein:string) { { this.jobsrequests = taskrequest this.taskname= tasknamein } @jsonproperty @volatile private var jobsrequests: list[taskrequest] = nil @jsonproperty var task_name: string = "" } any suggestions ? jackson uses getter java beans standard construct json. try adding @beanproperty properties , constructor parameters compile class getter/setters. example or use jackson scala-module . can take @ tests see how use module serialization .

erlang - Why no need to remember the socket handle in handle_info? -

i confused chapter 4 example of "erlang , otp in action". https://github.com/erlware/erlang-and-otp-in-action-source/blob/master/chapter_04/tcp_rpc/src/tr_server.erl#l92 handle_info(timeout, #state{lsock = lsock} = state) -> {ok, _sock} = gen_tcp:accept(lsock), {noreply, state}. the book said: you don’t need remember socket handle returned accept, because it’s included in each data package. what mean exactly? what's "data package"? why socket handle name prefixed underscore? why no need save somewhere in case of gc? happens behind scene? gen_server behavior seems difficult follow. explain in simple , clear way? when establish connection in erlang tcp sockets, can make socket active or not active. if socket active, every time receive data client, send erlang message format {tcp, socket, data} , tcp tuple id, socket variable have information regarding socket, on local port listening, on interface, , port/ip of peer sendi...

error handling - Handle 'missing rest service' message in Lucee (or Railo) -

one of sans web application security recommendations handle errors , replace them generic, non-descriptive messages. in lucee (or railo matter) when access rest service address doesn't exist, no rest service [/xxxx] found in mapping [/yyyy] doesn't pass through onerror . i see rest separate servlet, however, else runs through onrequeststart , onrequest , onrequestend ... etc. any suggestions on how capture or suppress error?

c++ - "Read" does not name a type -

i have been writing program requires me take input serial monitor in arduino. i'm having problems. here's code. update: new code have created after couple revisions. #include <softwareserial.h> int r1 = 20; int r2_2 = 20; int r4_7 = 20; int r5_6 = 20; int r7_5 = 20; int r8_2 = 20; int r10 = 22; int r15 = 20; int r22 = 20; int r27 = 20; int r33 = 22; int r39 = 20; int r47 = 20; int r56 = 20; int r68 = 20; int r75 = 20; int r82 = 20; int r100 = 20; int r120 = 20; int r150 = 20; int r180 = 20; int r220 = 20; int r270 = 20; int r330 = 20; int r390 = 20; int r470 = 20; int r510 = 20; int r680 = 20; int r820 = 20; int r1k = 20; int r1k5 = 20; int r2k2 = 20; int r3k3 = 20; int r3k9 = 20; int r4k7 = 20; int r5k6 = 20; int r6k8 = 20; int r7k5 = 20; int r8k2 = 20; int r10k = 20; int r15k = 20; int r22k = 20; int r33k = 20; int r39k = 20; int r47k = 20; int r56k = 20; int r68k = 20; int r75k = 20; int r82k = 20; int r100k = 20; int r150k = 20; int r180k = 20; int r220k = 20; ...

ios - GADBanner error Stack Trace -

it seems have new error in app update. stack trace flurry analytics. ideas means? full stack trace: 0 libobjc.a.dylib 0x1966fbbd0 _objc_msgsend + 16 1 appname 0x1002f3c28 -[gadbannerview slotfinishedloadingadcontent:] + 220 2 appname 0x1002e3520 +[gadmacros runsynchronouslyonmainthreadwithblock:] + 64 3 appname 0x1002f3bb0 -[gadbannerview slotfinishedloadingadcontent:] + 100 4 appname 0x1002f890c -[gadslot adfinishedloadingcontent] + 56 5 appname 0x1002eefc0 -[gadbannerwebviewdelegate webviewdidfinishload:] + 548 6 appname 0x1003248c4 -[gadwebview webviewdidfinishload:] + 100 7 corefoundation 0x1860b7df0 <redacted> + 144 8 corefoundation 0x185fb665c -[nsinvocation invoke] + 296 9 corefoundation 0x185fbb1f0 -...

javascript - setting the prototype of a function using object.create() -

i'm looking @ at 2 examples mdn inheritance , prototypes. there seems conflict in understanding given these 2 examples—they seem contradictory: var = {a: 1}; //inheritance looks like: ---> object.prototype ---> null var b = object.create(a); //inheritance looks like: b ---> ---> object.prototype ---> null console.log(b.a); // 1 (inherited) makes sense far, on page, learning .call() method: function product(name, price) { this.name = name; this.price = price; if (price < 0) { throw rangeerror('cannot create product ' + this.name + ' negative price'); } return this; } function food(name, price) { product.call(this, name, price); this.category = 'food'; } food.prototype = object.create(product.prototype); function toy(name, price) { product.call(this, name, price); this.category = 'toy'; } toy.prototype = object.create(product.prototype); var cheese = new food('feta',...

I can't connect to CouchDB UI in other computer -

after loaded couch database , confirmed connecting localhost port 5984. want access web console in other computer. doesn't work. changed every other ports , checked firewall. didn't have problems. there got same experience? thanks in advanced. another question, for changing web port in local.ini , killed previous loading application, why previous 1 alive? there command unload/stop application? can't find command in bin directory. change parameter bind_address in config 127.0.0.1 (accessible localhost only) 0.0.0.0 .

angularjs - Angular Material input validation error messages -

Image
i'm trying write app using angular-material , have form has required fields needs input validation. i've attempted following example the angular-material page under errors , when view code in browser, error messages still appear if stuff entered fields my jade template looks this: form(name="accountform") div(layout="row",layout-sm="column") md-input-container label name input(name="acctname",ng-model="account.name",required) div(ng-messages="accountform.acctname.$error") div(ng-message="required") i didn't realize ng-messages separate angular module. since node project, imported angular messages using npm npm install -s angular-messages then modified angular module code var app = angular.module('myapp', ['ngmaterial', 'ngmessages']); ... , worked!

java - JUnit testing a method with JOptionPane.showMessageDialog -

i have made game user , ai takes turns "rolling" dice. game automatically takes ai's turn , returns user's turn. used joptionpane.showmessagedialog popup dialog box notifying user turn. working when execute junit test class test hold() method popup comes up. there way suppress popup or automatically close window in junit test class? public void hold() { this.swapwhoseturn(); this.setchanged(); this.notifyobservers(); if (this.getcurrentplayer().getismyturn() == this.getcomputerplayer().getismyturn()) { this.thecomputer.taketurn(); this.hold(); humanplayerpanel.turnalert(); } the turnalert static method in class called humanplayerpanel. here code. public static void turnalert() { joptionpane.showmessagedialog(null, "it turn"); } i saw can call doclick method on ok_option button i'm not sure how find button. appreciated. refactor if statement follows: if (this....

.net - C# Task Return output -

i've read lot on how return value task can't seem work on code , still produces system.threading.threadabortexception . tried using task.waitall though might block ui no avail. public datatable getresult(somevariable somevariable) { // not work //var task = task<datatable>.factory.startnew(() => var task = task.factory.startnew<datatable>(() => { datatable matcheddata = new datatable(); matcheddata = dotask(somevariable); return matcheddata; }, taskcreationoptions.longrunning); try { var alltasks = new task[] { task }; task.waitall(alltasks); return task.result datatable; } catch (argumentexception) { throw; } catch (exception) { // exception here: "a first chance exception of type 'system.threading.threadabortexception' occurred in mscorlib.dll" throw; } } tried using continuewhenall still same. publi...

Python Pulp Integer Linear Program with dynamic constraint -

i want solve mixed integer linear program following objective function: j = maximize (f1(x) + f2(x)) subject constraint: cost(x) <= threshold where x set of selected variables, f1 , f2 2 scoring functions , cost cost function. f2 function based on similarity between selected variables. don't know how formulate function in pulp. this minimal working example in function f2 similarity between 2 ingredients , want add similarity[i][j] objective function if j in selected variables, don't know how it. import numpy np import pulp threshold = 200 model = pulp.lpproblem('selection', pulp.lpmaximize) similarity = np.array([[1., 0.08333333, 0.1, 0., 0., 0.0625], [0.08333333, 1., 0.33333333, 0., 0.11111111, 0.07692308], [0.1, 0.33333333, 1., 0.2, 0., 0.09090909], [0., 0., 0.2, 1., 0., 0.], [0., 0.11111111, 0., 0., 1., 0.27272727], ...

Java Spring persist stack trace when 500 error happens -

i hosting spring boot application on amazon ec2. in morning when go webpage see "could not open jpa entitymanager transaction; nested exception javax.persistence.persistenceexception: org.hibernate.transactionexception: jdbc begin transaction failed:" from browser. have no way stack trace. possible in spring: when 500 error happens, spring catch exception , store in database or local file can later. think helpful debug hard-to-reproduce 500 errors. yes possible need configure controllers use spring exception handling https://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc then can configure level of exceptions want catch(in case general exception ok, or if know specific exception better) // total control - setup model , return view name yourself. or consider // subclassing exceptionhandlerexceptionresolver (see below). @exceptionhandler(exception.class) public modelandview handleerror(httpservletrequest req, exception exceptio...

PHP Build and order an array of objects stored as JSON on a database -

i have objects stored in json_encoded format in database, in text field. i want build array of these objects, , order them based on property called "order". the objects properties defined on class: class task { public $id; public $title; public $details; public $order; public $high_priority; public $done; } the objects stored in table following columns: id, title ,data so, whole objects represented class task gets encoded , saved in data field, title task i need load objects title task database, map id field task's id property, put them in array of objects, order them according property order of objects what best way that? appreciated. unless nosql db type, best way not store data in json format. look @ manipulation want , easier make sense of data if stored each value in own field.

javascript - How to define custom filter for ui-select module in AngularJS? -

here code select-field in html: <ui-select ng-model="group.selected" theme="selectize" ng-click="searchdisabled(3)" ng-disabled="disabledgroup"> <ui-select-match placeholder="choose group"> {{$select.selected.name}} </ui-select-match> <ui-select-choices repeat="group in groups | filter: $select.search"> <span ng-bind-html="group.name | highlight: $select.search"></span> <small ng-bind-html="group.code | highlight: $select.search"></small> </ui-select-choices> </ui-select> then field who's important filter table list: <tr ng-repeat="item in filterednames = (nameslist | filter:search | selectgroup:group.selected)"> <td>{{ item.lname }}</td> <td>{{ item.fname }}</td> <td>{{ item.maxage }}</td> </tr> i'm using ngmodel value ui-select-ta...

javascript - How can I test unit test my jQuery-based code? -

i have following code in file named index.js. want test functions in add , print being prime one. (function($){ "use strict"; $(function(){ var add = function(a, b){ // ... }, print = function(str){ // ... }, setup = function(){ // ... }, init = function(){ // ... }; setup(); init(); }); })(jquery); how can so? way of coding add security on client side? have code runs on client side. no server involvement what-so-ever. i tried : var outerobj = (function(greet){ var innerobj = (function(){ return {test: function(){ console.log(greet); }} })(); return innerobj; })("hi"); outerobj.test(); but, in case, innerobj line has $ on right hand of equal sign, making console yell error shouts $(...) not function . agree, it's array of single document object. check out var = (function(){ var val = $(function(){return 10;})(); })(); in jquery enabled web-p...

postgresql - Syntax error in function using dblink to replicate new data -

i never created function in postgres, followed tutorials , made code, don't know why wrong, error in console is: "syntax error @ or near "select" line 5: select public.dblink_connect('hostaddr=127.0.0.1 port=54... i'm using version 9.3.6 on ubuntu. create or replace function fn_replicate_insertof_students() returns text $body$ begin select public.dblink_connect('hostaddr=127.0.0.1 port=5433 dbname=utiles user=postgres password=mypass'); insert res_partner (company_id,name,lang,comment,street,supplier,city,zip,country_id,email,phone,date,customer,mobile,ref,state_id,opt_out,city_id,l10n_mx_city2,l10n_mx_street3,l10n_mx_street4,notification_email_send,type,street2,active) values (1,new.name,'es_mx',new.comment,new.street,false,new.city,new.zip,new.country_id,new.email,new.phone,new.date,true,new.mobile,new.ref,new.state_id,false,new.city_id,new.l10n_mx_city2,new.l10n_mx_street3,new.l10n...

Perl find and replace one liner -

i've been looking @ other find , replace questions on perl, , i'm not sure how implement variation in 1 line. difference want replace 2 things, 1 original, , 1 replacing modification of original string. code have in pm module is: my $num_args = $#argv + 1; if ($num_args != 2) { print "\nusage: pscript.pm path file [version]\n"; exit; } $version = $argv[1]; $revision = $argv[1]; $revision =~ s/.*\.//g; open ($inhandle, "<", $argv[0]) or die $^e; open ($outhandle, ">", "$argv[0].mod") or die $^e; while(my $line = <$inhandle>) { $line =~ s/\<foo\>(.*)\<\/foo\>/\<foo\>$version\<\/foo\>/; $line =~ s/\<bar\>(.*)\<\/bar\>/\<bar\>$revision\<\/bar\>/; print $outhandle $line; } close $inhandle; close $outhandle; unlink $argv[0]; rename "$argv[0].mod", $argv[0]; what different is: $revision =~ s/.*\.//g; which turns version x.x.x.10...

java - Sort Map<String, Integer> Largest First Into List<String> Efficiently? -

i have concurrentmap<string, integer> , , i'd list<string> string mapping largest integer first, second largest second, etc. right have along lines of this: loop through keyset of map in loop, loop through "sorted" list<string> keep looping until key string's respective value less element i of "sorted" list , , insert it. now work, doubt it's efficient. java 8 have built in sorting algorithms me here? using streams, write this: list<string> sorted = map.entryset().stream() .sorted(reverseorder(comparing(entry::getvalue))) .map(entry::getkey) .collect(tolist()); or commented holger: list<string> sorted = map.entryset().stream() .sorted(comparingbyvalue(reverseorder())) .map(entry::getkey) .collect(tolist()); note static imports: import static j...

c# - How took Com objects that are in WCF project to the server -

i published wcf service server working locally in server getting error: retrieving com class factory component clsid. the job of service adding fields word template , convert pdf. guess can not find com object in server. 1 of object reference in project microsoft.office.interop.word i have added reference project should install object in server? microsoft.office.interop.word not designed to run in non interactive session (for example in self hosted service or iis, 2 ways host wcf on server). if code run going start running in other issues listed in above link. you need switch open xml sdk able manipulate word documents in server setting. edit: while not directly related see this old question of mine making same mistake (using word automation text replace inside sharepoint web service). in answer posted own question have example code of how replace text using open xml sdk. using (wordprocessingdocument template = wordprocessingdocument.open(documentstre...

dictionary - dict.setObject does not work for own struct -

what's needed code running? dict.setobject(greplacements, forkey: "greplacements") i created own plist within dictionary. load , save different types of data. when try save own struct (s. below). error message: "cannot invoke "setobject" argument of type ('[fromto], forkey: string)' definition: struct fromto { var = string() var = string() } var greplacements : [fromto] = [ fromto(from: "x", to: "y") ] any idea?

java - Checked Exception Variance -

java supports checked exceptions, invariant default @ declaration site. scala allows variance annotations using +t , -t , not have checked exceptions. designing / implementing language supposed support both, wondering how variance works checked exceptions. example : interface function[-p1, +r, e] { public r apply(p1 par1) throws e } what kind of variance annotation should e have, or invariant? , further, should generate error if has opposite variance annotation, similar how in scala error if use covariant type argument function parameter type? things come all time in language design, , there issues of soundness etc., take time think these issues in other aspects of language! but, anyway, it's means. let's suppose have interface iofunction[-p1, +r, e <: ioexception] extends function[p1,r,e] and have method public r doio[p1, r](f: iofunction[p1, r, ioexception]) ... what if user has hands on function throws myioexception <: ioexception ?...

Variablize Method Call in Powershell -

i'm looking way dynamically call method or property of function. example wanted call every property of $error[0]. list of property names with: $a = ($error[0] | get-member -type property | select name) i this: foreach($b in $a){ $error[0].&($b.name) } but call operator (&) doesn't resolve $b.name expect (it should resolve 'catagoryinfo'). there anyway this? you use different way retrieve properties: $properties=$error[0].psobject.properties this return collection of pspropertyinfo objects. pspropertyinfo objects have value property use or set property value: $properties|foreach-object {'name={0}; value={1}'-f$_.name,$_.value} also note of possible problems in way of retrieving properties' values. powershell allows access idictionary elements property syntax. problem here powershell prefer access collection element rather actual property: $hashtable=@{} $hashtable.count # 0 $hashtable.add('somename',10) ...

java - Passing Any Type As A Method Parameter -

this question has answer here: passing in “any” class type java method 3 answers i trying have method can take in type parameter (object, int, boolean, arraylist, etc.). here simple method illustrate trying do: public void printanything(type arg0) { system.out.println(arg0); } and asking is, replace type in method? in specific example, object fit because printstream#println(object obj) print string representation (using string#valueof(object) ). when pass primitive value, automatically boxed wrapper type, e.g int converted java.lang.integer extends object .

javascript - Array returning undefined at higher granularity -

i using ajax read csv file in object of arrays. problem i'm having data being read correctly , appears in object if move down layers undefined messages. though in top view of object there. think might have timing working large amounts of data. js $(document).ready(function () { var data = readcsv(); populatetable(data); }); function readcsv() { var data = {"columns":[], "rows":[]}; $.ajax({ url : 'assets/php/readcsv.php', type : 'post', success : function (csv) { var colcount = csv[0].length, rowcount = csv.length; (var c = 0; c < colcount; c++) { data['columns'][c] = csv[0][c]; } csv.splice(0,1); (var r = 0; r < rowcount; r++) { data['rows'][r] = csv[r]; } }, error : function () { alert("error: unable read csv file. pleas...

SQL Server - where + TVF/SVF, cross-apply, T-SQL -

i trying create sql pull out data based on date, having troble use clause need have following table , tvf: /* dbo.weeks -> column(weeknum), column(date) **date fridays** */ weeknum date 1 2001-09-21 2 2001-09-28 3 2001-10-05 ... .... /* fnbenchmark(@weeknum) -> display benchmark data based on weeknum */ here code: select p.weeknum, p.date, q.companyid, q.index dbo.weeks p cross apply dbo.fnbenchmark(p.weeknum) q date = '2001-09-21' /* here wish add above code don't know how */ if date in dbo.weeks column (date) --if date on clause friday , on dbo.weeks table run above code else change date lastfridaydate --if date on clause sat~thur, use previous friday's date run above for example, let's 2001-09-21 friday, if enter 2001-09-24 on clause, want sql run "where date = " 2001-09-21 " since 2001-09-24 entered not friday" maybe should create function (svf?) return previous...

lucene - ElasticSeach JAVA API to find aliases given index -

how find aliases given index in elasticsearch using java? by using rest api pretty easy https://www.elastic.co/guide/en/elasticsearch/reference/1.x/indices-aliases.html#alias-retrieving but unable find reference on how via java api while working elasticsearch, ran issue needed list of aliases based on provided index. while getting list of aliases pretty straightforward: client.admin().cluster() .preparestate().execute() .actionget().getstate() .getmetadata().aliases(); i struggled find easy way able aliases given index without having iterate through first. my first implementation looked this: immutableopenmap<string, immutableopenmap<string, aliasmetadata>> aliases = client.admin().cluster() .preparestate().execute() .actionget().getstate() .getmetadata().aliases(); (objectcursor<string> key: aliases.keys()) { immutableopenmap<string, aliasmetadata> indextoaliasesmap = client.admi...

javascript - Getting current location on a map using Meteor -

hey using 2 packages dburles:maps , mdg:geolocation , goal plot current location on map. current js code display's map, not sure how proceed it. map.js edited meteor.startup(function() { googlemaps.load(); }); template.map.helpers({ mapoptions: function() { if (googlemaps.loaded()) { return { center: new google.maps.latlng(current), zoom: 8 }; } } }); template.map.oncreated(function() { googlemaps.ready('map', function(map) { if (navigator.geolocation) { // support navigator.geolocation.getcurrentposition(function(position) { var current = new google.maps.latlng(position.coords.latitude, position.coords.longitude); }); map.setcenter(current); } else { // no support console.log("something wrong!") } }) }) i think supposed add in if(navigator.geolocation , place value in center: new google.maps.latlng() , not sure. ideas? you're on rig...

Android datepicker ondateSetListener executed twice -

every time code launch callback, date picked (and inserted in database) twice. of course don't need beahviour. note error in bluestack emulator (android 4.3), galaxy ace rooted cyanogenmod 4.4 not in samsung s3 (android 4.3) thank you private void setfab(){ // button floatingactionbutton neweventbutton = (floatingactionbutton) v.findviewbyid(r.id.set_new_event); neweventbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { calendar c = calendar.getinstance(); int myear = c.get(calendar.year); int mmonth = c.get(calendar.month); int mday = c.get(calendar.day_of_month); datepickerdialog dialog = new datepickerdialog(getactivity(), datepickerlistener, myear, mmonth, mday); /*dialog.setbutton(datepickerdialog.button_positive, "ok", dialog); dialog.setbutton(dialogint...

machine learning - How can I make Weka classify the smaller class, with a 2:1 class imbalance? -

how can make weka classify smaller classification? have data set positive classification 35% of data set , negative classification 65% of data set. want weka predict positive classification in cases, resultant model predicts instances negative classification. regardless, classifying negative (larger) class. how can force classify positive (smaller) classification? one simple solution adjust training set more balanced (50% positive, 50% negative) encourage classification both cases. guess more of cases negative in problem space, , therefore need find way ensure negative cases still represent problem well. since ratio of positive negative 1:2, try duplicating positive cases in training set make 2:2 , see how goes.

swift2 - Xcode 7: Can't use CalendarUnitMonth in Swift 2.0, Xcode 7 -

i using swift2. i used code: let calendar = nscalendar.currentcalendar() let components = calendar.components(.calendarunitmonth | .calendarunitday, fromdate: thedate) i getting error: could not find member 'calendarunitmonth '  check swift 2 documentation , search optionsettype (adopted nscalendarunit ). can use in way: let calendar = nscalendar.currentcalendar() let components = calendar.components([.month, .day], fromdate:nsdate())

c# - AppCompatActivity ActionbarDrawerToggle -

i changed 1 of activity class inheriting actionbaractivity(because class obsolete in new android version) appcompatactivity. specify icon want navigation drawer use before change, after new actionbardrawertoggle doesn't allow that. i able implement , display drawer icon, issue i'm having how change color of icon(the 3 lines icon) black white. the colors of items in toolbar depend on theme. if using theme.appcompat (the dark theme) icons white. if using theme.appcompat.light icons dark. there theme.appcompat.light.darkactionbar . more using appcompat library. this example using theme.appcompat.light.darkactionbar (light theme dark action bar , white icons in actionbar) <style name="appbasetheme" parent="theme.appcompat.light"> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <item name="coloraccent...

Discovering IoT Devices on the network -

i'd discover information iot devices on network possible. i've seen code enumerate devices, find ip addresses , mac addresses, else can find? in particular, i'd know lamp, , more importantly, manufacturer is. i've been looking through documentation iotivity , alljoyn various 0 configuration protocols. understand, these things more concerned services exposed rather device is. do misunderstand this? there way map out local network , know each device is? alljoyn offers about announcement service through can looking for: app , device friendly names make, model, version, description supported languages app icon supported objects , interfaces ...

php - Incorrect path to S3 flysystem adapter in Laravel 5 -

i'm having issue laravel 5's filesystem when uploading files s3 bucket. line running filesystem is: storage::disk('s3')->put($slug, $img); it works should for: storage::disk('local')->put($slug, $img); but when change disk s3 throws following error: class 'league\flysystem\awss3v3\awss3adapter' not found as per l5 docs, have following requirement in composer.json "league/flysystem-aws-s3-v2": "~1.0" which installed league's aws flysystem adapter under: league\flysystem-aws-s3-v2\ i have tried updating path in filesystemmanager.php in filesystem vendor folder aws flysystem installation path still doesn't work. can't seem find else has experienced behaviour. a fresh pair of eyes or knowledgeable head might know more laravel great. can't seem issue. update i did fresh install of aws flysystem , not following: errorexception in util.php line 250: fstat() expects parameter 1 resource, o...

java - Cannot find array -

i error "cannot find named coordinates" @ line 110: system.out.println(coordinates[k][l]); when trying run this: import tuio.*; tuioprocessing tuioclient; int cols = 15, rows = 10; boolean[][] states = new boolean[cols][rows]; int videoscale = 50; // these helper variables used // create scalable graphical feedback int x, y, i, j; float cursor_size = 15; float object_size = 60; float table_size = 760; float scale_factor = 1; pfont font; boolean verbose = false; // print console debug messages boolean callback = true; // updates after callbacks void setup(){ size(500,500); nocursor(); nostroke(); fill(0); // periodic updates if (!callback) { framerate(60); //<>// loop(); } else noloop(); // or callback updates font = createfont("arial", 18); scale_factor = height/table_size; // create instance of tuioprocessing client // since add "this" class argument tuioprocessing class expects // implementation ...

javascript - Meteor : Apply function to a value -

i'm starting learning meteor official tutorial ( https://www.meteor.com/tutorials/blaze/templates ). i want use "createdat" value have on database. since value instance of date, want print day of insert using getday() function of date class. my question : how :p mean, can directly on html file or must use smth function in our .js ? thanks :) you have write helper function template in js file parameters , call in html template {{helpername parameter}}

javascript - How to make JS function wait for JSON data to load? -

this works: function getdatajson() { var querystring = "https://www.examplesite.com/somejson.json"; $.getjson(querystring, function(data) { dostuffwithdata(data) }); } function dostuffwithdata(json) { // code refers json } getdatajson(); but complains variable (json) undefined somewhere in dostuffwithdata(): function getdatajson(callback) { // gets share data , runs callback when received var querystring = "https://www.examplesite.com/somejson.json"; $.getjson(querystring, function(data) { if(typeof callback === "function") { callback(data); } }); } function dostuffwithdata(json) { // code refers json } getdatajson(dostuffwithdata()); what doing wrong? $.getjson() call takes second or 2 need wait , stuff after it. think issue code execution order, i've misunderstood how pass data callback function. it better if load data variable other functions can acc...

node.js - Google Oauth giving code redeemed error -

hi working on project user logs in via google account.(localhost) have implemented google signup. log in account getting below error. tokenerror: code redeemed. @ strategy.oauth2strategy.parseerrorresponse (c:\projects\internship_rideshare\node_modules\passport-google-oauth\node_modules\passport-oauth\node_modules\passport-oauth2\lib\strategy.js:298:12) @ strategy.oauth2strategy._createoautherror (c:\projects\internship_rideshare\node_modules\passport-google-oauth\node_modules\passport-oauth\node_modules\passport-oauth2\lib\strategy.js:345:16) @ c:\projects\internship_rideshare\node_modules\passport-google-oauth\node_modules\passport-oauth\node_modules\passport-oauth2\lib\strategy.js:171:43 @ c:\projects\internship_rideshare\node_modules\passport-google-oauth\node_modules\passport-oauth\node_modules\passport-oauth2\node_modules\oauth\lib\oauth2.js:176:18 @ passbackcontrol (c:\projects\internship_rideshare\node_modules\passport-google-oauth\node_...

Vim 7.4+ Mapping -

i have upgraded vim 7.3 7.4.712. in process, i've goofed couple of bindings. specifically, want map ':w' w , works, every time hit w saves advances cursor 1 word. there way can interrupt advance behavior without rebinding 'w' key everywhere? my vimrc can found here https://github.com/zacherypd/.dotfiles/blob/master/vimrc

php - multi curl does not work asynch with different proxies -

so using parallelcurl lib in code, have tried other wrappers , result pretty same, is, if specify proxy requests not handled asynchronously sequentially, not specify proxy option works should in async...why? have add using hhvm not seem problem it... $timeout = 2; $opt_arr = array( curlopt_followlocation => 1, curlopt_returntransfer => 1, curlopt_header => 1 curlopt_connecttimeout => $timeout ); $parallelcurl = new parallelcurl(200, $opt_arr); foreach($proxies $proxy){ $opt_arr[curlopt_proxy] = $proxy; $parallelcurl->setoptions($opt_arr); $parallelcurl->startrequest($url, 'callback_p', array('proxy'=> $proxy)); } $parallelcurl->finishallrequests(); so problem not in php or curl, in test url, totally had tunnel vision , never occurred me since testing them against google, , seems google hard cap requests @ 17 threads, after throws out denies

multithreading - C++ Hierarchical Data Structure for Multi-Threaded Application -

i looking hierarchical data-structure use in c++ application well-suited frequent read/write operations multiple threads. i intend use data-structure multiple purposes, perhaps indicative use-case scenegraph implementation in nodes can contain terminal properties child nodes. in usage, function on main thread repeatedly traverse node tree , render scene opengl context while another thread performs periodic changes scene's properties. ignoring multi-threaded read/write access moment, can think of numerous custom , out-of-the-box ways of achieving functionality (some more efficient others). json 1 solution. though, in c++ context, prefer circumvent large number of lexical casts come storing terminal properties strings. in case, using boost::variant generic property type preferable. but of course main concern multi-threading issue. a few possible solutions come mind are: mongodb boost graph library / parallel boost graph library a custom implementation using lockin...

javascript - How can I associate a number to a specific string and use that string to filter an iteration in AngularJS? -

i new angularjs , i'm having problems doing reusable generic filter. let's have colors , types , , list objects seen below (new json). want make generic filter take colors , types objects , filter list object without having use string match filter. for did specific filters strings seen below. i have lot of information in these objects , don't want update controller each time new property being included in json. how associate number specific string value? old json [ { "id": 1, "name": "spike", "type": "dog", "color": "gray" }, { "id": 2, "name": "tom", "type": "cat", "color": "blue" }, { "id": 3, "name": "butch", "type": "cat", "color": "bl...

javascript - Alfresco: Class has not been defined in the data dictionary -

i using javascript create custom data list item workflow. javascript works if use default alfresco data list, not custom one. javascript excerpt .bpmn file // site name , datalists var site = siteservice.getsite("testing"); var datalists = site.getcontainer("datalists"); // check data list existence if (!datalists) { var datalists = site.createnode("datalists", "cm:folder"); var datalistprops = new array(1); datalistprops["st:componentid"] = "datalists"; datalists.addaspect("st:sitecontainer", datalistprops); datalists.save(); } var orplist = datalists.childbynamepath("orplist1"); if (!orplist) { var orplist = datalists.createnode("orplist1","dl:datalist"); // tells share type of items create orplist.properties["dl:datalistitemtype"] = "orpdl:orpdatalistmodel"; orplist.save(); var orplistprops = []; orplistprops["cm:title...