Hacking my phone bill

September 23, 2010, 6:54 pm

Because I am a huge nerd, I sat down for five minutes in the local Telstra shop and wrote a python script to analyse an old mobile bill to work out what cap plan I should get.

f = open ("bill.txt", "r") lines = f.readlines() # flagfall in cents flagfall = 37 # cost per thirty seconds in cents perthirty = 40 #total in cents total = 0 #total seconds logged total_seconds = 0 #calls made calls = 0 for line in lines: vec = line.split(":") if (len(vec) != 3): continue print vec seconds = int(vec[0]) * 60 seconds += int(vec[1]) total += flagfall total += perthirty * (seconds / 30.0) total_seconds += seconds calls += 1 # number of sms that month sms = 74 sms_cost = 74 * 25 total += sms_cost print "$" + str(total/100.0) + " for " + str(calls) + " calls, " + str(total_seconds/60) + " mins, " + str(total_seconds%60) + " secs" f.close()

It assumes a bill.txt file with the following format:

0:30:00 0:30:00 0:30:00 0:30:00 0:30:00 0:30:00

Permalink - Comments - Tags: Development

George R R Martin

September 13, 2010, 3:28 pm

I had planned on getting to Melbourne for Worldcon this year, primarily to see George R R Martin in person. Unfortunately life intervened and this didn't happen, but I did manage to see him today when he came to Galaxy Bookshop to do a signing.

My friends and I over-estimated the fervor of the fanbase in Sydney and turned up at Galaxy half an hour before it opened to claim our position at the front of the queue. A couple of hours later the other fans started to turn up. Sitting on the floor of a bookshop for four hours is not as awkward as you would imagine.

Permalink - Comments - Tags: GRRM

Significant Change Map

August 30, 2010, 10:31 am

At TingoFamily we have been doing some testing with the new Apple iOS4 Significant Change API. The following image is a map (slightly offset to protect the innocent) of position changes over the weekend:

The fact that the user in question never went west of the body of water in the center of the map leads me to wonder about the utility of the data from this API. I am going to try out doing a full GPS query when the app gets woken up on significant change to see if I can get better results.

Permalink - Comments - Tags: Development,iPhone

Testing iOS 4.0 Location APIs on the iPhone

August 15, 2010, 1:39 am

In the course of investigating the new iOS 4.0 location APIs, I have found that the documentation was not entirely clear when describing the various cases associated with suspended and terminated apps on the device. Combining this lack of clarity with the inability to set location through the iPhone simulator, resulted in a reasonable amount of frustration.

I found the only way to effectively test this stuff is to get on a train and travel around with your app in the debugger.

This is not exactly ideal, so I built a simple test harness to switch between the various location APIs and log all the responses that the app receives. You are welcome to download, use, modify, etc at your own risk. It is pretty straightforward, but might save you some time building something to test this stuff out. If there are any glaring errors, please let me know.

Update 17 August 2010

I have found testing the app that when I am woken up from a terminated state, I get very little time to do anything. My first cut logging code was fairly inefficient so I have updated the app to do the bare minimum to write out log messages.

I also found a bug in my wake up code that instantiated a CLLocation and assigned it to a CLLocationManager, this compiles without no warnings because init returns an id which you can happily assign to anything you like, but fails when the app tries to set a delegate on the object. I have fixed this in the current version so you should get all your wake up log messages.

Update 18 August 2010

With some more testing of the wake from terminate case, I discovered that I was adding the view controller to the window in the wrong place. Adding it in didFinishLaunchingWithOptions is fine if you aren't using background location services, because there isn't a case where you don't want to create the UI. In the background location processing case, you want to be able to start up and not do all the UI overhead. So I have moved that code into applicationDidBecomeActive. That way when the app gets started by the user it adds the subview if the UI has been initialized (by checking if the window has any subviews).

Update 20 August 2010

Thanks to Daniel's suggestion I have added a Github repo for the project.

Permalink - Comments - Tags: iPhone,Development

Mapping of the Surgeon's Mate Complete

July 21, 2010, 11:55 pm

The events of The Surgeons Mate, rescue by HMS Shannon, a long chase in The Packet Diligence and the final voyage of the HMS Ariel, is complete.

Over a year and a half ago, having taken an unprecedented eight months to map The Fortune of War, I had anticipated:

I hope my distracting forays into other projects will be less frequent for the next one.

Instead, I have managed to distract myself with more and more projects and found myself with less time to work on mapping the cannon than I would like. Despite the distractions, The Patrick O'Brian Mapping Project remains a priority and in the last few months I have managed to build some features that I am very happy with:

  • POB Quotes - A free iPhone application to view a selection of quotes and maps from the project.
  • Google Maps Version Three - In May, Google announced that the new version of the Google Maps API would replace version two as the production API. Ever since then I have been meaning to upgrade the rather archaic implementation of the project. I managed to do most of this at the recent Google DevFest in Sydney. As of today, that new version is live on the site and you will notice a new look and feel for the maps. I would love to hear your feedback on the new and (hopefully) improved Patrick O'Brian Mapping Project.
  • New backend architecture - Part of the work to move over to version three of the maps API involved changing the way the data is stored in the project. You will now find that links to individual map notes (from the title of the map popups) will be more reliable.

Once again I will optimistically declare that the next book will surely be quicker than the last. Time and Tide etc...

Permalink - Comments - Tags: Patrick O'Brian,Books