Posts

java - call to Bitmap.compress does not return - and NO exception -

on android following image. it never gets past bitmappicture.compress line - seems sit there , hang. the line above byte count returns 40000. i never see compress done, or other output after 'compress'. try { final int compression_quality = 100; string encodedimage; bytearrayoutputstream bytearraybitmapstream = new bytearrayoutputstream(); log.e("error","compress" + bitmappicture.getbytecount()); bitmappicture.compress(bitmap.compressformat.png, compression_quality, bytearraybitmapstream); log.e("error","compress done"); byte[] b = bytearraybitmapstream.tobytearray(); log.e("error","bytear"); encodedimage = base64.encodetostring(b, base64.default); log.e("error","jsondata encodedimage returned"); return encodedimage; } catch (exception e) { errorlogger.adderror(e.getmessage(), 199); log.e("error",...

javascript - preventing screen redraw on resizing -

is there way prevent redrawing of screen while resizing responsive website? i want have responsive website, don't cheap animations involved when resizing screen (media breaks, instant disappears, text wraps (really ugly)) i hope there way tell browser redraw screen when resizing has stopped or similar solution.. is there? no. when change size of dom element, including body , browsers "reflow" (i.e. redraw) page. when include img element without explicit size, page reflow when image loaded. you may read more details here: when reflow happen in dom environment?

file - Remove lines from a .txt with a certain character in MATLAB -

i working on project data of magnitude of variable stars , have come across problem: the data have in .txt document has lot of comments marked symbol # , know if there way read whole text , take lines not include particular character, have read whole text , put array: fid=fopen('000006+2553.txt','r'); i=1; while 1 tline=fgetl(fid); if ~ischar(tline), break, end a{i}=tline; i=i+1; end but there don't know how follow. just add a if tline(1)=='#', continue, end to loop. that's quite standard snippet. note check first character on purpose, have come across data files contain comments after data in same line. (valid) string fields might include character.

javascript - jquery reduce flicker effect for page load -

i had side bar replacing new_sidebar url , while doing first see old br loading , new contents .its kind of flicker effect.is there way can reduce flickering effect. $(document).ready(function(event){ $(".bar").empty(); $(".bar").load("{% url 'get_bar' %}"); }); try : css : <style> .sidebar { display: none; } </style> jquery $(document).ready(function(event){ $(".bar").empty(); $(".bar").load("{% url 'get_bar' %}"); $(".bar").show(); });

jQuery.getJSON read data -

why code below not working? can see in firebug data variable contains reply data expect: "[{"nextid":"stk000022"}]" but when try , access value "undefined". jquery.post( get_data_url, formdata, function(data) { sessionstorage.ticket_id = data[0].nextid; <--- undefined here }) .done(function(data) { showpopupmsg(successclass, false, "new ticket created!<br/>new ticket number: <strong>" + sessionstorage.ticket_id); // reset form jquery( '#partnernewticketform' ).reset(); }) .fail(function(jqxhr, textstatus, error ) { var syserror = textstatus + ", " + error; showpopupmsg(errorclass, logoutflag, "the application has failed create new ticket. error: " + syserror); }) .always(function(data) { }); since server returning json, need tell jquery it, giving 4th argument $.post : jquery.post( get_data_url, formdata, function(data) { sessionstorage...

eclipse - Javascript : Syntax error on token "delete", StringLiteral? -

var testfunction = function () { return { delete: function() { // line 1 // } }; } getting below error on line 1 in eclipse syntax error on token "delete", stringliteral as changed "delete" "delete1" , error goes away . delete reserved keyword ? yes, delete reserved keyword, used remove property in object, not iterable anymore. thus, given: var = { b: 5 }; delete a.b; console.log(a); // logs {} it can used remove "global variables" properties of global object too, is: delete a; // in browsers equal delete window.a; notice can use delete property name too, need quote it: var obj = { 'delete': function() { // line 1 // } }; obj['delete']();

python - What is the purpose of Py_DECREF and PY_INCREF? -

i going through tutorial defining 'new types' in python, https://docs.python.org/2/extending/newtypes.html , , did not understand purpose of using py_decref in piece of code. static pyobject * noddy_new(pytypeobject *type, pyobject *args, pyobject *kwds) { noddy *self; self = (noddy *)type->tp_alloc(type, 0); if (self != null) { self->first = pystring_fromstring(""); if (self->first == null) { py_decref(self); return null; } self->last = pystring_fromstring(""); if (self->last == null) { py_decref(self); return null; } self->number = 0; } return (pyobject *)self; } my understanding of reference counting patchy , appreciated. in case, py_decref free memory allocated tp->alloc. tp->alloc sets ref count 1. py_decref decreases ref count 1 0; finds ref count 0, calls ap...