Posts

scala - heterogenous mapping, dependent types at compile time -

trying use this trick, miles sabin, create function accepts parameter of set of predefined types . val bool = boolean val timestamp = new timestamp(date.gettime()) val str = "my string" and following should pass @ compile time takevalue(bool) takevalue(timestamp) takevalue(str) but where takevalue should fail takevalue(someintvalue) if implicit type int isn't defined.and failure @ compile time. trait myconv[k] { type v; def convert: anyref => v } def imakeconv[v0](con: anyref => v0) = new myconv[con.type] { override type v = v0 val convert = con } def takevalue(value:anyref)(implicit conv :myconv[value.type]) : \/[throwable,conv.v] = \/.fromtrycatch(conv.convert(value)) and implicit val strany = imakeconv((x:any) => x.tostring) then want takevalue(str) work @ compile time takevalue(someintvalue) fail @ compile time since there isn't appropriate implicit defined it. want limit(at compile time) type of types takevalue c...

if statement - MATLAB resets the values of variables -

i'm new matlab , created program i'm trying similar situation this pushbutton1 = 1 b = 1 c = 1 if (level==1) newsize=<some calculations here> = newsize elseif (level==2) newsize=<some calculations here> b = newsize else newsize=<some calculations here> c = newsize end plot(a,b,c) but when 'level' changes, has update 'newsize' on a/b/c . each time click button, previous variables being reset. understand logically correct program reset values, cant figure way "save" values. don't if i'm tired see or more complicated this, appreciate if helped me on that! thank you! if want save past values can this: a = [a newsize]; that way when go through add of values ever increasing list instead of replacing them.

vb.net - Fetching Records from multiple tenant in RavenDB -

i using embeddabledocumentstore records stored in raven. below vb.net code access raven data dim documentstore embeddabledocumentstore = new embeddabledocumentstore() documentstore.datadirectory = "d:\test\server1" documentstore.defaultdatabase = "testdb1" documentstore.url = "http://localhost:8585/" documentstore.initialize() dim session document.documentsession = documentstore.opensession() dim lineitems = session.query(of lineitem)() above code retrieves records database testdb1, have testdb2 database now have 2 question how access records server1.testdb1.lineitem , server1.testdb2.lineitem how access records server1.testdb1.lineitem , server2.testdb1.lineitem a few things: you should opening session within using statment . when so, can pass database name parameter opensession method. if regularly working multiple databases, should pass database name every time open session, instead of assigning default database. an e...

java - How to Change the installation path of an android application? -

i developing android application. default getting stored in /data/data/<package-name> path as device in warranty period, don't have privilege access this(root) path. application want change installation path e.g. /storage/emulated/0/<package-name> i found in manifest.xml file using android:installlocation can change installation path. giving 3 choices: ->auto ->internal ->external but how change path in internal storage ? if not declare android:installlocation attribute, application, default, installed on internal storage but, can move external storage. you can use android:installlocation="preferexternal" install in external storage or android:installlocation="internalonly" internal storage. hope helps.

android - Refreshing the list and the data to the list is coming from asynctask -

i having list should refreshed when user clicks on button.the data on list comming json , m parsing , dispaying in list.now prob when user clicks on button asynctask class whch json parsing shud b called , list should b refreshed customlist public class bestcandidatecustomlist extends baseadapter { context c; arraylist<hashmap<string, string>> data; private progressdialog pdialog; public string cost, comments; edittext etcost, etcomments; string success; button btapply; public bestcandidatecustomlist(context c, arraylist<hashmap<string, string>> data) { super (); this.c = c; this.data = data; } @override public int getcount() { return data.size (); } @override public object getitem(int i) { return null; } @override public long getitemid(int i) { return 0; } @override public view getview(final int i, view view, viewgroup ...

android - How to draw gradient or stylish line canvas -

this activity using draw dotted line . want draw gradient or style in line .. dragobserverlayout.java //class draw line 1 place public class dragobserverlayout extends relativelayout { float startx, starty, stopx, stopy; private paint mpaint = new paint(paint.anti_alias_flag); private list<rect> lines = new arraylist<rect>(); public list<path> linepath = new arraylist<path>(); //class dragging public dragobserverlayout(context context, attributeset attrs) { super(context, attrs); //setting color stroke , effect mpaint.setcolor(color.red); mpaint.setstyle(style.stroke); mpaint.setstrokecap(paint.cap.butt); mpaint.setpatheffect(new dashpatheffect(new float[] {5,5}, 0)); mpaint.setstrokewidth(10.0f); } //for canvas @override protected void dispatchdraw(canvas canvas) { super.dispatchdraw(canvas); final int count = lines.size(); (int = 0; < count; i++) { final rect r = lines.get(i); ...

node.js - unable to access google places api after passing next page token in nodejs -

hi i'm trying access belo url using nodejs client https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=12.8441975,80.223766&radius=500&types=restaurant&key=afghghghghghg&pagetoken=dghdghghgdhghgh i'm using normal https client code access . when hit url without passing page token working fine.but wheni pass i'm getting error below invalid request dont know going wrong.any appreciated. how time passes between 2 requests? i've found as 2 second delay before pagetoken request can necessary. there short delay between when next_page_token issued, , when become valid. requesting next page before available return invalid_request response. retrying request same next_page_token return next page of results. https://developers.google.com/places/documentation/search#placesearchpaging