Posts

c# - DateTime cannot resolve ToShortTimeString() -

i have windows phone app have been using toshorttimestring method on datetime attributes. i using code in windows 8 store app , getting errors toshorttimestring cannot resolved. when check available on datetime object see smaller list of options available - date few missing options (one of ' toshorttimestring '. have done dumb here? am missing namespace? using 'system' although resharper telling me not required. toshorttimestring isn't supported in windows 8 store apps. can see when check "version information" in the documentation . doesn't mention windows 8 store apps. but that's not problem. can create method yourself: public static class datetimeextensions { public static string toshorttimestring(this datetime datetime) { return datetime.tostring("t", datetimeformatinfo.currentinfo); } }

php - Making first character of all sentences upper case -

i have function suppose make first character of sentences uppercase, reason, it's not doing first character of first sentence. why happening, , how fix it? <?php function ucall($str) { $str = preg_replace_callback('/([.!?])\s*(\w)/', create_function('$matches', 'return strtoupper($matches[0]);'), $str); return $str; } //end of function ucall($str) $str = ucall("first.second.third"); echo $str; ?> result: first.second.third expected result: first.second.third it not uppercase first word because regular expression requires there 1 of . , ! or ? in-front of it. first word not have 1 of characters in-front of it. this it: function ucall($str) { return preg_replace_callback('/(?<=^|[\.\?!])[^\.]/', function ($match) { return strtoupper($match[0]); }, $str); } it uses positive look-behind make sure 1 of . , ! , ? , or start of line, in-front of matched string.

java - Redirect activity to Frontpage activtiy after facebook login -

i trying accomplish redirection frontpage activity after facebook login,i have tried given code didnt workout yes tried link didn't work out code login activity. public class login extends fragmentactivity { private boolean ismainlobbystarted = false; callbackmanager callbackmanager; private loginbutton loginbutton; private loginresult loginresult; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); facebooksdk.sdkinitialize(this.getapplicationcontext()); setcontentview(r.layout.activity_login); public void onsuccess(loginresult loginresult) { system.out.println("onsuccess"); intent mainlobby = new intent(login.this, frontpage.class); if(!ismainlobbystarted) { startactivity(mainlobby); ismainlobbeystarted = true; } } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(reques...

ecmascript 6 - Javascript Multiple Extended Signature Test(1)(2)(3) or Test(1)(2,3) -

is possible create function in javascript allow me below: test(1,2,3) test(1)(2,3) test(1)(2)(3) i thinking of below: unsure called. function test(a) { return function(b,c) { return a+b+c; } } i looking fat arrow function , nothing mentioned this. unsure if new es6 or es7 function.

regex - JavaScript RegExp including flags in pattern -

var str = 'test, string'; var regex = new regexp('^(.*)('+str+')(.*)$/i'); console.log(regex); output /^(.*)(test, string)(.*)$\/i/ but need following output: /^(.*)(test, string)(.*)$\/i the flags should second parameter regexp constructor. new regexp('^(.*)(' + str + ')(.*)$', 'i'); ^ ^^^ the syntax of regexp constructor is new regexp(pattern[, flags])

sms gateway - Java SMPP client implementation -

i want implement simple client application in java connect , send messages using sms gateway. service provider has configured gateway , have it's ip, port, username & password. have downloaded smpp api. question there no enough documentation. there examples or documentation..? thank you. hello there pdf documentation can use @ bottom scope document defines version 3.4 of smpp protocol , specifies command , response format used when implementing smpp v3.4 protocol interface. intended designers , implementers of smpp v3.4 interface between smsc , external short message entity (esme), illustrated in following diagram. figure 1-1: context of smpp in mobile network http://opensmpp.org/specs/smppv34_gsmumts_ig_v10.pdf

Barcodescanner Camera Auto Focus Exception in Android -

can know why device through exception when camera on following exception through use barcodescanner. works fine after trying auto focus 2 3 times runtimeexception: autofocus failed: fatal exception: java.lang.runtimeexception: autofocus failed @ android.hardware.camera.native_autofocus(camera.java) @ android.hardware.camera.autofocus(camera.java:1126) @ com.maruticourier.android.zbarscanneractivity$1.run(zbarscanneractivity.java:175) @ android.os.handler.handlecallback(handler.java:800) @ android.os.handler.dispatchmessage(handler.java:100) @ android.os.looper.loop(looper.java:194) @ android.app.activitythread.main(activitythread.java:5391) @ java.lang.reflect.method.invokenative(method.java) @ java.lang.reflect.method.invoke(method.java:525) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:833) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:600) @ dalvik.system.nativestart.main(nativestart.java)