Posts

objective c - Weird memory leak with Blocks and copying in certain way in ARC -

the following simple code, under arc, in latest xcode (4.6.2) shows leaks when profiled leaks instrument, in ios simulator, in release build configuration -os optimization: - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { (int = 0; < 10; i++) { void (^block)() = ^ { nslog(@"%d", i); }; id x = block; [x copy]; } return yes; } it shows 10 leaked blocks. (it not show leaks optimization turned off; turning off optimization not realistic our app.) strange thing is, looking @ memory management history each of leaked blocks, fine -- each has malloc copy , release; release somehow not deallocate it? is compiler bug (it using default apple llvm compiler)? this seems either bug in compiler or leaks instrument, not sure which. should file bug apple. the same leak happens when shortening code this: int = 0; void (^block)() = ^{ ...

python - pandas dataframe groupby like mysql, yet into new column -

df = pd.dataframe({'a':[11,11,22,22],'mask':[0,0,0,1],'values':np.arange(10,30,5)}) df mask values 0 11 0 10 1 11 0 15 2 22 0 20 3 22 1 25 now how can group a, , keep column names in tact, , yet put custom function z: def calculate_df_stats(dfs): mask_ = list(dfs['b']) mean = np.ma.array(list(dfs['values']), mask=mask_).mean() return mean df['z'] = df.groupby('a').agg(calculate_df_stats) # not work and generate: mask values z 0 11 0 10 12.5 1 22 0 20 25 whatever replaces values column masked mean. and can solution applied function on 2 columns , return in new column? thanks! edit: clarify more: let's have such table in mysql: select * `reader_datapoint` `wavelength` = '560' limit 200; which gives me such result: http://pastebin.com/qxiawcjq if run this: select *, avg(action_value) `reader_datapoint` `wav...

javascript - Mashup Google maps & photos by Flickr -

i've problems little script permits me create mashup google maps , photos flickr. creates simple map rome milan , after that, requests ten images flickr based on geotag. @ end, positions every photo marker taken google. but can't understand i've done wrong. have ideas? <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>mappa+info</title> <style type="text/css"> html, body { margin:0; padding:0; width:100%; height:100%; } body { background:#ffffff; color:#000000; font-family:arial, helvetica, sans-serif; font-size:12px; line-height:150%; text-align:center;} #map { width:100%; height:100%; } input { width:250px; } </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=aizasyc0ham8pi7rmquism444jdehtjoswbte_e...

android - When requestLocationUpdates call? -

i trying call requestlocationupdates using above: locationupdaterequester.requestlocationupdates(900000, 75, criteria, locationlistenerpendingintent); when call requestlocationupdates again after approx 15 min , 75 meter distance cover device? it checks @ every 15 min interval, change in distance. whenever distance increases above 75 meter, onlocationchanged() invoked.

java - Is it possible to re-direct an instance from a constructor in a multi-class? -

checking boolean condition passed multi-class' constructor, , if true i'm trying assign this instance of sub-class. doesn't work of course, there way re-direct instance in way? if there no way this, reasons why? here multi-class: public class multiclass { string str; public multiclass(boolean flag) { if (flag) { // doesn't work! wish would: // = new extraclass(); } else { this.str = "you in first class"; } } } // end of multiclass class extraclass { string str; extraclass() { this.str = "you in second class"; } } // end of extraclass ...and tester class: public class multiclasstest { public static void main(string[] args) { multiclass test = new multiclass(false); system.out.println(test.str); } } // end of multiclasstest you can have either use factory method e.g. static method can return implementatio...

Display long text in fixed frame in Corona -

so @ moment have assignment @ school requires me create calculator mobile devices using corona, ive got buttons , display classes work. in display class, ive created 2 frame (one display method , others result). final result im looking handheld graphical calculator's ui (casio fx series..). which means can type in long , continuous method (the whole text move toe left , show end of method) press "=" calculator give result. what i've got far created frame can fit 2 lines of text displaying method, once you've filled frame numbers, corona crop out end of string . so i'm going having 2 strings, 1st 1 main 1 store user type in (the whole method) select last 10 characters main string , save in second string , display second string. so know if there's code can use select number of characters string ? you can use built in lua method string.sub (yourstring, startindex , endindex ) http://pgl.yoyo.org/luai/i/string.sub `

php - mysql table update gives no result -

i made html form updates fields in table in mysql db after succeful updates should direct me success page otherwise give error msg. indicating error i use form validation far nothing happens fields in table directs me blank page here form code : <html> <body> <form action="http://localhost/wordpress/orgupdate.php" method="post" name="myform"> name <input id="name" type="text" name="name" /> telephone <input id="telephone" type="text" name="telephone" /> fax <input id="fax" type="text" name="fax" /> web address <input id="webaddress" type="text" name="webaddress" /> state <input id="state" type="text" name="state" /> address <input id="address" type="text" name="address...