Posts

javascript - Check a Boolean value from database at the start of an app then load terms and condition page if false, load menu page if true -

is possible? before page loads, run javascript code check value in database is, open relevant page? here code far: function ondeviceready() //phone gap ready { try { db = opendatabase('cuopioid', '1.0', 'cupioids application database', 2 * 1024 * 1024); } catch (e) { // error handling code goes here. if (e == invalid_state_err) { // version number mismatch. alert("invalid database version."); } else { alert("unknown error " + e + "."); } } console.log("database created!"); db.transaction(createtableterms, errcb, console.log("medicines table created!")); $('#btnaccept').on('click', acceptterms); } the code below creates database (if isn't there already) function createtableterms(tx) { tx.executesql('create table if not ...

android - how to display current progress on progress bar when activity comes to foreground -

i using progress bar displaying status of data download server using asynktask. i have written callback method update progress @override public void onbookdownloadprogressupdated(int value) { if(_bookprogressbar == null) { linearlayout linearlayout = (linearlayout) latestlinearlayout.findviewwithtag(layouttagqueue.peek()); _bookprogressbar = (progressbar) linearlayout.getchildat(1); } _bookprogressbar.setprogress(value); } this works fine.but when user goes screen , coming screen progress bar didn't show progress while downloading going on in background. how show current progress user press key , revisit screen. try using below link progress bar , put method set value of progress bar in onresume() instead of oncreate() or onstart(). use static variable(int) showing progress of progressbar. download file android, , showing progress in progressdialog

c# - Access Elements in DataTemplate -

i have following item template (i tried strip non relevant stuff): <s:surfacewindow.resources> <resourcedictionary> <style targettype="{x:type s:surfacelistbox}"> <setter property="itemtemplate"> <datatemplate datatype="{x:type local:myclass}"> //my own class <s:surfacebutton> <textblock text="{binding name}"> //name string in own class //and close tags the idea listbox contain buttons displaying words on it. further down, have surfacelistbox using above resource. add in item by: mylistbox.items.add(new myclass("my name")); and add button listbox nicely, button displaying "my name". now need change "my name" string. how access textblock ? i have tried googling solutions access items in datatemplate require visualtreehelper.getchildrencount via findvisualchild , re...

javascript - add content to model on createRecord() -

i got ember model looks this: app.collection = ds.model.extend({ types: ds.hasmany('app.type') }); it's obligated have 4 types in collection. i want make sure everytime createrecord() get's called, model creates 4 new types well. how can this? thanx!

cryptography - How to encode and decode SecretKey in JAVA? -

keystore ks = keystore.getinstance("jceks"); ks.load(null, null); secretkey skinput = new secretkeyspec("input".getbytes(), "desede"); secretkeyentry skeinput = new keystore.secretkeyentry(skinput); ks.setentry("input_key", skeinput, new keystore.passwordprotection("banana".tochararray())); fileoutputstream fos = new fileoutputstream("my.keystore"); pambks.store(fos, "password".tochararray()); fos.flush(); fos.close(); the code shown above trying encode input secretkey , store keystore. code shown below how retrieve key keystore. not know how decode original value? fileinputstream fin = new fileinputstream("my.keystore"); keystore ks = keystore.getinstance("jceks"); ks.load(fin, "password".tochararray()); secretkeyentry ske = (secretkeyentry) readks.getentry("input_key", new keystore.passwordprotection("banana".tochararray())); secretkey sk = ske.getsecretkey...

sql - How to increment column regard on another column value -

i have following data: (1,'20120615 8:03:43 pm'), (1,'20120615 8:03:43 pm'), (1,'20120615 8:03:48 pm'), (1,'20120615 8:03:53 pm'), (0,'20120615 8:03:58 pm'), (1,'20120615 8:04:03 pm'), (1,'20120615 8:04:08 pm'), (1,'20120615 8:04:13 pm'), (1,'20120615 8:04:18 pm'), (0,'20120615 8:04:23 pm'), (1,'20120615 8:04:28 pm'), (1,'20120615 8:04:33 pm'); my desired result is: (1,'20120615 8:03:43 pm', 1), (1,'20120615 8:03:43 pm', 1), (1,'20120615 8:03:48 pm', 1), (1,'20120615 8:03:53 pm', 1), (0,'20120615 8:03:58 pm', 0), (1,'20120615 8:04:03 pm', 2), (1,'20120615 8:04:08 pm', 2), (1,'20120615 8:04:13 pm', 2), (1,'20120615 8:04:18 pm', 2), (0,'20120615 8:04:23 pm', 0), (1,'20120615 8:04:28 pm', 3), (1,'20120615 8:04:33 pm', 3); in words want group data except 0 above order. here idea. ...

java - "One App" Android System -

i created android app communicates via usart µc in order evaluate data. co-workers , customers should use tablet purpose now. there possibility "hide" android os or making inaccessible? devices rooted , willing build custom roms (even though not have experience yet). there approaches available not have start scratch? many help. well. i'm trying ! the first thing tried start app after boot of device (quite easy with this ). then, android source code, , hide bottom bar using this code the problem is, if application not stable ... you'll have problem. if want modify android source code, the developper doc contains tutorial start !