Posts

How can I call uiautomator api directly in Android project? -

i directly call uiautomator api in android application achieve automated testing. to able uidevice reference (which guess want) need // initialize uidevice instance mdevice = uidevice.getinstance(getinstrumentation()); and instrumentation have running tests adb won't able activity.

javascript - How to render d3 graph ticks above shaded region or graph itself? -

i want ticks come above shaded region in graph, have tried transparency not work. due constraint cannot change way coloring green region, this-> shade area below above line green, area below bottom line white(same chart background color) now due this, ticks hiding behind, there way can place them above? or redraw new ticks in shaded region? click here image of graph rendergraph: function(){ // data notice structure //************************************************************ var data = [ [{'x':1,'y':7},{'x':2,'y':7},{'x':3,'y':7},{'x':4,'y':7},{'x':4.5,'y':8.1},{'x':6.3,'y':8.1},{'x':6.8,'y':7},{'x':8,'y':7},{'x':9,'y':8},{'x':10,'y':8}], [{'x':1,'y':9},{'x':2,'y':8},{'x':3,'y':11},{'x':4,'y':10},{'x':5,'y':10},...

Logging issue in apache spark streaming -

getting below exception while creating kafkautils.createstream(); below spark dependency.same thing working in spark streaming older version 1.5.2 <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-streaming_2.11</artifactid> <version>2.0.0</version> </dependency> <dependency> <groupid>org.apache.spark</groupid> <artifactid>spark-streaming-kafka_2.11</artifactid> <version>1.6.2</version> </dependency> exception in thread "main" java.lang.noclassdeffounderror: org/apache/spark/logging @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:763) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:467) @ java.net.urlclassloader.access$100(urlclassloader.java:73) @ java.net.urlclassloader$1.run(urlcla...

libgit2 - Decoding git log complex pretty format -

i'm trying porting git -depending stuff libgit2 open source project. 1 of git calls weird: git log --topo-order --no-color --parents --boundary -z --pretty=format:%m%hx%px%n%cn<%ce>%n%an<%ae>%n%at%n%s%n%b head --all first of all, i'm interesting in format string. means x after h ? unable find x specifier on official git site :/ , second question - can libgit2 complex formatting, or should process myself? p.s. however, i'm pretty sure cannot :) the x not format specifier. the argument --pretty=format: or --pretty=tformat: (most users need tformat , code using -z adds nul character after each commit) contains both directives %m , %h , , literal text transcribed: $ git log -n 3 --pretty=tformat:hello%x25world hello%world hello%world hello%world here, hello , world strings copied through, while %x25 interpreted. since means "print character hex code 25" percent sign % , , -n 3 told git log stop after logging 3 co...

Display default image and replace that image with the uploaded image in android -

i want upload image particular id in server app , display getting toast message "uploaded".if there no image exists particular id want display default image , later want replace uploaded image.how can this? @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_student_details); { string image_url = "http://xxx.xxx.xx.x/mobile_app/" + img_path + "/" + img_name; new downloadimagetask((imageview) findviewbyid(r.id.profilepiciv)) .execute(image_url); } public void onresume() { // after pause or @ startup super.onresume(); getintent(); string auid_num = auid_s.gettext().tostring(); string imei_num = imei_s.gettext().tostring(); string img_name = getintent().getstringextra("img_name"); ...

oop - What is the significance of the `Object.length` property on JavaScript's `Object` constructor? -

this question has answer here: why `object.length === 1` in javascript part of browsers? 1 answer the documentation javascript language's built-in global object object states that object.length has value of 1. what significance of property and, additionally, why isn't object.length available in same manner array.length ? at first glance, seem me reason latter question has possible confusion in interpreter of length property on object dot notation method of property access/initialization. the length property specifies number of arguments expected function . as object belongs type function , length property of function determines number of arguments, object.length returns length of arguments being expected. consider following example: function test(a, b, c) {} console.log(test.length); and objec...

python - scikit learn logistic regression precision calculation weird warning -

using scikit-learn python 2.7 on windows. here code , code has no warning if change precision precision_weighted scoring parameter. not know warning mean , reason behind scene explicitly specify average 1 of (none, 'micro', 'macro', 'weighted', 'samples')? in case, want treat samples of equal weight, seems there no such option in 5 choices? from sklearn import linear_model, datasets sklearn.cross_validation import cross_val_score # import data play iris = datasets.load_iris() x = iris.data[:, :2] # take first 2 features. y = iris.target h = .02 # step size in mesh logreg = linear_model.logisticregression(c=1e5) # create instance of neighbours classifier , fit data. logreg.fit(x, y) print cross_val_score(logreg, x, y, cv=10, scoring="precision") #print cross_val_score(logreg, x, y, cv=10, scoring="precision_weighted") warning message, c:\python27\lib\site-packages\sklearn\metrics\classification.py:1203: deprecationw...