Posts

Featured post

sql - PostgreSQL reusing computation result in select query -

for example using sql can do: select (a+b) c table c < 5 , (c*c+t) > 100; is there way using postgres? this alternative might use: select foo.c ( select (a+b) c table ) foo foo.c < 5 , (foo.c*foo.c+t) > 100 from performance point of view, think it's not optimal solution (because of lack of clause of foo subquery, hence returning table records). don't know if postgresql query optimization there.

wordpress - How to make navigation a <select> list without a plugin? -

i have tried several solution this, none of them worked. managed make nav list <select><option> list, without names of pages, without indication of url any ideas how can make functional select list navigation without external plugin? (the ideal solution pages urls appear value in option can use javascript page navigation) if don't have custom script loader, add theme's functions.php: function addscripts() { if ( !is_admin() ) { wp_register_script('navscript', get_template_directory_uri() . "/js/navscript.js")); wp_enqueue_script('navscript'); } } add_action( 'wp_print_scripts', 'addscripts'); in wordpress dashboard, go appearance->my custom widgets, create new widget (give name, select html type), , add version of (leaving out div, can contain/style liking): <form> <select id="supernav"> <option value="">choose destina...

php - How is data replaced in memcached when it is full, and memcache performance? -

from memcached wiki: when table full, subsequent inserts cause older data purged in least used (lru) order. i have following questions: which data purged? 1 older insertion, or 1 least used? mean if accessed data d1 oldest insertion , cache full while replacing data replace d1 ? i using php interacting memcached. can have control on how data replaced in memcached? not want of data replaced until expires if cache full. data should not replaced instead other data can removed insertion. when data expired removed immediately? what impact of number of keys stored on memcached performance? what significance of -k option in memcached.conf ? not able understand "lock down paged memory" means. also, description in readme not sufficient. when memcached needs store new data in memory, , memory full, happen this: memcached searches a suitable* expired entry, , if 1 found, replaces data in entry. answers point 3) data not removed immediately, when new dat...

mutiple json string in android -

i have return json string. example have 1 json string: [{"locationvalue":"payroll - 9","locationid":"465","isselected":false}] and returned second json string: [{"cc2description":"denver - dn","cc2":"dn","isselected":false},{"cc2description":"las vegas - lv","cc2":"lv","isselected":false}] ans on. in android have written this: jsonarray jsonobject = new jsonarray(jsonstring.tostring()); for(int i=0;i<jsonobject.length();i++) { log.v("log", jsonobject.getstring(i)); } but can access 1 json array. want other json array also. you cannot decode multiple separate json structures in single call. json structure must complete proper javascript object or array on own, e.g. two arrays this: [1,2,3][4,5,6] is invalid, because it's 2 separate arrays smashed against each other. however, [[1,2,3...

android - EditText in ExpandableListView - Retaining focus when soft keyboard is opened -

Image
i have expandablelist multiple groups, , each group contains child of different type (different layouts). have several activities similar structure, different child views, , decided write custom adapter it. adapter works part, except couple of problems: typing text in child view next impossible. appears edittext loses focus after each character typed. have attached screenshot illustrate behaviour. when groups expanded / collapsed, after couple of times, text in textviews seem disappear, first letter of first word in each view appearing. somehow appears though layout parameters miscalculated somehow. here screenshots: and here code adapter: public class genericexpandablelistadapter extends baseexpandablelistadapter { private context context; private string[] groups; private view[] children; public static interface expandablelistitemclicklistener { public void onclick(view view, int groupid, int itemid); } public genericexpandablelistada...

android - List of files of saved to the internal storage -

my android application saving stats internal storage. each file name in format of "appname-currentdate" i wondering: when save internal storage, there specific folder assigned app, or files saved along files other applications in same directory. is there way know list of files saved application internal storage thank much. 1) depends on method use file handle. files stored in application specific directory, eg. /data/data/[your.package.name]/ . files in directory readable application. 2) use getfilesdir() method in activity file handle , use listfiles() on array of file representing files in application data folder. further reading: http://developer.android.com/guide/topics/data/data-storage.html

objective c - ios5 - "EXC_BAD_ACCESS" when clicking button -

Image
i total beginner objective c. currently try display view in main window. view contains button. reason clicking button xcode throws error. hopefully can me understand doing wrong. - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions{ self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. self.window.backgroundcolor = [uicolor whitecolor]; btnview *btn = [[btnview alloc] init]; [self.window addsubview:btn.view]; [self.window makekeyandvisible]; return yes; } the viewcontroller of button view has action recognizing touch event h file: - (ibaction)touched:(id)sender; and in m file - (ibaction)touched:(id)sender { //actions ... } by touching button following error: whats wrong? m file: h file: i assume have arc enabled project. when return didfinishlaunchingwithoptions: ob...