Posts

java - how to decode byte array to bitmap without OOM Exception -

i stuck in out of memory. i’m trying load image byte array ever i’ve done wouldn’t work. bitmap decoder error guess. these code : string password = prefs.getstring("bookkey", ""); bufferedinputstream buf = new bufferedinputstream(new fileinputstream(file)); buf.read(bytes, 0, bytes.length); buf.close(); byte[] bytesdecrpy = decrypt(bytes, password); bitmapfactory.options options = new bitmapfactory.options(); options.indither = true; options.injustdecodebounds = false; options.inpreferredconfig = bitmap.config.argb_8888; options.intempstorage = new byte[32 * 1024]; options.inbitmap = bitmapfactory.decodebytearray(bytesdecrpy, 0, bytesdecrpy.length, options); bm = bitmap.createbitmap(options.outwidth, options.outheight, bitmap.config.argb_8888); imageview.setimage(imagesource.bitmap(bm)); i read byte array encrypt png device file i havin...

Use awk to selectively zero left-pad certain fields only -

my file has following format: 1/2/2559,11:58:00,4/1/2559,09:36:04,10,55,my name i want use awk (among other things) left-pad 0 6th column. for e.g., output may be: my name,1/2/2559/11:58:00,10,0055,4/1/2559,09:35:04 so in example above, both 5th , 6th columns number fields want left pad 1 of fields. the printf examples got other posts far (say using printf ($7,$1,$2,$5,"%04d\n",$6,$3,$4) seems scope in fields or terminates current row upon reaching field left-padded. would appreciate pointers on this, thanks. this doesn't match expected output posted don't see how input posted may you're looking for: $ awk -f, '{printf "%s,%s,%s,%s,%04d,%s,%s\n",$7,$1,$2,$5,$6,$3,$4}' file name,1/2/2559,11:58:00,10,0055,4/1/2559,09:36:04 if not edit question explain mapping between sample input , expected output. consider also: $ awk 'begin{fs=ofs=","} {$6=sprintf("%04d",$6)} 1' file 1/2/2559,11:58:0...

Google Maps API - How to add floating addres label over a marker -

in google maps, when click on marker label pops on marker. how can programmatically activate label starting marker? im putting answer reason name used google isnt overly intuitive specific use: https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple if searching under same terms asked question can use link find answer.

shell - zsh function wrapping grep output only returns a few lines -

i'm trying create small zsh function allows me grep history - hgrep test should return every command i've typed containts test . on machine returns 6 results. when type history | grep test lot more results. gives? hgrep (){ history | grep $1 } the output - complete! ➜ ~ hgrep test 7887 mkd test 7889 rm -r test 7894 hgrep test 7896 history | grep test this incomplete output. also, notice first results much earlier ➜ ~ history | grep test 252 cp mgroup /test 254 cp mgroup /test 322 vi test.js 324 node test.js 325 vi test.js ... after poking around appears difference in behavior related when .zshrc sourced. on new terminal see unwanted behavior. if source ~/.zshrc works. however, i'm still confused why happen. it seems history command alias ed else (for example fc -l 1 ) after definition of hgrep function. so, put hgrep function definition after alias setups. or, define hgrep function (and functions) not ...

javascript - RethinkDB, add elements to an array that's nested -

using example here , i've added 1 more level notes , it's mapped object elements hold arrays { id: 10001, name: "bob smith", notes: { alpha:['note1','note2','note3'], beta:['note1','note2','note3'] } } cannot life of me figure out how append elements alpha , beta however. i've tried variations of this: update({ notes:{ alpha: r.row("alpha").append('note4') } }) but not getting anywhere. appreciated~ oh , error message no attribute 'alpha' in object: you following: r.db('test') .table('user') .get('10001') .update({ notes: { alpha: r.row('notes')('alpha').append('note4'), beta: r.row('notes')('beta').append('note4') } }).run();

c# - Generate one MVC model to be used in multiple views -

i'm new concepts of mvc , asp.net , i'm wondering if there possibility create object of model once , use throughout different views. i'm writing application gets json object through web service call contains information populate. web service call needs id create right json object. since json object quite large web service call takes 2 seconds download json object. when switching views model generated (including download of json object) every time, adds enormous overhead. generating different view models different views not work, since download bottleneck. any ideas how tackle problem? can downloaded json string stored somehow used in different views? possible download json object if id changes? regards something along these lines work: public actionresult myview(int someid) { string json = this.getjson(someid); var model = new myviewmodel(json); return this.view(model); } private string getjson(int id) { string cachekey =...

Required HTML template for web application release notes -

i want provide release note web application, , wanted know there readymade html template available on web ? here 1 apache software foundation https://github.com/apache/incubator-blur/blob/master/docs/release-notes.template.html