Posts

c# - SimpleJSON Unity Exception: Error deserializing JSON. Unknown tag: 123 -

i'm getting error when accessing data json file. i'm trying follow following tutorial: http://wiki.unity3d.com/index.php/simplejson and created test.json file, want extract data containing: { "version": "1.0", "data": { "samplearray": [ "string value", 5, { "name": "sub object" } ] } } using following code in unity: void loadfiles() { fileinfo f = m_info[0]; //array of files in folder // had foreach loop here, wanted specify file testing before tried parse through 1 of own print("i found : " + f); var n = jsonnode.loadfromfile(f.fullname); var versionstring = n["version"].value; // versionstring string containing "1.0" var versionnumber = n["version"].asfloat; // versionnumber float containing 1.0 var name = n["data...

swift - SIGABRT when selecting rows in TableViewController -

i have problem: when select 2nd cell of tableview, sigabrt. when select first one, works fine. must have tableviewcontroller class, because "set rows in section" (from print statement) printed 3 times, when select 2nd cell, 3 * 4 = 12 times, when select first one... oh... , error: gonna set rows in section 2 set section 2 1 gonna set rows in section 0 set section 0 1 gonna set rows in section 1 set section 1 3 2016-07-04 12:43:14.407 sessions[1229:629535] *** terminating app due uncaught exception 'nsrangeexception', reason: '*** -[__nsarrayi objectatindex:]: index 2 beyond bounds [0 .. 1]' *** first throw call stack: (0x1822e6db0 0x18194bf80 0x1821c7098 0x187b7d5ac 0x187933f1c 0x18756d444 0x18752aff8 0x1878e4b88 0x187529fc4 0x187529d5c 0x187529b68 0x187794a20 0x18752fac8 0x18743fac8 0x187465350 0x18743ed40 0x182c18cc0 0x18743ebc4 0x18744c678 0x18763edbc 0x18743fac8 0x18743f7ac 0x18743ed40 0x182c18cc0 0x18743ebc4 0x18744c678 0x1876df8c0 0x1874535b4 0x1...

java - Fraction to Recurring Decimal -

working on problem, , did few reference similar solutions. 1 thing confuse is, why break loop long there 1 repetitive number? possible number repeat 2-3 times , changed different number? thanks. i mean part specifically, if (map.containskey(num)) { int index = map.get(num); res.insert(index, "("); res.append(")"); break; } the problem, given 2 integers representing numerator , denominator of fraction, return fraction in string format. if fractional part repeating, enclose repeating part in parentheses. for example, given numerator = 1, denominator = 2, return "0.5". given numerator = 2, denominator = 1, return "2". given numerator = 2, denominator = 3, return "0.(6)". public class solution { public string fractiontodecimal(int numerator, int denominator) { if (numerator == 0) { return "0"; } stringbuilder...

javascript - Spectrum not loading when adding my own settings -

i'm using spectrum color picker plugin . have 2 color pickers showing. want majority of settings same. setting differences color , localstoragekey , , move: function (color) . rest of settings should same. i have 1 class - "full" , , 2 id's - "first", "second" . settings want both of them in full , , others in id . the problem is, when add settings first , second , color picker plugin disappears. doing wrong, , how can fix it? jsfiddle $(".full").spectrum({ color: false, flat: false, showinput: true, allowempty: false, showinitial: false, showpalette: true, showpaletteonly: false, hideafterpaletteselect: false, showselectionpalette: true, localstoragekey: false, showalpha: true, palette: [ ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3...

sql - Join two query results where one is created from column values -

i have table tables table1: name|starttime|endtime|project_number frank| 12:00| 16:00|project1 frank| 08:00| 16:00|project2 andre| 09:00| 16:00|project4 andre| 11:00| 16:00|project5 i try accomplish table shows time worked , each project this: table2: name |all|project1|project2|project3|project4 andre|12 |4 |8 |null |null frank|12 |null |null |7 |5 i can result all select name, sum(datediff(minute, starttime, endtime)) table1 group name, sum(datediff(minute, starttime, endtime)) and can accomplish table2 (with group on project well) not result want. tried union maps tables. anyone can me done? do datediff calculation in derived table. (to keep code pretty!) then use case expressions conditional aggregation: select name, sum(ts), sum(case when project_number = 'project1' ts end) project1, sum(case when project_number = 'project2' ts end) project2, sum(case when proj...

c# - Hangfire RecurringJob with dependency injection -

is possible have hangfire instantiate objects configure jobactivator when they're scheduled run recurringjob? the signature of method seems force static usages: public static void addorupdate<t>( string recurringjobid, expression<action<t>> methodcall, i have several ideas on how "abuse" statics channel things around, feel might missing something. there design decision hangfire supports statics in chron jobs? quick answer no, default job activator works on parameter-less constructors or static methods. did (in vb.net) quick , dirty see if working , have shown below. by using "addorupdate", telling hangfire create instance of t , access method of t, signature works on instance members, not statics. if use 1 of other "addorupdate" method signatures without generic parameter, require static. now fun part: if type t doesn't have parameter-less default constructor fail using default jobactivator said. t...

Is there such a thing as Unit Test Plan in Java -

i worked on java/java ee project , have deliver unit test plan , i've worked on many integration tests plans, describes integration tests scenarios, i've never heard of unit test plan. this unit test plan have describe unit tests i've done, , related rule in specifications. is there such thing in java project life cycle ? if yes, can have example , or how make one . unit tests should self explanatory. they used programmers sure code correct , doesn't affect existing code. any programmer should free add new tests if necessary, maintain document define plan of unit tests strange approach. from point of view, test plan should used define acceptance tests or integration tests, not unit tests. note unit tests useful during programming phase , during programming phase not possible know tests written. possible imagine unit test plan written @ end of work when plan not needed.