Mar/091
0.8 Release Update – Know Thy Pointers
I want to start by saying I’m so glad to be writing this blog post. I spent the past 12 hours going through a pointer and memory shit pipe and I have come out clean on the other end. I can’t help but feel like Andy Dufresne in The Shawshank Redemption.
I (re)learned some critical skills today and I’m happy I took the time to refresh. My WiFi scanning code has an abundance of memory allocations (stack vs heap) and heavy usage of pointers with a whole slew of reinterpret_cast’s. I found myself a little rusty on the topic of pointers (I blame my lazy ASP/C# thinking) and as fate would have it Academic Earth came across my feeds this morning. I was wracking my brain trying to remember all the things Chris Szalwinski taught us in those first year BTP courses and I was glad to find an excellent professor on Academic Earth. I highly recommend the lecture on pointers and the subsequent one on arrays and dynamic memory allocation. I know it’s old knowledge and stuff we should all know like the back of our hands, but the old adage if you don’t use it, you lose it applies. I have spent the last two years focusing on nice safe languages like C# and Java where pointers and memory management are all hidden away and forgotten about. This refresh has been invaluable in my days success and I thought I would make a point (no pun intended) to getting on my soap box of the importance of fundamentals </rant>.
So after all that hard work I managed to get the WiFi scanning stuff going, it’s not at the point where it’s ready for Doug to peruse but it is working and that makes me very happy. I have some cleanup work to do on this tomorrow in preparation for submission for review from Doug and as my 0.8 release for Dave. In the meantime checkout this screen shot which shows an alert dialog with my home access point’s MAC address, SSID and RSSI.
I’m excited to get this patch in the tree soon, this will make the geolocation request on Windows Mobile quicker by providing location data from WiFi while the GPS unit turns on.
Finally thanks to Mike for the answer to my question (use a reference to a pointer — which lead me to this excellent resource) and to Gavin who pointed out the ‘dom.max_script_run_time’ preference so I could get rid of those annoying slow running script prompts.
