Posts

Featured post

ios - NSDateFormatter: error in converting date -

i have got following time stamp in milliseconds: nsdate * date = [nsdate datewithtimeintervalsince1970:1470524933.923123]; nsdate * date2 = [nsdate datewithtimeintervalsince1970:1470666561.000]; nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd 'at' hh:mm:ss"]; nsstring * dateinstring = [dateformatter stringfromdate:date]; when run following: 2016-08-07 @ 00:08:53 , 2016-08-08 @ 15:29:21 however first date should following according epoch time converter website using : your time zone: 8/7/2016, 12:08:53 gmt+1:00 dst it says 00 rather 12. why that? try set timezone of nsdateformatter gmt [dateformatter settimezone:[nstimezone timezonewithabbreviation:@"gmt"]]; as larme , vadian suggested if want 12 hour use format [dateformatter setdateformat:@"yyyy-mm-dd 'at' hh:mm:ss a"];

android - How to read a column value in parse.com without accessing an object or a pointer -

by using code, not able 'name' unless use objectid = xj34weo . suggest way, if not, @ least using pointer. //parse query initialization final parsequery<parseobject> query = parsequery.getquery("myusers"); //to check row has "number"="1234" query.whereequalto("number", "1234"); query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> employees, parseexception e) { if (e == null) { try { //xj34we0 objectid query.get("xj34weo").get("name") + ""); } catch (parseexception pe) {} } } }); are trying employee object number? you have list<parseobject> , use it. query.findinbackground(new findcallback<parseobject>() { public void done(list<parseobject> employees, parseexception e) { if (e == null && employ

serialization - Flink is not able to serialize scala classes / Task Not Serializable -

i have scala class having 2 fields vals flink saying doesn't have setters. task not serializable. i tried setters using var says duplicate setter. vals public why asking setters. flink version 1.1.0 class impression(val map: map[string, string],val keyset:set[string]) my code: val preaggregate = stream .filter(impression => { true }) .map(impression => { val xmap = impression.map val values = valfunction(xmap) new impressionrecord(impression, values._1, values._2, values._3) }) exceptions: **class impression not contain setter field map** 19:54:49.995 [main] info o.a.f.a.java.typeutils.typeextractor - class impression not valid pojo type 19:54:49.997 [main] debug o.a.flink.api.scala.closurecleaner$ - accessedfields: map(class -> set()) exception in thread "main" **org.apache.flink.api.common.invalidprogramexception: task not serializable at** org.apache.flink.api.scala.closurecleaner$.ensureserializable(closurecleaner.scala:172) @

java - I cannot get the program to repeat output in an ordered manner -

i want design program scales strings. if string d = "abc\ndef\nghi",horizontal scalling=2,vertical scalling=2, scaleobj.scale(d,2,2)/ defined below / should output "aabbcc\naabbcc\nddeeff\nddeeff\ngghhii\ngghhii". //output aabbcc aabbcc ddeeff ddeeff gghhii gghhii ive have problem ive defined below: //mainsix.java public class mainsix{ public static void main(string[] args){ scale scaleobj = new scale(); system.out.println(scaleobj.scale("abc\ndef",2,3)); } } class scale { public static string scale(string strng, int k, int v) { //horizontal scalling -k string s=strng.replaceall(".", repeat("$0",k)); //verical scalling string y = repeat(s,v); return y; } public static string repeat(string str, int times){ return new string(new char[times]).replace("\0", str); } } when compile output aabbcc ddeeffaabbcc ddeeffaabbcc dd

timer - Java TimerTask cancel -

i have following problem. every 2 seconds programm go inside if statement. inside if statement want have timer give me message after 15 seconds. timer should run delay of 1 second. while i'm "waiting" timer, if statement executed 7 times. problem is, have 7 same timertask @ same time running. how can solve problem? if (response == true) { final timer timer = new timer(); final int keepalivetimeout = 15000; //15 seconds timer.schedule(new timertask() { @override public void run() { if (response) { response = false; log.i(tag, "********response******"); timeoutcounter = 0; } else if (timeoutcounter > keepalivetimeout) { log.i(tag, "********timer timeout******"); } log.i(tag, "********timer******"); timeoutcounter = timeoutcounter + 1000; } }, 0, 1000); } from java api : public void schedule(timertask task, long delay,

Cannot perform a calling between two emulator in android studio 2.0 -

Image
i turned on 2 emulators port 5556 , 5554 different windows. pressed number 5556 , called. nothing happens. cannot call between 2 emulators in android studio 2.0. how can fix thank in addition, can use block function block virtual call? i don't know if calling between 2 emulators should work or not. can simulate phone call in way: select … in emulator panel. select "phone" in left panel of extended controls dialog. select or type phone number in field. click call device.

ios - Realm swift change primaryKey -

so have realm object class registrationplatedb: rlmobject { dynamic var registrationplate : string = "" dynamic var user : string = "" override static func primarykey() -> string? { return "registrationplate" } ... and change class registrationplatedb: object { dynamic var plateid : int = -1 dynamic var registrationplate : string = "" dynamic var name : string = "" dynamic var user : string = "" override static func primarykey() -> string? { return "plateid" } .... so i've written migration migration.enumerate(registrationplatedb.classname()) { oldobject, newobject in newobject!["name"] = "" newobject!["user"] = "" newobject!["registrationplate"] = "" newobject!["plateid"] = -1 newobject!["primarykeyproperty"] = &