Posts

android - How many levels does Firebase ChildEventListener listen to -

my current android application uses firebase store user data. my data has following " structure " ( and/or levels ) my-android-app.firebaseio.com/level0/level1/uuid1/uuid2 data objects stored @ uuid2 resemble this { "students":[ { "name":"amit goenka", "major":"physics" }, { "name":"smita pallod", "major":"chemistry" }, { "name":"rajeev sen", "major":"mathematics" } ] } i need able detect when child data added, removed or changed etc below (at) uuid2, want set childeventlistener using path android-app.firebaseio.com/level0/level1 is possible? during test far have had specify full path of:- my-android-app.firebaseio.com/level0/level1/uuid1/uuid2 firebase fire child_* event change under level register correct listener. fire...

task - OpenMP scheduler -

i have problem distributing tasks in openmp. have next code: #include <stdio.h> #include <unistd.h> int cnttotal = 0; int cnt1 = 0, cnt2 = 0; int main() { int i; #pragma omp parallel #pragma omp single nowait (i = 0; < 60; i++) { if (cnttotal < 1) { cnttotal++; #pragma omp task { #pragma omp atomic cnt1++; usleep(10); cnttotal--; } } else { #pragma omp task { #pragma omp atomic cnt2++; sleep(1); } } } printf("cnt1 = %d; cnt2 = %d\n", cnt1, cnt2); return 0; } what didn't, cnt1 = 1 , cnt2 = 59 . think problem in openmp scheduler. or there don't catch. my feeling confuse task instantiation actual execution of task. #pragma omp task refers instantiaton of task , extremely fast. thing idle th...

javascript - How to use CSS on autocomplete textbox selected values -

every time client select item autocomplete textbox, automaticly appears in div created right under textbox. style css each selected item appears in div, , not whole div. example, want every selected item appear black border. (i use css on div, i'll border whole div , not on each item selected). that's js code. need add css new selected country. $(function() { /* textbox id */ $("#destinations").autocomplete({ select: function (event, ui) { /* div id */ $("#destinationschosen").html(function(i, origtext) { var selectedcountry = ui.item.value.tostring(); var currenttext = origtext.tostring(); if ((currenttext.indexof(selectedcountry) >= 0)) { alert("already exists"); return currenttext; } return currenttext + " " + selectedcountry; }) } ...

java - How to vibrate phone in Service? -

i'm programming android studio. want program vibrates phone. if don't open app. should in background , think have write in service. throws exception. how fix it? mainactivity: public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); intent i= new intent(mainactivity.this,silent.class); startservice(i); } silent service: public class silent extends service { public silent() { audiomanager myaudiomanager; myaudiomanager = (audiomanager)getsystemservice(context.audio_service); myaudiomanager.setringermode(audiomanager.ringer_mode_vibrate); } it throws exception: java.lang.nullpointerexception on silent.java.12 it happens on line: myaudiomanager = (audiomanager)getsystemservice(context.audio_service); i suggest move constructor code in oncreate() method of service, called when service...

javascript - How do I ensure robust notification of mouseup? -

the goal reliably notified of mouseup events. concrete example, when left-click cloud should turn red , when release button should return blue. this fiddle works: canvas.addeventlistener("mousedown", function(e) { if (e.button === 0) { drawshape("#ff69b4", "red"); } }); canvas.addeventlistener("mouseup", function(e) { if (e.button === 0) { drawshape("#8ed6ff", "blue"); } }); window.addeventlistener("mouseup", function(e) { if (e.button === 0) { drawshape("#8ed6ff", "blue"); } }, true); https://jsfiddle.net/f1x6vc0c/1/ the great evil remains context menu. if click cloud, drag anywhere like, , right-click context menu , release left mouse button while context menu present mouseup forever lost. sure, disable context menu, on pages control - note same aberrant behavior occurs if activate context-menu in other app outside browser window. so, h...

qt - Nested MouseArea hover -

i'm having issues nested mousearea s. when click red rectangle triggers exited event on top rectangle (for me @ least). intended behavior? if so, there workaround? edit clarification want able keep hover top rectangle while clicking child rectangle (the top rectangle should stay blue ). useful if want hide , unhide buttons etc. on hover, common practice in web interfaces (html/css). doing causes weird effects clicking buttons has been revealed entered signal disappear when click them. edit i made javascript demonstration wanted behavior: https://jsfiddle.net/uo4vousu/ if click red rectangle parent stays blue, want. in qml example parent becomes green. updated qml code mach jsfiddle. edit it might linux problem. here's example: rectangle { id: top width: 100 height: 32 anchors.centerin: parent color: "green" mousearea { anchors.fill: parent hoverenabled: true onexited: top.color = "gree...

jquery - Console log set log level -

i having web application uses jquery , backbone in front end. receiving/sending big amount of data , store of values needed internal process. data send , receive should logged console if , if cookie set log level (trace,info,debug etc..) developer need. please let me know libraries or utilities available.