Posts

workflow - Activity Conditional Flow -

i have movie ticket booking app. initial activity login activity there "continue guest" option in case doesn't want sign in or register. then there details activity, can see movie details, has button allow user book movie, if signed in. if not, opens alert dialog register or sign in. what want is, if going login activity details activity, want, after signing in, return details activity. but if user in login activity when opens app, should go movie list activity. use sharedpreferences save credentials. example : sharedpreferences preferences = preferencemanager.getdefaultsharedpreferences(this); sharedpreferences.editor editor = preferences.edit(); editor.putstring("activity","activityfromwhereusermoved"); editor.apply(); note: activityfromwhereusermoved whether directlogin or detailspage and check in loginactivity string value of key activity : sharedpreferences preferences = preferencemanager.getdefaultsharedpreferenc...

javascript - How to configure mocha when external dependencies are involved -

my folder structure is -assets - apps - login -adminlogin.js - data - trackerdb.js -specs - apps -login -adminlogin_spec.js specrunner.js i have specrunner.js file have added test initialization in package.json in root "test": "node assets/spec_runner.js" specrunner includes test needs run. the first line of adminlogin.js define("trackerdb"),function(tracker){ //complete code} when writing test case source file , running it, throws error "cannot find trackerdb.js" so question need pass every js file relative path .. if external module jquery, underscore etc.. do have other way can directly configured mocha can find every path.

do-while loop in android app -

i'm program first app. use do-while loop. want button calculates out of edittexts. after want ask user if or wants calculate again. think do-while-loop great, because haven't 1 in app yet. problem i'm not sure how that? way tried says need delete token while.. maybe it's because it's in if/else instruction. problem don't know how program while condition. possible alert dialog? my question is: what's wring do-while loop? need write in while condition control if user clicked ok in altert dialog? how can add ''no'' button alert dialog? @override public void onclick(view v) { if(v==buttonspritkosten){ do{ //variablen erzeugen textview textviewpersonenzahl; textview textviewstrecke; textview textviewverbrauch; textview textviewpreis; double berechnung; string personenzahl; string strecke; string verbrauch; ...

php - Build a Gettext Wrapper -

these days i'm working on 2 projects based on laravel , have implement localization. found out used method using gettext. have difficulties translating strings gettext() , ngettext(). i'd build wrapper able translate strings so: fantasticfunction('hi name :name , have {n, 1 friend, :n friends}', [ 'name' => 'luca', 'n' => 1 ]) instead of writing: sprintf('hi name %s , have', name) . ' ' . $n . ngettext('friend', 'friends', $n) so problem is: if i'd make such wrapper, tools poedit not recognize strings. how can solve? you need add fantasticfunction keyword extraction — documented in xgettext docs , poedit has properties ui it. but nothing {n, 1 friend, :n friends} thingie. if decided use gettext, need follow model , isn't compatible it. have @ how ngettext works , read on plural forms in different languages in gettext before inventing own approach. you're vague "d...

api - Defining a style with android parent style -

i've found here on how mix own style android's. was: <style name="something" parent="android:widget.holo.light.textview"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">match_parent</item> </style> but android studio gives me warning saying parent requires api 11, , unfortunately need program run on api 7. there way bypass issue?

sql - MySQL: Output rows created from columns containing delimited data -

this question has answer here: sql split values multiple rows 4 answers assuming have following data in mysql: **bond** | **node** | **edges** foo | 1 | 2,3 hak | 2 | 1 wat | 3 | 1,2 i wish return results create data suitable visualisation in cytoscape. requires each node have line devoted each edge. output like: **bond** | **node** | **edges** foo | 1 | 2 foo | 1 | 3 hak | 2 | 1 wat | 3 | 1 wat | 3 | 2 i think pivot operator might work somehow, have had no luck. assuming have edge master table in possible values edges stored. if assumption wrong, answer not hold good select bond, node, edgemaster.edgeid mytable join edgemaster on find_in_set(edgemaster.edgeid, mytable.edges) order bond, node, edgemaster.edgeid sql fiddle ...

python - Tkinter : Getting screen text unit width. (Not pixels) -

i'm using tkinter design ui application. i'm using grid geometry , while specifying button width (or widget width), realized width should specified in text units , not pixels. since want make platform independent , screen size independent there method max text unit width ? can math on basis of that. for example: i've 10 buttons in row, should of equal width. if hard code width value specific current screen value, not work on diff screen wise. thanks. if want make gui "platform independent , screen size independent", do not want measuring sizes yourself. unless, saying want platform independent, you're saying want button x pixels regardless of pixel density or screen resolution (which seems bad idea). the whole reason tkinter supports measuring in character units, along options widgets stretch , shrink, support platform independence. when start working @ pixel level, have many, many problems when run code on other platforms, or on other di...