Posts

Json.NET (Newtonsoft.Json) - Two 'properties' with same name? -

i'm coding in c# .net framework 3.5. i trying parse json jobject. the json follows: { "tbox": { "name": "smallbox", "length": 1, "width": 1, "height": 2 }, "tbox": { "name": "medbox", "length": 5, "width": 10, "height": 10 }, "tbox": { "name": "largebox", "length": 20, "width": 20, "height": 10 } } when try parse json jobject, jobject knows largebox. information smallbox , medbox lost. because interpreting "tbox" property, , property being overwritten. i receiving json service that's coded in delphi. i'm trying create c# proxy service. on delphi-side of things, "tbox" understood type of object being returned. inner properties ("name", "length...

c# - Generic string to enum conversion -

suppose enum: public enum syslogsapptypes { none, monitorservice, monitortool }; and here function convert tostring() representation enum : private syslogsapptypes str2syslogsapptypes(string str) { try { syslogsapptypes res = (syslogsapptypes)enum .parse(typeof(syslogsapptypes), str); if (!enum.isdefined(typeof(syslogsapptypes), res)) return syslogsapptypes.none; return res; } catch { return syslogsapptypes.none; } } is there way make generic ?? i tried: private t str2enum<t>(string str) { try { t res = (t)enum.parse(typeof(t), str); if (!enum.isdefined(typeof(t), res)) return t.none; return res; } catch { return t.none; } } but get: 't' 'type parameter', not valid in given context there t.none any ? i think default keywo...

html - Having strange issues with inline inputs in IE -

i've been building form day , doing of dev in webkit browsers because of developer tools. went test in ie , i'm having strange results regards having 3 columns of divs in row. can't seem find fix. has seen issue before (see link below)? http://65.61.167.68/form/ i suggest avoiding use of display: inline-block , since ie 6 , 7 don't implement properly. in case, can solve issue in ff changing line 33 of stylesheet. remove display: inline-block , instead, float left. #paydayform .row .column { float:left; margin-bottom:5px; margin-right:18px; margin-top:5px; width:170px; }

javascript - Node.js return result of file -

i'd make node.js function that, when calls, reads file, , returns contents. i'm having difficulty doing because 'fs' evented. thus, function has this: function render_this() { fs.readfile('sourcefile', 'binary', function(e, content) { if(e) throw e; // have content here, how tell people? }); return /* oh no can't access contents! */; }; i know there might way using non-evented io, i'd prefer answer allows me wait on evented functions i'm not stuck again if come situation need same thing, not io. know breaks "everything evented" idea, , don't plan on using often. however, need utility function renders haml template on fly or something. finally, know can call fs.readfile , cache results on, won't work because in situation 'sourcefile' may change on fly. ok, want make development version automatically load , re-render file each time changes, right? you can use fs.watchfil...

actionscript 3 - Change BorderContainer background color with AS - Flex 4 -

i'm trying change background color , or text color of bordercontainer in flex 4 using action script, have not idea how to. the border container component doesn't seem have properties like: idname.color = "#333333"; idname.backgroundcolor = "#333333"; how might go doing this? thanks! you can set styles (which different properties) in actionscript so: idname.setstyle("backgroundcolor", 0xff0000);

collections - what is the best linq query for this -

i have collection of calendar objects. calendar has property id . ienumerable<calendar> calendarstoview; i have collection of event objects. event objects have property of calendarid ienumerable<calendarevent> events; i want filter events collection return events calendarid in calendarstoview collection. what best way of doing this? do join var eventsiwant = e in events c in calendarstoview c.calendarid = e.calendarid select e

C++ cout fresh array gibberish -

when "cout" empty array, gibberish. why? int main() { char test[10]; cout << test; return 0; } ...returns unicode blather. easy answer i'm sure. since didn't initialize array got garbage value (test[0] printing out). initialize it: int main() { char test[10] = {}; cout << test; return 0; } just note: just because compilers initialize stuff (like compilers initialize ints, floats etc., @ 0) not case, , can garbage value otherwise.