Hacking my phone bill
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
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
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
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
Patrick O'Brian Mapping Project in Google Maps V3
I spent the workshop at todays DevFest porting the ancient version two javascript in the Patrick O'Brian Mapping Project over to version three:
The old implementation was accessing raw XML file via the old GXMLHttp object. This is an AJAX wrapper object that was in v2 because, at the time, there wasn't an alternative. In the modern world of javascript libraries, there are lots of good implementations of an AJAX request object, so v3 didn't need to include GXMLHttp anymore. The new implementation uses a Mootoos request object and grabs JSON from the database rather than raw XML files. This is something I have meant to fix for a long time.
The old Google Maps v2 GPoint object has an x and y property (longitude then latitude), so when I moved over to v3's LatLng object, all my coordinates were backwards, leading to amusing results:
Once I had the map working in v3, I was able to take advantage of the styled maps features in v3 and give it a slightly more old world feel:
Not quite ready to make the port live, the links between info windows aren't hooked up yet, but it is almost there.
Permalink - Comments - Tags: Google,Patrick O'Brian,Development
[First Page] [Prev] Showing page 19 of 40 pages [Next] [Last Page]