Posts

c++ - Iterating over a QList backwards -

if execute following code: qlist<int> l; qlist<int>::const_iterator li; l.append(1); l.append(2); l.append(3); l.append(4); li = l.constend(); while(li != l.constbegin()) { std::cout << *li << std::endl; --li; } i output: 17 4 3 2 i solved using qlistiterator<int> , don't why isn't working! thanks in advance ... try li = l.constend() - 1; i'm not sure if solves problem, far know, end iterators point 1 past end of container. i wanted address concern in comments. when this: li = l.constend(); while(li != l.constbegin()) { std::cout << *li << std::endl; --li; } you start off end of container, , loop never reaches constbegin . that's because when decrement, li becomes constbegin , while loop doesn't execute. (that's why 1 never outputted.) but if do: li = l.constbegin(); while(li != l.constend()) { std::cout << *li << std::endl; ++li; } the same thing happe...

java - geoHash -ing for close points on each side of the equator -

i working on project (java using netbeans) @ point needs process map data. have got esri shape files whole uk , need create 1 dimensional index using geohash efficiency big factor in project. since need search distances going use morton ordering . problem geohash-ing close points on each side of equator can results in hash indices no common prefix in turn messes proximity searches in binary search tree. has body have neat way of doing this? have way adding offset points in uk solution not nicely scalable. know mongodb using geohash , still doing proximity searches, should away implemented.

sql - query for selecting count(*) and columns -

i have query fetches rows table , number of rows query gonna return: select tab.*, (select count(*) mytable mtb mtb.name = 'xyz' , mtb.type = 'tp') mytable tab tab.name = 'xyz' , tab.type = 'tp' now if see want number of rows main query returns other columns. need use query subquery in large query. want know if there better way write query. mean repeating query count separately. can please provide more optimized form you should use analytic function count() : select tab.*, count(*) on () totalcnt mytable tab tab.name = 'xyz' , tab.type = 'tp'

c++ - Step error in sqlite3_create_function_v2 -

i'm using sqlite3_create_function_v2 define ngram function. in case step used xfunc pointer, works charm, signature step , xfunc same. sqlite3_create_function_v2(this->connection, "ngram", 3, sqlite_any, null, sqliteextension::stepextendngram, null, null, null); when try use step step compiles when execute command ngram fails in prepare statement. sqlite3_create_function_v2(this->connection, "ngram", 3, sqlite_any, null, null, sqliteextension::stepextendngram, sqliteextension::finalextendngram, null); the sqliteextension code, test ngram not yet implemented void sqliteextension::stepextendngram(sqlite3_context *ctx, int narg, sqlite3_value ** val){ //3 params std::cout << "p1 " << sqlite3_value_text(val[0]) << " p2 " << sqlite3_value_text(val[1]) << std::endl; sqlite3_result_int(ctx, atoi((const char*) sqlite3_value_text(val[0]))); } void sqliteextension::finalextendngram(sqlit...

ios - Floatting points issue -

Image
i have taken 2 uitextfields & 1 label result of float value inserted in textfields. code have done. here issue starts when takes textfields value in float, getting changed. - (ibaction)btncalculateamountselected:(id)sender { nslog(@"[_txtfield1.text floatvalue] is:--> %f ----- [_txtfield2.text floatvalue] is:--> %f",[_txtfield1.text floatvalue],[_txtfield2.text floatvalue]); float result = [_txtfield1.text floatvalue] - [_txtfield2.text floatvalue]; nslog(@"actual result is:--> %f",result); float truncatedfloat = truncf(result * 100) / 100.0; nslog(@"truncatedfloat is:--> %f",truncatedfloat); _lblresult.text = [nsstring stringwithformat:@"%f", truncatedfloat]; nslog(@"_lblresult.text is:--> %@",_lblresult.text); } output is:- [_txtfield1.text floatvalue] is:--> 1234.123413 ----- [_txtfield2.text floatvalue] is:--> 1234.111084 actual result is:--> 0.012329 truncatedfl...

Wordpress Connect with facebook and other social media -

i running my wordpress powered website on free hosted platform , provider blocked php curl extension. want let visitors login facebook , other social platforms. tried wordpress plugins (e.g: nextend facebook connect, social connect etc.) but, plugins requires curl extension work. there alternatives activate facebook, twitter connect in wordpress website login? any or suggestion highly appreciated. i found this, might outdated, can check if works you http://martinsikora.com/facebook-php-api-without-curl-extension

c# - How to get child control? -

Image
i have tabcontrol contain 4 subtabs. each of tab contain picture box cotrol. i need picture box control of selected tab control. any idea how implement it? perhaps var picbox = tabcontrol1.selectedtab.controls.oftype<picturebox>().first();