Posts

c++ - Insufficent Memory -

i new open cv , have been working on project on gesture recognition. implementing pca , while calculating eigen vectors. stumbled upon insufficient memory error. 2d arrays used dynamically allocated. still same error creeps up. here code: void initialization() { long int nrows=15000, ncolumns=20; int i,j; cov = (float**) malloc(nrows * sizeof(float *)); for(i = 0; < nrows; i++) { cov[i] = (float*) malloc(ncolumns * sizeof(float)); } matrix = (int**) malloc(15000 * sizeof(int *)); for(i = 0; < nrows; i++) { matrix[i] = (int*) malloc(20 * sizeof(int)); } matrix1 = (int**) malloc(15000* sizeof(int *)); for(i = 0; < nrows; i++) { matrix1[i] = (int*) malloc(20 * sizeof(int)); } ..... } void cal_eigen() { //mat original matrix cou...

python - How to generate reports using HtmlTestRunner for unittests which invlove xml-rpc communication? -

if unittest invlove single xml-rpc requests/response between xmlrpc client/server, works fine , generates report on 1 end if scenario scales more 1 xmlrpc request, report not getting generated. here goes code snippet template: on 1 machine abc have, class abc(): def add(): ....... def subtract(): ....... class machineabctest(unittest.testcase): def test_abc(self): x1 = abc_client.multiply() #method resides in machinexyztest y1 = abc_client.divide() #method resides in machinexyztest suite = unittest.testloader().loadtestsfromtestcase(machineabctest) runner = htmltestrunner.htmltestrunner(stream=fp, verbosity=2) runner.run(suite) class serverthread(threading.thread): def __init__(self): threading.thread.__init__(self) self.abc_server = simplethreadedxmlrpcserver(("xxx.xxx.xxx.1", 8000)) self.abc_server.register_instance(abc()) #methods add & su...

playframework - Play framework 2, how to use execution context in Java? -

the official documents describe how use in scala. http://www.playframework.com/documentation/2.1.0/threadpools . future { // blocking or expensive code here }(contexts.myexecutioncontext) i can excutioncontext like: executioncontext myexecutioncontext = akka.system().dispatchers().lookup("my-context"); but how add in code blow? return async( future(new callable<string>() { public string call() { return dosth(); }).map(new f.function<string,result>() { public result apply(string i) { return ok(i); } }) i think answer should be: executioncontext myexecutioncontext = akka.system().dispatchers().lookup("my-context"); return async( akka.aspromise(futures.future(new callable<string>() { public string call() { return dosth(); } }, myexecutioncontext)).map(new f.function...

Reading text files into an array in C -

just got question regards, when read lines of text text file how separate words , store them array. for example if have 2 lines of text in text file looks this: 1005; andycool; andy; anderson; 23; la 1006; johncool; john; anderson; 23; la how split them based on ';' . , store them in 2d array. sorry haven't started coding yet paste here cheers ... use strsep function: char* token; char* line; /* assume line loaded file */; if( line != null ) { while ((token = strsep(&line, ";")) != null) { /* token points current extracted string, use fill array */ } }

android - Custom Seekbar with masking effect with two drawables? -

Image
i using custom seekbar show graph. had done till this. showing graph applying background drawable seekbar. problem is, need set blue 1 progress drawable , need set background of seekbar red graph. when progress happens thumb moves on red area thumb passed should changed blue color masking effect. can 1 tell best possible way this. pictures shown below after reading questions , answers hope should scenario thing done... 1.create 2 graphs per logic. 2.generate 2 drwables particular bitmaps.... drawable g_bg = new bitmapdrawable(red graph bitmap); drawable g_pg = new bitmapdrawable(blue graph bitmap); 3.and customize seek bar using layer list created through java code. clipdrawable c=new clipdrawable(g_pg, gravity.left,clipdrawable.horizontal); layerdrawable ld =new layerdrawable (new drawable[]{g_bg,c}); 4.apply layer list seekbar. graphbar.setprogressdrawable(ld); this should work wanted....thanksss

user interface - Resizeable Legend in Matlab GUI or Legend Scroll Bar -

Image
in matlab have gui analyses , plots data on plot in main figure of gui. have plot lot of different data sets though , have 2 main problems: i cannot set fixed size area legend constructed in i cannot work out how make legend text , box scale when gui full screened one solution thinking scroll bar in legend, possible? image below highlights problem: here solution scale legend whatever scaling factor desire: close all; % generate data n = 10; t = 10; x = rand(t, n); % how scale xlegscale = 0.5; ylegscale = 0.5; % plot data labels = arrayfun(@(n){sprintf('legend entry line %i', n)}, 1:n); plot(x, 'linewidth', 2); hleg = legend(labels); % figure out new legend width / height, including little fudge legpos = get(hleg, 'position'); widthfudgefactor = 0.1; legposnew = legpos; legposnew(3:4) = legposnew(3:4) .* [xlegscale ylegscale]; legposnew(3) = legposnew(3) * (1 + widthfudgefactor); % create new axes matches legend axes , copy legend % c...

objective c - [iOS][Background] updating map pins | drawing lines -

hy :) i trying update in background position of device (iphone) , works simulator http://grab.by/melq (the annotations added in background). but when testing iphone not work, have got line between last position (before being in background) , position when becomes active. what coding ? i made test of making list when app in background , when application becomes active again load list of positions recorded. (work simulator) - (void)handleaddlocations { nslog(@"%s | %@", __pretty_function__, self.locationbackgroundlist); if ([self.locationbackgroundlist count] > 0) { (cllocation *backgroundlocation in self.locationbackgroundlist) { if (yes){ locannotation* annotation = [[locannotation alloc] initwithcoordinate:backgroundlocation.coordinate]; nslog(@"%s %@", __pretty_function__, [annotation description]); [self.mapview addannotation:annotation]...