Posts

javascript - Mixing Index Array with "Associative Array" -

since need access items sometime index , sometime code. idea mix integer index string index? note code, index, amount of items never changes after data loaded. i'm thinking of doing this, same object pushed , set hashtable. function datainformation(code, datavalue) { this.code = code; this.datavalue = datavalue; } var datalist = []; function filldatalist() { addnewdata(new datainformation("c1", 111)); addnewdata(new datainformation("c2", 222)); addnewdata(new datainformation("c3", 333)); } function addnewdata(newdata) { datalist.push(newdata); datalist[newdata.code] = newdata; } then able access object either: datalist[0].datavalue datalist["c1"].datavalue before used loop find item. function finditembycode(code) { (var = 0; < datalist.length; i++) { if (datalist[i].code == code) { return datalist[i]; } } return null; } finditembycode("c1")...

java - Can outclass specify inner class with InnerClassNameOuter directly rather than ClassName.InnerClassName -

in inner classes of thinking in java, if want make object of inner class anywhere except within non-static method of outer class, must specify type of object outerclassname.innerclassname, seen in main(). but find use innerclassname directly still works in main. public class parcel2 { class contents { private int = 42; public int value() { return i; } } class destination { private string label; destination(string whereto){ label = whereto; } string readlabel(){ return label; } } public destination to(string s){ return new destination(s); } public static void main(string[] args){ parcel2 q = new parcel2(); /* destionation d = q.to("borneo"); still works.*/ parcel2.destination d = q.to("borneo"); } }

c++11 - How to write the Bayesian network in to files like Hugin format or BNIF? -

any api c++11? writing piece of code generates bayesian network wanted write standard file format hugin, bnif. i tried couldn't documentation well. for shares same query. have found link answers it. further, found implementation well.

Connecting to a GPS Deamon service in c# -

i working on application need location through gpsd service . using c# library (same project), not supported gpsd itself, don't have library. that's why trying create own library (and make nuget package of it). but got stuck following problem. connection gpsd service through sockets, , following data: {"class":"version","release":"3.11","rev":"3.11-3","proto_major":3,"proto_minor":9} so connection working, don't know how gps data itself, there not documentation so, does have experience this, or know how can achieve this? using (var client = connectviahttpproxy(serveraddress, port, proxyaddress, port)) { while (client.connected) { var result = new byte[256]; client.client.receive(result); //_response = encoding.utf8.getstring(result, 0, result.length); _response = encoding.ascii.getstring(result, 0, result.length); var resultclass = j...

python - tkinter populate treeview using threading pool -

i'm looking "best" way populate treeview using threads. have multiple mail account i'm checking new emails. my plan use queue store accounts checked using check_mail method. method return list of new mails. can use queue populate new mails , somehow loop while threads alive? is there thread-safe, pattern solve this? your question broad, answer be. generally speaking, tkinter doesn't play multi-threading. can it, must make sure main thread interacts gui. common way use universal widget method after() schedule handling of data going out or being retrieved background threads, typically via queue s, @ regular intervals.

angular - Uncaught TypeError: this.jsonp.request is not a function in Angular2 -

i getting following error. uncaught typeerror: this.jsonp.request not function in angular2. can please me fix that. my code this: requestservice.ts import {component} '@angular/core'; import {jsonp_providers, jsonp,requestmethod, requestoptions, urlsearchparams,jsonp_bindings, baserequestoptions} '@angular/http'; import {injectable} '@angular/core'; import 'rxjs/add/operator/map'; @injectable() @component({ providers: [jsonp_providers] }) export class requestservice { constructor(public jsonp?:jsonp) { this.jsonp = jsonp; } getvalues = (url) => { let _urlparams = new urlsearchparams(); _urlparams.set('contenttype', 'application/jsonp; charset=utf-8'); _urlparams.set('datatype', 'jsonp'); _urlparams.set('timeout', '5000'); this.jsonp.request(url + "&callback=jsonp_callback", { // getting error here contenttype: "application/jsonp;...

tcp ip - If IP is connectionless protocol then why does virtual packet switching is connection oriented? -

we ip connection less protocol network layer provides switching facility wherein have packet switching under which, have virtual packet switching connection oriented i.e resources reserved on way. why ip connection less every packet travels in ip datagram? well think network layer has many other protocols might use virtual ckt concept. ip uses datagram service, connectionless. because in datagram service packets go independently without reservation of resources.