Posts

sqlite - Binding List to a NSArrayController to use in an NSTableView -

i trying create simple window display list of items comes sqlite3 database. have generic list of objects, , want bind controls on windows. best way this? if .net windows forms, this, cocco equivalent? mybindingsource.datasource = new list<myobject>(); my viewcontroller.cs code looks this: list<myobject> datasource = datastore.getlibraries(); public override awakefromnib() { base.awakefromnib(); datasource = getmyobjects(); myarraycontroller.bind("contentarray", this, "datasource", null); // throws error } but throws error: class not key value coding-compliant key datasource. thanks! after linking libsqlite3.dylib framework (general:linked frameworks , libraries) , adding database-file project create sqlite accessor class, database connections , enable queries. if project should save database, on installation database must placed @ position have write-access, in "documents"-folder iphone app or in ...

javascript - d3.event.translate contains NaN on zoom for touch devices -

i wrote custom zoom function svg using d3 so: //zoom behavior function myzoom() { xpos = d3.event.translate[0]; ypos = d3.event.translate[1]; vis.attr("transform", "translate(" + d3.event.translate + ") scale(" + d3.event.scale + ")"); } this works fine on non-touch devices, when zoom in on touch devices d3.event.translate array starts containing nan's. when occurs subsequent calls myzoom have issue , zooming stops working. this error receive is: error: invalid value <g> attribute transform="translate(nan,nan) scale(0.8467453123625244)" d3.v2.js?body=1:387 attrconstant d3.v2.js?body=1:387(anonymous function) d3.v2.js?body=1:3860 d3_selection_each d3.v2.js?body=1:509 d3_selectionprototype.each d3.v2.js?body=1:3859 d3_selectionprototype.attr d3.v2.js?body=1:3638 myzoom ...

java - getChildNodes() on org.w3c.dom.Node returns NodeLits of only nulls -

i'm trying parse configuration file, when call getchildnodes() on node excludes, returned nodelist contains 7 null values , nothing else. my code : public class minnull { private static final list<string> excludes = new arraylist<>(); public static void main(string[] args) throws parserconfigurationexception, saxexception, ioexception { file cfgfile = new file("ver.cfg"); documentbuilderfactory dbf = documentbuilderfactory.newinstance(); documentbuilder db = dbf.newdocumentbuilder(); document doc = db.parse(cfgfile); element rootelement = doc.getdocumentelement(); nodelist cfg = rootelement.getchildnodes(); parseconfig(cfg); } private static void parseconfig(nodelist cfg) { (int = 0; < cfg.getlength(); i++) { node node = cfg.item(i); string name = node.getnodename(); switch (name) { case "excludes": nodelist exc = node.getchildnodes(); f...

asp.net - what is the function of HttpContext.Current.Request? -

1)when need use httpcontext (exclusively), please elaborate example if possible. 2)what following code do internal string querystring( string name ) { if ( httpcontext.current.request.querystring[name] == null ) return string.empty; else { return httpcontext.current.request.querystring[name].tostring(); } 3)is there other alternative way avoid using httpcontext q1: httpcontext object encapsulates http-specific information individual http request. so, if need information receiving http request (for example in order query string parameter values, referral urls, user's ip address etc), need use httpcontext object. further more, object contains information of current request, response, server, session, cache, user , etc. more information usage , examples get current session id: httpcontext.session.sessionid get timestamp of current request: httpcontext.timestamp.tostring() q2: in code sample, trying v...

java - Use the main method of a .jar file inside a Matlab script -

i trying execute method "main" java class integrated jar file. tried follows: javaclasspath 'file.jar'; javamethod('main', 'javaclass') however, following error: error using javamethod no class democlient can located on java class path does know how can integrate jar matlab routine carrying out advanced matlab operation.

java - Read and Write Image file inside web-app in grails -

i reading image web-app/images , creating duplicate of same in same location different name. grails application. i getting real path of file using follwing code, def serveletcontext = servletcontextholder.servletcontext def filepath = serveletcontext.getrealpath( "web-app/images" ) def actfile= new file(filepath+ "myimg.png") final bufferedimage image = imageio.read(actfile) this working fine in devlopment environment. both read , write happening fine. when deploying war of application in tomcat i'm getting exception java.lang.reflect.undeclaredthrowableexception @ bootstrap$_closure1.docall(bootstrap.groovy:39) @ grails.util.environment.evaluateenvironmentspecificblock(environment.java:308) @ grails.util.environment.executeforenvironment(environment.java:301) @ grails.util.environment.executeforcurrentenvironment(environment.java:277) @ java.util.concurrent.executors$runnableadapter.call(executors.java:...

r - draw two heatmap with the same cell size -

Image
i drawing 2 heatmaps using heatmap.2 separately different number of rows. there way set output of plots actual cell size same between 2 heatmaps? library(gplots) data(mtcars) x<-as.matrix(mtcars) ### heatmap has 32 rows heatmap.2(x,key=f) x1<-x[1:10,] ### heatmap has 10 rows heatmap.2(x1,key=f) this can done, albeit in of kludgy way, using lmat , lhei , , lwid arguments of heatmap.2 . arguments passed layout , lay out various parts of image. library(gplots) data(mtcars) x <- as.matrix(mtcars) ### heatmap has 32 rows heatmap.2(x = x, key = f, lmat = matrix(c(4,2,3,1), nrow=2, ncol=2), lhei = c(0.1,0.9), lwid = c(0.3,0.7)) as can see, matrix argument gives matrix looks like: [,1] [,2] [1,] 4 3 [2,] 2 1 the heatmap first thing plotted, followed row , column dendrogram. arguments lhei , lwid give relative size of each of layout column , rows desc...