Posts

Showing posts from August, 2014

In spray for scala, get a FromRequestUnmarshaller from an ordinary Unmarshaller -

in scala spray, there way convert unmarshaller[t] fromrequestunmarshaller[t] . i'm stuck trying make entity directive work without using implicits. example: ... } ~ post { path("mypath") { entity(sprayjsonunmarshaller[mycaseclass](mycaseclassrootjsonformat)) { mycaseclass => complete { handle(mycaseclass) } } } ~ ... compiler error: multiple markers @ line - type mismatch; found : spray.httpx.unmarshalling.unmarshaller[mycaseclass] (which expands to) spray.httpx.unmarshalling.deserializer[spray.http.httpentity,mycaseclass] required: spray.httpx.unmarshalling.fromrequestunmarshaller[?] (which expands to) spray.httpx.unmarshalling.deserializer[spray.http.httprequest,?] - type mismatch; found : spray.httpx.unmarshalling.unmarshaller[mycaseclass] (which expands to) spray.httpx.unmarshalling.deserializer[spray.http.httpentity,mycaseclass] required: spray.httpx.unmarshalling.fromrequestunmarshaller[?] (which

c# - Fast parallel adding to dictionary when keys never collide -

i have situation, dictionary created, key-value pairs added, , after point dictionary used reading values. i'm trying implement quickest way of adding dictionary in initialization phase. concurrentdictionary has slow tryadd method (and getoradd) - on 6 core cpu (12 threads), cpu usage stays @ 25%, indicating 3 threads used. it faster add keys (around 25 million) dictionary sequentially, using concurrentdictionary , parallel.for. how can improve speed here? easy separate key-value pairs, keys never collide when added dictionary, using code below creates problems: dictionary<long,string> d = new dictionary<long,string>(); d[key] = value; it seems this, when used in multi-threaded environment, fails because dictionary internal changes (resizing?). would work instead? capacity = 250000000 //basically big enough store data dictionary<long,string> d = new dictionary<long,string>(capacity); d[key] = value; i prefer using dictionary on concurre

How can you distinguish onPause() due to onNewIntent vs user action in android -

if have set activity in android fire onnewintent() when receives intents when in stopped or paused state. goes through following sequence if receives intent while running: onpause() -> onnewintent() -> onresume() but if paused due user action onpause(). now if want in case user hid app not in case getting new background intent. doing example cancelling recording when app gets hidden, seems screwed. you wont know until sometime in future whether got onpause because user hid app or because of incoming background intent. am missing or broken? why don't send onnewintent callback if intent while running. rather pause, onnewintent, resume sequence? if stumbles upon again - not possible detect if onpause() called due new intent onresume() can detected. add bundle_key_new_intent_called when onnewintent() called , check flag in onresume() , take required action. @override protected void onnewintent(intent intent) { super.onnewintent(intent);

java - Source of project errors in Eclipse IDE -

Image
very often, case there compilation error in project, yet can't find source of error. for instance: this web project has error, yet it's guess error is. why isn't there way right-click option called "find source of compilation error"? there's no quick fix option available. this simple question. don't understand why issue, because eclipse knows problem is, why won't eclipse tell me? press ctrl + 3 type problems , hit enter . should show list of issues in project.

objective c - How to make a "within window" transparent/blurry title bar using a custom base color in Yosemite? -

Image
i've been playing around nsvisualeffectviews in yosemite , transparent titlebars wondering if it's possible have custom title bar, own base color (not gray), act apple's. here's current nswindow : achieved setting following code on custom nswindowcontroller : self.window.stylemask = self.window.stylemask | nsfullsizecontentviewwindowmask; self.window.titlevisibility = nswindowtitlehidden; self.window.titlebarappearstransparent = yes; that blue color custom nsview that's painting rect particular color. content below nstableview . so, goal have titlebar work like, let's say, maps instead of having "base" color gray color, "base" color blue 1 , when nstableview scrolls, content appears below title bar. any ideas on how achieve this? thanks have tried setting blue color transparency of, e.g., 0.75 in blue view, , nsvisualeffectview underneath it?

Grails export plugin strange behavior, errs only on PDF, others fine -

i using exporter plugin 1.6 grails 2.3.8 , controller's list method: def list () { println "*** list method called." println "*** params: " + params if(!params.max) params.max = 10 if(params?.exportformat && params.exportformat != "html"){ response.contenttype = grailsapplication.config.grails.mime.types[params.exportformat] response.setheader("content-disposition", "attachment; filename=chairs.${params.extension}") list fields = ["constructionmaterials"] map labels = ["constructionmaterials": "construction materials"] // formatter closure def uppercase = { domain, value -> return value.touppercase() } map formatters = [constructionmaterials: uppercase] map parameters = [constructionmaterials: "cool chairs", "column.widths": [0.2, 0.3, 0.5]] println "**

c# - Calling Web Method in Web Service -

basically trying consume web service methods in javascript class in asp.net. here methods in web service: [webmethod] public dataset getfirestation() { sqlconnection sqlconnection1 = new sqlconnection(configurationmanager.connectionstrings["dbconnectionstring"].connectionstring); string select = "select * dbo.firestation "; sqlconnection1.open(); // create adapter sqldataadapter da = new sqldataadapter(select, sqlconnection1); // create new dataset dataset ds = new dataset(); // fill dataset contents of stock table da.fill(ds, "firestation"); sqlconnection1.close(); // return ds dataset return (ds); } then here html code call function in javascript class: case "accident": if (type == 'accident') { symbol = new esri.symbol.picturemarkersymbol('img/accident.gif', 25, 20);

ibm mobilefirst - Worklight - EncryptedCache open fails with error status 10 -

i having problems encryptedcache on htc 1 android phone. same code works on phone , in browser simulator fails on htc 1 android phone unusual error code. i using: worklight 6.2 failing on: htc one, android 4.4.2 (cyanogenmod) working on: samsung i9100 galaxy s ii working on: browser simulator wl.encryptedcache.open fails on phone , return status 10.. (* wl.encryptedcache.write fails on phone , return status 6..) i have run sample app developerworks as-is on htc 1 phone same results , error code. sample app link logcat log: captured sample app 1) destroyed cache 2) entered new key 3) opened cache 4) got alert error message full log can downloaded here my code is: function wlcommoninit(){ var storage_id = 'todos'; wl.encryptedcache.open(storage_id, true, function(){ //success console.log('--> cache opened'); console.log("--> loading angular"); angular.element(document).ready(functi

date - Excel column NumberFormat = "d-mm-yy" -

i'm trying change excel column format different date format. data in date format mm/dd/yyyy, want change d-mm-yy. so, 11/25/14 , change 25-11-14 . excel_sheet.columns("a").numberformat = "d-mm-yy" this partially works, changes format 'date' 'custom', appears correctly, users want able sort based on value date. thanks, queue

Python names in a list -

so i'm kinda new python , given problem follows: given list names , find largest element in list , swap last element. example, list ["carlton", "quincy" "adam", "bernard"] become ["carlton", "bernard", "adam", "quincy"] . assume names not empty i thought doing list comprehension don't know how write out in code edit: largest in case length of string (sorry not clarifying!!!)) names = [foo, fooooo, bar, baaar] a, b = i.index(max(name, key=len)), -1 i[b], i[a] = i[a], i[b] courtesy of this .

drop down menu - AngularJS - Default Dropdown Select Option -

this 1 issue bugging me since seems easy fix. i using plain html, data being passed next view via angular. the snippet of code looks this: <span data-ng-show="iscountry()"> <select class="selectpicker" data-ng-model="age"> <option value="21">21-24</option> <option value="25">25-30</option> <option value="31">31 , up</option> </select> </span> what trying achieve: having <option value="25">25-30</option> default selected option when angular loads what i've tried: having <option value="25">25-30</option> ng-selected="age" attribute <span data-ng-show="iscountry()"> <select class="selectpicker" data-ng-model="age"> <option value="21">21-24</option> <option ng-selected="age" value="25&qu

delphi - SQLite delete from table where condition is of boolean type -

i trying run query without success : datamodule1.uniquery5.close; datamodule1.uniquery5.sql.clear; datamodule1.uniquery5.sql.text:='delete mytable job_done = "1"'; datamodule1.uniquery5.execsql; job_done boolean field. since sqlite has 2 conditions true/false (0 or 1), failing understand why nothing gets deleted. can me ? try command delete mytable job_done = 1; without quotes

php - How do I merge two associative arrays such that key collisions result in an array of both values? -

i have 2 or more array same key, want merge these arrays keep value. exp: $arr1 = array("message" => "message 1"); $arr2 = array("message" => "message 2"); echo "<pre>"; print_r($arr3 = somefunction($arr2,$arr1)); echo "</pre>"; i want result this: array ( [message] => array ( [0] => message 1 [1] => message 2 ) ) array_merge_recursive() : merges elements of 1 or more arrays values of 1 appended end of previous one. returns resulting array. example : <?php $arr1 = array("message" => "message 1"); $arr2 = array("message" => "message 2"); echo "<pre>"; print_r($arr3 = array_merge_recursive($arr2,$arr1)); echo "</pre>"; ?> output : array ( [message] => array ( [0] => message 2

c# - Good Practice? Redefining Arrays to Change their Size -

i'm working in unity in c#, more general programming practice question. datatype[] array = new datatype[x]; //further down datatype[] newarray = new datatype[array.length + 1]; (int i=0;i<array.length;i++){ newarray[i] = array[i]; } is considered bad practice? more/less efficient using arraylist? i'm performing operation @ beginning of level , never again, worth working arraylists? yes, bad practice. if expect array size change use list instead of array. list works array in terms of indexing. add new items list use add(). can call toarray() on list array it. http://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx if come across situation can't use list , need grow array, use array.resize() shown below. int[] array = new int[5]; console.writeline(array.length); array.resize<int>(ref array, 20); console.writeline(array.length);

Saving a plot in python creates only an empty pdf document -

i using example code exists @ official matplotlib page http://matplotlib.org/examples/api/barchart_demo.html #!/usr/bin/env python # bar plot errorbars import numpy np import matplotlib.pyplot plt n = 5 menmeans = (20, 35, 30, 35, 27) menstd = (2, 3, 4, 1, 2) ind = np.arange(n) # x locations groups width = 0.35 # width of bars fig, ax = plt.subplots() rects1 = ax.bar(ind, menmeans, width, color='r', yerr=menstd) womenmeans = (25, 32, 34, 20, 25) womenstd = (3, 5, 2, 3, 3) rects2 = ax.bar(ind+width, womenmeans, width, color='y', yerr=womenstd) # add ax.set_ylabel('scores') ax.set_title('scores group , gender') ax.set_xticks(ind+width) ax.set_xticklabels( ('g1', 'g2', 'g3', 'g4', 'g5') ) ax.legend( (rects1[0], rects2[0]), ('men', 'women') ) def autolabel(rects): # attach text labels rect in rects: height = rect.get_height() ax.text(rect.get_x()+rect.get_

c# - Why do we need generics if all classes we used usually inherit from some common class? -

good day. generics used this: class mylist<t> { public t data; public mylist<t> nextelement; } why not instead use follow: class mylist { public object data; public mylist nextelement; } or even: class mystructure<t> t : somecommonclass { public t data; public mystructure<t> nextelement; public mystructure<t> prevelement; } and instead: class mystructure { public somecommonclass data; public mystructure nextelement; public mystructure prevelement; } update: well, afraid not understood me correctly, , downgraded question. example without generics, work correctly: public partial class form1 : form { public form1() { initializecomponent(); } private void form1_load(object sender, eventargs e) { mynode nodebutton = new mynode("nodebutton", new button()); mynode nodetextbox = new mynode("nodetextbox", new textbox()); mynode n

ruby on rails - aws - how to store the file details using s3_direct_upload -

in rails 4.0.2, using s3_direct_upload gem upload files directly s3, after want store files & convert html, want store dependency files converted .html / .txt files s3. not able files s3 & not saving database. i have referred http://blog.littleblimp.com/post/53942611764/direct-uploads-to-s3-with-rails-paperclip-and . how can overcome problem? awaiting solution.

php - Insert multiple value isn't working -

this question exact duplicate of: insert multiple values in php mysql 1 answer i'm trying write code multiple insert value isn't working. error warning: invalid argument supplied foreach(). appreciate. if (isset($_post['mul_pr'])) { $counter = $mysqli->real_escape_string($_post["counter"]); $pr = $mysqli->real_escape_string($_post["pr"]); $pr_qty = $mysqli->real_escape_string($_post["pr_qty"]); $unit = $mysqli->real_escape_string($_post["unit"]); $pr_date = $mysqli->real_escape_string($_post["pr_date"]); $gss_date = $mysqli->real_escape_string($_post["gss_date"]); $request = $mysqli->real_escape_string($_post["requested"]); $approve = $mysqli->real_escape_string($_post["approved"]); $desig_r = $mysqli->real_escape_string($_post["designatio

How should I write this SQL query? -

i have query this: select sum(tab1.amount) amount tab1 join tab2 on tab1.lp_id = tab2.id join tab3 on tab3.employee_id = tab2.employee_id tab1.officeid =123 , tab3.space <> 2 this works fine. want add more filter it. have table tab4, in have columns employee_id, effective_date, salary. ie each employee maintain dates when salary got changed (ie multiple records per employee). want pick employees latest salary greater 10000. how should write this? want this: select sum(tab1.amount) amount tab1 join tab2 on tab1.lp_id = tab2.id join tab3 on tab3.employee_id = tab2.employee_id tab1.officeid =123 , tab3.space <> 2 , ( select salary ( select * tab4 tab4.employee_id = tab2.employee_id order effective_d desc ) rownum = 1 ) > 10000 i trying add last 2 lines - error because cannot use tab2.employee_id . how should write thi

c# - 'Date' datatype of a column is not updating in EF -

Image
initially, date_in column in db set 'datetime' datatype. due issues, modified 'date' datatype. when tried update model in entity framework right clicking in designer 'update model database', column datatype not setting 'date' datatype. modified datatype date_in column: update model database : datetype not changed: in properties column, not find 'date' datatype. please check through below images further details. please let me know how proceed this. alternatives? there no date type in c# (which it's showing in type field). if change data type in database datetime date still map datetime in model in ef.

php - Display records in ascending order when records are like 12.108.90 -

how display records in ascending order using php/mysql when records this: 12.108.90, 7.60.109.3, 56.23.45.78.9, 1.7.9.08 ? these records multiple frequency numbers, , want display them in ascending order, i'm not getting correct format. current query looks this: select * revision order revid desc the revid records similar to: 12.8.90 , 7.889.56.90 , 14.78.0 , , 16.67.87.12 . how can correct query sort records in ascending order? try using usort . eg: $array = array( '12.108.90', '7.60.109.3', '56.23.45.78.9', '1.7.9.08', ); usort($array, function($a, $b) { $a = explode('.', $a); $b = explode('.', $b); foreach($a $key => $valuea) { if(!isset($b[$key])) { return 1; } $valueb = (int)$b[$key]; $valuea = (int)$valuea; if($valuea === $valueb) { continue; } return $valuea - $valueb;

How can I fetch all contacts on an Android phone, in an Activity? -

how can fetch contacts on android phone, in activity? make contact class get contacts list contentresolver() parse contacts list , fill arraylist<contact> make contactarrayadapter contactarrayadapter sample //////////////////////////////////////////////////////////////////////////// private class contactsadapter extends arrayadapter<contact> { private final int _resourceid; private final layoutinflater _inflater; private final context _context; public contactsadapter(context context, int textviewresourceid, list<contact> contacts) { super(context, textviewresourceid, contacts); _context = context; _resourceid = textviewresourceid; _inflater = layoutinflater.from(context); } @override public view getview(int position, view v, viewgroup parent) { viewholder holder; if (v == null) { v = _inflater.inflate(_resourceid, null); holder = new viewholder(

ruby - Function name followed by assignment operator -

this question has answer here: what difference between def func(var) , def func=(var)? 3 answers what following function definition mean? why there assignment operator in function name? def func=(param) @param = param end what following function definition mean? they called writer method in ruby. why there assignment operator in function name? it adds sugar in syntax. while have method as def func=(param) @param = param end you can call normal assignment ob.func = 12 # same obj.func(12)

utf 8 - Hindi UTF-8 font not being displayed in Internet Explorer -

i developed multilingual website http://www.governmentjobsworld.com/en/ . website supports 2 languages 1. english , 2. hindi ( http://www.governmentjobsworld.com/hi/ ). able view websites pages in both languages in mozilla firefox , chrome. pages in hindi not displaying hindi characters in internet explorer. ie version 11. did research support utf-8 in ie did not help. please let me know missing.

html - convert html5 time input to another format -

is there way convert html5 date input 1 format another? for example: 2014-06-18 11:17:17 18-06-2014 11:17:17 ? <input type="time" name="time" /> each browser shows differently. opera (presto engine) shows right way. chrome (webkit engine) shows in am/pm. firefox (gecko engine) doesn't show anything, validates. input type=time based on idea of localization takes out of hands of page author. intentional; problem has been raised in html5 discussions several times, same outcome: no change. (except possibly added clarifications text, making behavior described intended.) that should use input type=text, pattern attribute , javascript checks input correctness on browsers not support pattern attribute natively.

json - Concurrent users Load Testing REST API with CURL command Using Jmeter Tool -

scenario is heroku server sends web service call parse.com using curl command. web services written jason , using rest. i need test performance of parse.com server website in case of 40 users hitting @ 1 time as communication between heroku server , parse.com through rest jason web services assume need generate concurrent 40 calls of each web service hit parse.com. each curl command has 1 user session token , parameters in header configure in jmeter http request when generating loaded web service call i need test scenario in 40 concurrent users simultaneously create project (create project web service) on parse.com (there no web service creating users each curl command has user session token key of each user signed on website) problem: curl command creating project on parse.com has 1 user session. if enter 40 value in thread. create 40 projects against 1 user session. whereas want 40 users creating 40 project simultaneously. here curl command 1 user session curl -x po

java - Transform an "empty" XML with XSLT or: How to use an XML Template? -

is possible transform "empty" or non-existing xml xml xslt? what i'm trying fill in couple of parameters template xml. say, xml looks like: <sometag value="somevalue">somevalueorother</sometag> <othertag>dynamicvalue</othertag> how fill these values? i generate empty xml document , transform (and disregard input), seems ugly. i'd rather use sort of template. also, i'm no fan of doing things in code jaxb: mydoc.getsomeelement().getsomethingnested().getevenmorenested().setfooelement("someval"); ideally, have static xml-file placeholders or that. one (little-known) approach use "simplified stylesheet" syntax. use stylesheet this: <root xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <fixedtag>fixed content</fixedtag> <sometag><xsl:value-of select="*/param1"/></sometag> <othertag>

r - fread error "unexpected character ending field" -

could please me? i trying load large tsv file (4 mln rows), , using 'fread' (enormous speed :) problem when reaching line program crashes. last message verbose " bumping column 12 int64 real on data row 2220004, field contains '0.54'" i tried copy till row 'skip' option - worked fine, after when trying copy last rows thrown error: unexpected character ("Ам) ending field 5 of line 2220005 after tried disable header, drop 12th column, input column classes - nothing worked. any ideas how overcome issue? my code: library(data.table) movies <- fread('avito_train.tsv', verbose=true, nrows=2220002) movies2 <- fread('avito_train.tsv', verbose=true, sep="\t", skip=2220004, colclasses=c("integer", "character", "character","character","character", "character","integer","integer","integer","integer","intege

c++ - allocating an object of abstract class type error -

hi i'm getting following error , unsure why. class intesivis: public ofbaseapp //{ , public ofxmidilistener{ this occurs when make class inresivis inherit ofxmidilistener class , following error in main source file int main( ){ ofsetupopengl(1920,1080, of_window); ofrunapp( new intesivis()); // <-------- error here allocating object of type abstract } this confusing have tried example in exact way , not error. class testapp : public ofbaseapp, public ofxmidilistener { int main(){ ofsetupopengl(640, 480, of_window); ofrunapp(new testapp()); } could give me idea why i'm getting error i'm calling class in exact same way. in advance. ///----------------------------------edit intesivis.h class intesivis: public ofbaseapp //{ , public ofxmidilistener{ public: intesivis() ; void setup(); void update(); void draw(); void exit(); void keypressed(int key); void keyreleased(int key); // make array of

ios - How private document directory can be set in iOS8 as storage provider application extension is making default Document directory Shared? -

my ios app running & till ios7. run on ios8 beta version crashed. when tried investigate found in ios8 storage provider changed path default document directory. how can set default document directory keep applications private data safe how getting path of documents directory? if use recommended api (like below) should translate on ios8 without problems. nsstring *docsdir = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes)[0]; also, not clear mean "keeping private data safe" -- data write documents directory not accessible other app.

jenkins - Is it possible to use Selenium IDE html test and capture screenshots on failure -

i have created few html test suites selenium ide. automatically tested , jenkins daily. now, i'm wondering if possible create screenshot whenever test fails. is possbile catch exeption when ide test fails , capture screen? or possible testng? if it's possible testng, how selenium html tests work combined testng? kind regards, selenium ide doesn't directly support saving screen shots this. check out other (duplicate) question: screenshots using selenium ide firefox plugin

sql server - Efficient Amazon style 'customer also viewed' SQL Query -

i figured out need record client session id , viewed product id in order acheive this. here table script: create table [dbo].[pagevisits]( [id] [int] identity(1,1) not null, [xsession] [int] null, [xpagename] [int] null ) on [primary] i've come query seems work ok select top 5 xpagename, count(xpagename)as total pagevisits pagevisits.xsession in (select pagevisits.xsession pagevisits \ pagevisits.xpagename = 20 , pagevisits.xsession != 539447381 ) , pagevisits.xpagename != 20 group xpagename order total desc however being bit of novice @ sql i'm fearful table grow quite large, choke server? there better way or ok? i not sure why need inner select there. if want select pages visited customer in existing session (assumption: session id known) other current page, can: select top 5 xpagename, count(xpagename)as total pagevisits pagevisits.xsession =

entity framework - REST interface to include referenced entities - .NET 4.5, MVC + EF -

let's have 2 entities: 1. order 2. package each package has foreign key order, ie. 1 order has 1 or more packages. created rest interface able retrieve orders in json format. public ienumerable<order> get() { using (dbcontext db = new dbcontext()) { return db.order.tolist(); } } i wondering if there elegant way of including children packages in above json response, packages each order? thanks

unity3d - Unity 3d iOS inapp transaction raw data -

for verification matters need data ios skpaymenttransaction transactionidentifier property transactiondate property transactionreceipt originaltransaction.transactionidentifier originaltransaction.transactiondate (see reference ) i tried prime31 storekit plugin, doesn't have need: prime31 class so how can access properties? ways or other plugins can suggest?

javascript - How can I move dynamically a gridLine with mouse in D3.js? -

i know, how can move gridline up/down dynamically mouse in d3.js ? thanks lot :) the way have done in past add horizontal or vertical line graph , mark hidden. then whenever element moused-over show line, whenever element moused-out hide line again. need set x , y values of line such matches location of element cursor hovering over. this similar way showing/hiding tooltips work: https://gist.github.com/biovisualize/1016860 except not use div (you use line) , not use location of mouse pointer (you use x , y of element).

jquery - How to redirect to a page and add custom headers to the redirect -

hi need build log in page out using sessions or cookies. how do redirect , add custom headers the redirect? want add custom header "authorize" redirect can validate token logged in user. i'm using zend-framework , jquery. in not allowed use meta tags. thanks in advance. it seems wish not possible added custom headers discarded because redirect considered new request browser. sessions , cookies suggested solution. you can verify going through lot of questions asked before.

android - How do I add an alert dialog on a onClick method? -

i want add alert dialog have loading state while request executed. possible like: xbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { xbutton.setvisibility(view.invisible); alertdialog alertdialog = new alertdialog.builder(this).create(); alertdialog.setmessage(please wait); alertdialog.show(); // work here alertdialog.dismiss } }); } return view; thank in advance if don't have specific reason use alert dialog can use progress dialog. @override public void onclick(view v) { xbutton.setvisibility(view.invisible); new asynctask<void, void, void>(){ progressdialog mprogressdialog; @override protected void onpreexecute() { super.onpreexecute(); mprogressdialog = new progressdialog(<youractivityclassname&g

networking - OpenFlow actions=CONTROLLER:51 meaning -

i have network topology using mininet.the topology connected ryu simple_switch.py program.i have 6 switches , 6 hosts on network. the contents of flow table on 6 swtiches given below. table s1 nxst_flow reply (xid=0x4): cookie=0x0, duration=10.97s, table=0, n_packets=11, n_bytes=561, priority=65535,dl_dst=01:80:c2:00:00:0e,dl_type=0x88cc actions=controller:51 table s2 nxst_flow reply (xid=0x4): cookie=0x0, duration=10.947s, table=0, n_packets=11, n_bytes=561, priority=65535,dl_dst=01:80:c2:00:00:0e,dl_type=0x88cc actions=controller:51 table s3 nxst_flow reply (xid=0x4): cookie=0x0, duration=10.921s, table=0, n_packets=11, n_bytes=561, priority=65535,dl_dst=01:80:c2:00:00:0e,dl_type=0x88cc actions=controller:51 table s4 nxst_flow reply (xid=0x4): cookie=0x0, duration=10.893s, table=0, n_packets=11, n_bytes=561, priority=65535,dl_dst=01:80:c2:00:00:0e,dl_type=0x88cc actions=controller:51 table s5 nxst_flow reply (xid=0x4): cookie=0x0, duration=10.86s, table=0, n_packets=11,

javascript - Google Combo Chart + multiple legend for != data -

Image
a short explenantion. i'm using google combo chart display graph below : https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart#configuration_options but, can see, it's not easy read blue values, long red line accumulate of blue values, can go high. there way put second legend on right of picture? in order red line stay @ reasonable high, , make thing readable easely? read doc legend, didn't found: how tu put second legend ? how make red line folow second legend? in case. have snippet ? thinqs. you can use multiple vaxes , specify series plotted on axis. like: function drawvisualization() { // data, use own var data = google.visualization.arraytodatatable([ ['date', 'value', 'cumulate'], ['2014/01/01', 5, 5], ['2014/01/02', 20, 25], ['2014/01/03', 7, 32], ['2014/01/04', 15, 47], ['2014/01/05', 3, 50],

multithreading - Why does this multithreaded python program print from 0 to 99 CORRECTLY? -

this code. from queue import queue threading import * threadlock = lock() def do_stuff(q): while true: threadlock.acquire() print q.get() q.task_done() threadlock.release() q = queue(maxsize=0) num_threads = 10 x in range(100): q.put(x) in range(num_threads): worker = thread(target=do_stuff, args=(q,)) worker.setdaemon(false) worker.start() q.join() when execute code, numbers 0 99 printed sorted. when remove locks in do_stuff, expect numbers 0 99 printed unsorted, erroneour numbers here , there, prints range sorted again 0 99. why that? shouldn't unsorted, since i'm not synchronizing threads in way? your function doesn't else between retrieving next number queue , printing it. python holds lock (the gil) while executing each bytecode, between bytecodes can threads switch. looking @ function (without locks) shows there one spot thread switch give thread chance grab next number , print before preceding thread can print th

jsp - Which is best to use Validation server side or client side -

as in few days planning starting our web-based appplication, can state me best of them giving same in various form's , login page. what validation? validation process of testing , ensuring user has entered required , formatted information through web form. what client-side validation? in client-side validation method, input validations , error recovery process carried out on client side i.e on user’s browser. can done using javascript, ajax, html5 etc. what server-side validation? in server-side validation, input validations , error recovery process carried out on server side. can done using programming languages c#.net, vb.net etc. differences , comparison: client-side validation faster server-side because, validation takes place on client side (on browser) , networking time client server saved. on other hand, server-side validation done on web server. server renders data html page , sends client (browser). server-side validation more secure client-s

oop - PHP 5.3 constructor method -

i java/c# programmer trying learn/finish project in php. can explain me why "composition" doesn't work in php 5.3 1 expect object oriented language? i have tried research issue, due term-confusion (making google useless...) , bad documentation, haven't been able find useful yet. <?php /*php version 5.3.3*/ class myclassone { public function myfunctionone() { echo "<p> function 1 </p>"; } } class myclasstwo { private $myclassone; function __constructor() // wrong wrong wrong - __construct() - , works. { $this->myclassone = new myclassone(); } public function myfunctiontwo() { echo "<p> function 2 </p>"; $this->myclassone->myfunctionone(); // crashes "application" } } $myclassone = new myclassone(); $myclassone->myfunctionone(); $myclasstwo = new myclasstwo(); $myclasstwo->myfunctiontwo(); /* expectet result: fu

libgdx - Box2d Arrow Transformation - Java -

i'm making archer game libgdx supported box2d. many of box2d tutorials in c++ methods different java. i want stick arrow when collide box.i found tutorial in c++ , couldn't find way solve issue. it's math question. here c++ code //start standard positions normal arrow creation b2vec2 vertices[4]; vertices[0].set( -1.4f, 0 ); vertices[1].set( 0, -0.1f ); vertices[2].set( 0.6f, 0 ); vertices[3].set( 0, 0.1f ); //now multiply difference between arrow , target transforms b2transform difftransform = b2mult( si.targetbody->gettransform(), si.arrowbody->gettransform() ); (int = 0; < 4; i++) vertices[i] = b2mul(difftransform, vertices[i]); b2polygonshape polygonshape; polygonshape.set(vertices, 4); //create new fixture in target body b2fixturedef fixturedef; fixturedef.shape = &polygonshape; fixturedef.density = 1; si.targetbody->createfixture( &fixturedef ); //discard original arrow body m_wo

SEVERE UpdateLog Error inspecting tlog tlog in Solr -

i using solr cloud 2 nodes in production. solr stopped accepting writes , error in master node. severe updatelog error inspecting tlog tlog{file=/var/lib/solr/core_0/data/tlog/tlog.0000000000001264986 refcount=2} warning solrcore [core_1] performance warning: overlapping ondecksearchers=2 severe solrcmddistributor forwarding update http://solr02:8983/solr/core_1/ failed - retrying ... severe solrcore java.lang.stringindexoutofboundsexception: string index out of range: -1 check tlogs, when don't commit long time tlogs become huge, need commit free them, maybe add documents softcommit true, or maybe autocommit & autosoftcommit config values aren't in case. these links can understand more : http://lucidworks.com/blog/understanding-transaction-logs-softcommit-and-commit-in-sorlcloud/ solr autocommit vs autosoftcommit

logcat - Is there a way to get android "history" system log? -

i developing system log app users check device's log. know using logcat app can read system log in real-time, there way read "history" system log, 1 week? (our app may down during week) updated: i builder of custom android os, based on aosp. system log app running in os only. have ability develop drivers, framework layer , system apps besides normal apps. if normal app cannot accomplish task, how developing driver additionally? know there driver module named "logger" in kernel, in charge of logging. maybe can add code "logger" , let dump logs files: log_20140629.txt, log_20140630.txt , on. every file contains log in whole day. app read these files. idea possible? we know using logcat app can read system log in real-time only on devices running android 4.1 , lower, or possibly on rooted devices. android apps on android 4.2+ cannot hold read_logs permission. but there way read "history" system log, 1 week? i ha

javascript - BarcodeScanner2 = TypeError: Cannot set property 'innerHTML' of null -

i trying develop barcode scanning app using phonegap-1.4.1 in android. trying store values in array code[] , later on displaying values using array. creating local storage of values. here declaration of array , counter. localstorage["counter"]=0; var code = ["test1", "test2","test3", "test4"]; localstorage.setitem("code", json.stringify(code)); here javascript file scanning barcode , using recursive function in app scanning continues , values stored in array. var scancode = function () { window.plugins.barcodescanner.scan( function (result) { if(result.cancelled == true ) { window.location.href = 'page5.html'; } else { var test2 = json.parse(localstorage.getitem("code")); var k = parseint(localstorage.getitem("counter")); document.getelementbyid(test2[k]).innerhtml = "result.text"; k++; localst