Posts

android - How to map Enum in GreenDAO -

i've started using greendao. how add enum property? what i've thought of: using addindex property of entity. private static void main() { // todo auto-generated method stub static schema blah; entity unicorn = blah.addentity("weather"); unicorn.addidproperty(); unicorn.addintproperty("currentairtemp"); unicorn.addindex("shirtsize"); } is right way it? aim: want have reference shirtsize being set: {xs, s, m, l, xl, xxl} as far know, enums not supported greendao due unstable nature. error-prone component add database logic, since values of enum elements can change. one option around add int property database , map enum ordinal values field, so: // add int property entity unicorn.addintproperty("shirtsize"); // create enum static values public enum shirtsize { xs(1), s(2), m(3), l(4), xl(5), xxl(6); private final int value; private shirtsize(int value) { this.value =...

javascript - How plot json data -

i'm getting every 4 secs json data this: { "time": "04:49:07 am", "milliseconds_since_epoch": 1375246147254, "date": "07-31-2013" } i'm processing in order array this: [[1375230673948, 0.6443498175195954]] (the first data js timestamp) i'm trying plot these data, on real time using flot: function draw() { console.log('draw called'); this.array = gettimearray(); $.plot( $("#placeholder"), [ { label: "test data", data: this.array, lines: { show: true, fill: true, fillcolor: "rgba(249, 28, 61,0.3)", linewidth: 2.5 }, } ], { xaxis: { mode: "time", timeformat: "%h:%m" }, yaxis: { min: -2 } }); } function gettimearray(flg) { var array = [], d = new da...

file io - Perl in memory content writing in raw mode -

i using perl 5.10.0 , trying write content in memory buffer in raw mode . not working. in following code snippet tried compare result between 3 scenarios my ($s1, $s2); open rawf, '>:raw', \$s1; #<------- opening in memory reference in raw mode print rawf 'hello world in raw mode', "\n"; open fh, '>:raw', 'testfile.bin'; #<------- opening file in raw mode print fh 'hello world in file', "\n"; open norf, '>', \$s2; #<------- opening in memory reference in normal mode print norf 'hello world in normal mode', "\n"; print $s1; #<------ doesnt print print $s2; #<------ prints expected however, if use perl 5.14.* works. limitation of perl 5.10.1? or should done in other way work? apparently bug fixed in perl 5.12 timeframe. see perlbug #80764 - though initial report/fix doesn't mention problem, problem comes in discussion on bug , rolled ...

Convert (.hex?) file to viewable image -

i given text file , told converted image. text file looks this... 0000000 d8ff e0ff 1000 464a 4649 0100 0001 0100 0000010 0100 0000 e2ff a80c 4349 5f43 5250 464f 0000020 4c49 0045 0101 0000 980c 7061 6c70 1002 ... 000d320 8b4c 1b28 3bd4 0016 91e0 799e 34c1 4457 000d330 7113 ee4d cd73 4945 63db d9ff 000d33c from googling, i'm pretty sure .hex file (though many of hex files have seen online had different formats, not certain). when search 'converting hex image', results formatted mine dry. is on type of file , how can convert view-able image? thanks this looks jpeg file, encoded in .hex file. i'm not used working hex files, 7 first digit counting lines. i'll ignore them, i'm sure can find documentation on there role (if any!). real data bytes encoded in rest of each line. sometime ago, wrote lightweight jpeg encoder . went source see if bytes can see in file rang bell: the file starts d8ff , , code wrote encoding jpeg, star...

Multiple Array Insertion in C# using Foreach statement -

Image
private void updated_modrecfga() { try { drfgamodifiedrecord table = new drfgamodifiedrecord(); foreach (arrayfunc row in arrayfunc.queryresult) { foreach (arrayfunc row2 in arrayfunc.queryresult1) { table.recorddocid = row.fgacol1; table.drno = row.fgacol2; table.ddnum = row.fgacol3; table.linenumber = row.fgacol4; table.itemnmbr = row2.upditemcode; table.itemdesc = row2.upditemdesc; table.pallet = row2.updpallets; table.bagsno = row2.updbagsno; table.totalloaded = row2.updtotalkgs; table.poststat = row2.updpoststat; table.prodcode = row2.updprodcode; table.variantcode = row2.up...

Can't override onBackPressed neither onKeyDown - Android -

i'm implementing app tabhost. in 1 of tabs i'm executing more 1 activities (activitygroup). for example: i'm in activity one, after clicking in listview go activity 2 in same tab. problem when press button, application closes , want go activity one. i've overwritten onbackpressed() method, onkeydown method , won't called, not being fired. i've seen lot of posts same problem of solutions shown wont work. would glad help! creating tabs: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main_tab); tabhost fichas = gettabhost(); fichas.setup(); tabhost.tabspec spec=fichas.newtabspec("tab1"); intent = new intent(getapplicationcontext(), allproductsactivity.class); spec.setcontent(i); spec.setindicator("hoy"); fichas.addtab(spec); tabhost.tabspec spec2=fichas.newtabspec("tab2"); intent i2 = new intent(get...

DeleteWebFolder SkyDrive .Net API Client using C# -

this code , i'm confused write in foreach loop. please me advice helpful skydriveserviceclient svcclient = new skydriveserviceclient(); svcclient.logon( "username", "*********" ); webfolderinfo[] rootwebfi = svcclient.listrootwebfolders(); foreach(webfolderinfo deletewebfi in rootwebfi) { }