Posts

SQL - Get AVG from count from another table -

so have 2 tables: listing , reviews. try listing best reviews, based in state. need avg reviews listing , desc listings. table structure: listing: id; title; state; ... reviews: id; listing_id; rating (from 1-5) i solve desc listing of reviews try avg of rating of reviews. select *, (select count(*) reviews rv ls.id = rv.listing_id) count listing ls ls.state ='$get_state' order count desc sample data: listing: id title state 1 hotel nice view arizona 2 hotel stay arizona review: id listing_id rating 1 1 4(stars) 2 1 4(stars) 3 1 3(stars) 4 2 5(stars) listing id 1 got 3 reviews , total star value of 11 / 3 reviews = 3.6 stars listing id 2 got 1 review , total star value of 5 / 1 = 5 stars now should first listing 2 , listing 1 want display whole thing on php page. what can next? help you can use avg() function average rating select ls.id, ...

java - Detecting planes and tap events with ARCore -

i'm trying understand google's arcore api , pushed sample project ( java_arcore_hello_ar ) github . in example, when deploy app android, horizontal surfaces/planes detected. if tap on detected plane, "andy" andrid robot rendered in location tap. pretty cool. i'm trying find in code: thats horizontal surface/plane gets detected; and where logic lives resize & re-orient andy correctly (i assume if point tap further away camera, rendered small, etc.) i believe when planes detected, android framework calls onsurfacecreated method: @override public void onsurfacecreated(gl10 gl, eglconfig config) { gles20.glclearcolor(0.1f, 0.1f, 0.1f, 1.0f); // create texture , pass arcore session filled during update(). mbackgroundrenderer.createonglthread(/*context=*/this); msession.setcameratexturename(mbackgroundrenderer.gettextureid()); // prepare other rendering objects. try { mvirtualobject.createonglthread(/*context=*/t...

php - Using array_filter() with a callback that returns an array -

i have data this: a|b|c|d|e|f|g h|i|j|k|l|m|n o|p|q|r|s|t|u i can use explode("\n", $data) array of lines (this ~4.0gb file), want make multi-dimensional array using explode() based on vertical pipe. here tried: $data = explode("\n", './path-to-file.txt'); $results = array_filter($data, function ($el) { return explode('|', $el); }); however, results in single-dimensional array original line in string form. how can use array_filter() callback happens return array? edit: could use foreach($data $datum) , explode() way, when tried that, utilized 4 times amount of ram size of file, , not desirable. seems perfect opportunity use callback function, seemingly cannot array_filter() . array_filter() filters elements include or exclude them , expects true include element or false exclude. use array_map() : $data = explode("\n", './path-to-file.txt'); $results = array_map(function ($el) { return explo...

amazon web services - Scheduling SQS messages -

my use case follows: need able schedule sqs messages in such way scheduled messages can added queue on specific date/time, , on recurring basis needed. at implementation level, i'm looking have function can call pass in sqs queue, message, , schedule want run on, without having build actual scheduler logic. i haven't seen in aws seems allow that, didn't impression lambda functions need unless i'm missing something. is there other third party cloud service scheduled processes should into, or better off in end running scheduling machine @ aws , have rest api can add cron jobs/windows scheduled tasks handle scheduling of sqs messages? i see 2 different ways of accomplishing this, both based on cloudwatch scheduled events . first have cloudwatch fire off lambda. lambda either have needed parameters or them somewhere else - example, dynamodb table. otherwise, rule target allows specify sqs queue - skipping lambda. i'm not sure if have configuration...

linux - Using CMake to find symbols in libraries -

i trying use cmake find if external library depends on library. example: hdf5 library can optionally linked zlib in linux, can found with readelf -ws /usr/local/lib/libhdf5.so | grep inflateend 54: 0000000000000000 0 func global default und inflateend with cmake seems can found checklibraryexists https://cmake.org/cmake/help/v3.0/module/checklibraryexists.html in cmake script set(cmake_required_libraries ${hdf5_library}) check_library_exists(${hdf5_library} inflateend "" need_zlib) message(${need_zlib}) if (need_zlib) message("-- zlib library needed...") else() message("-- zlib library not needed...") endif() output not found -- looking inflateend in /usr/local/lib/libhdf5.so - not found -- zlib library not needed... because of did cmake version of using readelf, finds symbol but, still know why above cmake script fails :-) the working version is set(have_read_symbols "no") find_program(read_symbols_prg reade...

java - Send File WhatsApp via SQlite -

i've developed routine inserts directly android sqlite database rooted, upload in whatsapp. messages come out after 40 seconds. need send video, audio , image files should not same procedure. tried doing manually , looked @ tables, after playing via app, not send. has tried yet?

kendo ui - KendoGrid Filter not full width -

Image
i using kendogrid , using bootstrap, in _layout have <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.223/styles/kendo.common-bootstrap.min.css" /> <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2017.1.223/styles/kendo.blueopal.min.css" /> its placement after bootstraps css. the code generates grid function showdepartmentgrid(a) { $('#department-grid').kendogrid({ norecords: { template: "no records." }, datasource: { data: }, schema: { model: { fields: { departmentid: { type: "number" }, departmentname: { type: "string" }, division: { type: "string" }, county: { type: "string" } } } }, filterable: { mode: "...