Posts

Featured post

ios - Memory not freeing up after popping viewcontroller using ARC -

hi project arc based, using uinavigationcontroller make transition between viewcontroller. using profiler analyse happening behind scene memory. noticed when push viewcontroller allocate memory components , when pop not freeing allocated memory. since using arc unable implement dealloc or release component. have analysed in detail , there no memory leak in project. i not using strong property push viewcontroller. here how pushing viewcontroller. viewcontroller *obj = [[viewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:obj animated:no]; any clue whats going on? should free memory have consumed. please advise your description indicates have retain cycle, leads objects not being deallocated. typical source of retain cycles properties assigned loading nib files (usually declared iboutlet ). two strategies break them , release objects: declare property weak : @property (nonatomic, weak) iboutlet uilabel *statuslabel; set property nil in

javascript - lodash: Array of Objects -

i have node.js array of objects - [ { sid: 1095, a: 484, b: 'someval1' }, { sid: 1096, a: 746, b: 'someval5' }, { sid: 1097, a: 658, b: 'someval7' }, { sid: 1098, a: 194, b: 'someval3' } ] a) possible update , delete members of array in-place based on sid , wouldn't slow things down performance-wise? b) if needed chunk array , fire off async code against chunks ( insert db, 100 records @ time ) how async blend lodash's synchronous code? pointers appreciated. a) there 2 ways accomplish this. first, instantiate object using var newarr = _.keyby(arr, 'sid'); . reference item want edit directly newarr[sid].a = 494 . option use combination of _.indexof , _.find , var index = _.indexof(arr, _.find(arr, { sid: sid })); , edit using index arr[index].a = 494 b) lodash has method _.chunk . var chunked = _.chunk(arr, 100); var promises = chunked.map(item => db.bulkinsert(item)); promise.all(promises)

Controlling while loops in Dart -

i stuck trying simple. want able count upwards until click on screen @ point want counting stop. in reality code carrying out complex ai calculations game, first want understand how control while loop. in android trivial. here code looks like bool ok = true; main() async{ html.queryselector('#content').onmouseup.listen((e){ ok = false; }); await for(int in naturals){ print(i); await sleep(); } } stream naturals async* { int k = 0; while (ok) { yield await k++; } } future sleep() { return new future.delayed(const duration(milliseconds: 1), () => "1"); } i put sleep() method in way ensure control passed event loop. is possible control while loop without sleep() method? to provide more general answer - instead of loop, want schedule sequence of future tasks each executes 1 iteration or step of ai code (or whatever background process want have running). you can have step task recursively schedule itself: dynamic dosomething(_

jquery - HTML displaying values in JavaScript "data" -

the following javascript code used display table data chart. <script type="text/javascript"> $(function () { $('#container').highcharts({ data: { table: 'datatable' }, chart: { type: 'column' }, title: { text: 'results' }, yaxis: { allowdecimals: false, title: { text: 'units' } }, tooltip: { formatter: function () { return '<b>' + this.series.name + '</b><br/>' + this.point.y + ' ' + this.point.name.tolowercase(); } } }); }); </script> html c

Loop through database fields PHP MySQL -

Image
i working on election system , having difficulty solving problem. following how application looks like. at moment these results adding query multiple times on php file. (for example run raceid = 9, raceid = 10 .........) sure there should way of reading raceid array or other way , results way. since these join tables looking way of retrieving racename (presidential names, justice supreme court ... etc) , mainracename(titles red, blue, gray) well. hope making sense far... following code <!-- main election ticket mainid loop should control --> <div class="panel panel-red margin-bottom-40"> <div class="panel-heading"> <h2 class="panel-title"> <strong>republican national</strong> </h2> </div> <!-- end sub election ticket raceid loop should control section--> <h3 style="background-color:#f5f5f5; margin:30px; padding:5px; font-weight:bold ">presidential race </h3>

c# - VS2015 icon guide - color inversion -

Image
i downloaded set of vs2015 icons , reading through msdn guide under "using color in images", stated " in order make icons appear correct contrast ratio in visual studio dark theme, inversion applied programmatically. " i'm trying mimic behavior in application when apply color inversion image, doesn't come out way looks in vs's dark theme: does know how vs inverts colors can mimic this? edit: inversion code i'm using - issue appear edges transparency/alpha: public static void invertcolors(bitmap bitmapimage) { var bitmapread = bitmapimage.lockbits(new rectangle(0, 0, bitmapimage.width, bitmapimage.height), imagelockmode.readonly, pixelformat.format32bpppargb); var bitmaplength = bitmapread.stride * bitmapread.height; var bitmapbgra = new byte[bitmaplength]; marshal.copy(bitmapread.scan0, bitmapbgra, 0, bitmaplength); bitmapimage.unlockbits(bitmapread); (int = 0; < bitmaple

Java fast image comparing -

hi formatted phone , uploaded photos pc, when wanted add photos phone saw have multiple duplicates of images. wanted merge photos 1 folder upload phone wrote java code. public class main { public static int imgctr = 1; public static file dest = new file("d:\\finalfinal"); public static void main(string[] args) throws exception { getcontent("d:\\restorefinal"); getcontent("d:\\restore1"); getcontent("d:\\restore2"); } public static string getextension(string filename) { string extension = ""; int = filename.lastindexof('.'); if (i > 0) { extension = filename.substring(i + 1); } return extension; } public static boolean isimage(string extension) { if (extension.equalsignorecase("jpg") || extension.equalsignorecase("jpeg") || extension.equalsignorecase("png")) return true; return false; } public static boolean compareima