Posts

java - Libgdx: Scoring points basic -

i trying code score system increments whenever collision occurs between enemy , player. initialize score 100 , incremented once collision detected, means the old score 100 , new 1 101. happen old score 0 while new score 100. can me debut code. thank you. here code: code in bpaste when call getscore() first time, hasn't been initialized yet, returns 0. what scoreincrement() method add 100 tempscore, added score (which 100). if understood intentions correctly, use this: //initialize score 100 private int score = 100; //method incrementing score 1 public void scoreincrement() { score++; } //score getter public int getscore() { return score; }

Using for next loop step 50 php? -

i want steps using next loop. on vb or vb.net for i=0 1000 step 50 .... next how can use code in php? you can use this: for ($i = 0; $i <= 1000; $i += 50) { // code... } it wise read php for more details.

sql server - SQL max(DateTime) and category filter without group by -

i've written below query : select datetime, configid, rowid linkedtabledefinition a, inner join tabledefinition b, on a.target = b.id inner join viewwithinfo c, on a.target = c.id this gives following output: datetime configid rowid 12-09-2013 11:00 4 12 12-09-2013 12:00 4 12 12-09-2013 13:00 3 11 12-09-2013 12:00 3 11 12-09-2013 11:00 4 11 what need of output following: per rowid , configid combination need highest value datetime column. above example want following output: datetime configid rowid 12-09-2013 12:00 4 12 12-09-2013 13:00 3 11 12-09-2013 11:00 4 11 does know answer? avoid group because select statement extended lot more columns. thanks in advance edit current query: select testresults.resultdate, testresults.configurationid, testresultstestcaseid dbo.factworkitemlinkhistory workitemlink inner join dbo.dimwork...

javascript - CanJS right click event -

how can bind right click event in canjs? i've attempted following, guess click captures left clicks (as ev.which doesn't log 3 on right clicks). '.btn click': function (el, ev) { console.log(ev.which); switch(ev.which) { case 1: var val = 1; break; case 3: ev.preventdefault(); var val = -1; break; } var item = can.data(el.closest('tr'), 'item'); item.attr('rel', item.rel + val); } i don't know canjs is, use oncontextmenu : elem.oncontextmenu = function(e) { e = e || window.event; if(e.preventdefault) e.preventdefault(); e.returnvalue = false; // code };

loading opencv::mat images with alpha channel in opengl texture -

i want load opencv::mat images alpha channel opengl texture. with of following posts manage load rgb images opengl texture opencv::mat. https://stackoverflow.com/questions/16809833/opencv-image-loading-for-opengl-texture https://stackoverflow.com/questions/9097756/converting-data-from-glreadpixels-to-opencvmat/9098883#9098883 but when try load image alpha channel, there problem. here how glteximage2d function called. glteximage2d(gl_texture_2d, // type of texture 0, // pyramid level (for mip-mapping) - gl_rgba, // internal colour format convert image.cols, // image width image.rows, // image height 0, // border width in pixels (can either 1 or 0) gl_bgra_integer, // input image format gl_unsigned_byte, // image data type ...

multithreading - Multithreaded Pipeline for Java(7) -

i'm building summarizer , need pipeline implementation. i've used own implementation, work grows see won't cut. is there mature framework in java provides me foundation (basically synchronization logic)? i need declare stage, , each stage has workers, workers process items , return results stage, sends next stages (might fan out). the whole point of implementation give me foundation doesn't work (race condition brings deadlock) i've tried getting apache library (which dead basically) doesn't have feature create stage workers. just connect stages blocking queues, , work reliably. use bounded arrayblockingqueue avoid saturation of queues if producers work faster consumers. most pipeline/dataflow/actor frameworks deal tasks small assigning single thread stage overhead stages share thread pool, , have limited number of working threads. framework (probably) exploits several threads per stage fbp , not sure.

c++ - boost spirit qi match multiple elements -

i create parser based on boost spirit qi able parse list of integer values. extremely easy , there tons of examples. list though bit smarter comma separated list , looks like: 17, 5, fibonacci(2, 4), 71, 99, range(5, 7) the result of parser should std::vector following values: 17, 5, 1, 2, 3, 71, 99, 5, 6, 7 where fibonacci(2, 4) results in 1, 2, 3 , range(5, 7) results in 5, 6, 7 edit: looking if have parsers have attribute int (say int_) , parsers have attribute std::vector fibonacci , range, how can combine results in single parser. like: list %= *(int_ | elements [ fibonacci | range ] ); where elements magic necessary magic results form fibonacci fit in list. note: not looking solution includes append functions like list = *(int_[push_back(_val, _1)] | fibonacci[push_back(_val, _1)] | range[push_back(_val, _1)] ] ); here's simplist take: live on coliru typedef std::vector<int64_t> data_t; value_list = -value_expression % ','...