Posts

MomentJS, issue with hours and queries -

i issue when try implement moment on nodejs application... the date posted user : 1894-01-01 09:03:00 the date in query : 1894-01-01 08:03:00 when use moment parse date, hour -1 , don't know why... my code : var start = moment(a.startmonth+'-'+a.startday+'-'+a.startyear+' '+a.starthour+':'+a.startminute, "mm-dd-yyyy hh:mm"); try moment.utc(number[]); moment.utc(string); moment.utc(string, string); in utc mode display methods display in utc time instead of local time. moment().format(); // 2013-02-04t10:35:24-08:00 moment.utc().format(); // 2013-02-04t18:35:24+00:00 additionally, while in utc mode, getters , setters internally use date#getutc* , date#setutc* methods instead of date#get* , date#set* methods. read more

android - How can we determine in onPause() if an application/activity is going into the background (onStop) or will be destroyed (onDestroy) -

i had telephonic interview session , interviewer asked peculiar question. wanted know if can, means, know if activity/application stopped (onstop) or destroyed (onstop ondestroy) before happens , when flow in onpause method. i mean execution inside onpause , there can tell if ondestroy(aplication closed) or onstop (backgrounded). could not find answer anywhere. i believe you're looking isfinishing() . if true, activity in process of finishing. checked onpause() android isfinishing documentation

icons - How do I make a google plus button with a custom layout in android? -

i want create custom layout google plus button, ideas? i've tried calling onclickevent of google plus button (that doesn't work) , i've tried changing background image. source code: <com.google.android.gms.plus.plusonebutton xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" android:id="@+id/plus_one_button" android:layout_width="wrap_content" android:layout_height="wrap_content" plus:size="standard" plus:annotation="inline"/> holder.mplusonebutton = (plusonebutton) holder.content.findviewbyid(r.id.plus_one_button); holder.mplusonebutton.initialize("http://www.xxx.xx/", 0); add custom button layout set onclicklistener custom button use plusclient described here handle login procedure as example can provide controller class handling google plus login: public c...

excel vba - Userform Multipage disabling tab click -

i have userform multipage tabs, within each tab there "next" command button allows move onto next tab if there no errors (if there error, prompts user , sets focus error on tab). when userform open, can click tabs jump around without completing defeats purpose of error handling. is there way disable tab selection? or add sub tab itself? thanks change style property of multipage fmtabstylenone (2).

javascript - Check if text field is empty before executing jQuery -

this might easy question, find confusing. how run myfunc() if textfield_1 not empty? excicute .on('click', '#openbutton', myfunc) if ($('#textfield_1').val()!="") ? check inside handler: .on('click', '#openbutton', function() { if( !$('#textfield_1').val().trim().length ) myfunc(); //thanks @mike suggestion on trim , length, see comments })

javascript - Check if DOM element is editable (allow user input) with pure JS -

i have: document.body.addeventlistener("keydown", function(event) { var key = event.keycode || event.which; switch (key) { case 38: ui.action.up(); break; case 40: ui.action.down(); break; case 37: ui.action.left(); break; case 39: ui.action.right(); break; } return false; }); in code implement 2048 game. i have user forms , want exit handler if document.activeelement point input or textarea or select handler break ability perform normal edit operation users. currently see 2 paths such check: ["input", "textarea", "select"].indexof(document.activeelement.nodename) > -1 and: document.activeelement instanceof htmlinputelement || document.activeelement instanceof htmltextareaelement || document.activeelement instanceof htmlselectelement what portable way , best confirm html 5 standard , shortest one? update try 3rd strategy - check properties unique editable elements. standard htt...

java - How to encode a cookie data in jsp and decode it in php? -

we have created cookie below cookie usernamecookie = new cookie ("username", urlencoder.encode(snuser.getusername(), "utf-8")); usernamecookie.setpath("/"); usernamecookie.setmaxage(60); response.addcookie(usernamecookie); but want create cookie encoded data , has decode in php. can 1 please me. java's urlencoder.encode() uses same encoding standards php's urlencode() function. therefore, decode string has been encoded using java's urlencoder.encode() , can use php's urldecode() function. e.g. $username_encoded = $_cookie["username"]; $username_decoded = urldecode($username_encoded);