An iOS client for my UK inflation app

After last week’s great Xcake meet I felt a fresh surge to take on new challenges and bend some less-familiar pieces of technology to my will.

Motivation

The first product of this enthusiasm was a prototype web app built to get a bit more experience with Python and Google App Engine. A few days later it got an API.

The resulting rapid feedback loop led me to pick up my copy of Beginning iPhone Development which had been sitting gathering dust for the last couple of years and get stuck back into following the examples.

Revisting Cocoa

I first dabbled with developing for Cocoa when I first started using a Mac and managed a range of “Hello World” apps, simple calculators and embedded WebKit views, but nothing substantial came of it. Thankfully a few of the concepts seemed to have stuck and after working through the first few chapters of the book again I felt confident enough to get started on something of my own and an iOS client for ukinflation.appspot.com seemed a logical choice.

This is the result:
UK Inflation App - Screenshot

What I Learnt

Even though this is a trivial app there have been a few aspects which have been useful from a learning perspective:

  • accessing an external API
  • decoding JSON
  • local data persistence with a plist file
  • interacting with view elements

These are all things which could make for useful reference material in the future.

Moving on

I’m not part of the paid iOS developer program at this time so I haven’t been able to test the app on actual hardware, which would have been nice. I may stump up the 99 bucks to get my hands on Xcode 4 and have the ability to run my code on a device. I may decide to have a crack at developing a desktop Mac app. Who knows.

The topic of push notifications was mentioned at the last Xcake so there’s another potential area of investigation involving both server and client technologies.

Stay tuned!

Keeping an eye on UK inflation with Google App Engine

For a long time now whenever I’m on the search for something interesting to work on that could potentially be of value to myself and others my attention is brought to topics like machine learning, data mining and natural language processing.

These are all areas within computer science which are not particularly easy and have a higher barrier of entry compared to building a typical web application for instance. Yet, if implemented correctly they can provide great insight and fame and fortune are bound to be near.

Joking aside. I studied artificial intelligence at university and my undergraduate dissertation was focussed on expert systems so I’ve a bit of exposure to these topics but nothing decidedly practical nor within the past decade.

Interesting Books

Some searching on Amazon turned up a couple of books which looked to be talking about the type of tasks I was interested in performing.

One thing these books have in common is that they use code examples in Python.

For nearly half a decade now a lot of my interest has been with Ruby and related technologies and so I’ve largely avoided Python considering the similarity of the space the two languages sit in. A look through the most popular AI books revealed none using examples written in Ruby however.

The other day I came across a copy of another book using Python so I thought I may as well get a bit of hands on experience with the language and take it from there.

Something Practical

In the past I’ve tried to teach myself many languages from books but it has never been until I’ve needed to use the language for something practical that the know-how stuck.

Thankfully I didn’t have to wait long until inspiration struck. As a private investor in the current economic climate, a topic that has been in my mind has been the rate of inflation. Every time I want to check how quickly my assets are being eroded by inflation I have to unleash Google and hope I land on the correct page and from there find the current rate amongst all the other information. This seemed like the perfect fit for yet another single serving web app.

My starting point was to write a Python script to scrape the Office for National Statistics for the current value for the Retail Price Index.

Next up was creating a basic web-app with App Engine. I’d tinkering with App Engine a bit previously so it was relatively straight-forward to follow the tutorials and piece together a single page app. Slightly more complicated was reading up on the Datastore and Memcache APIs but there were plenty of examples to follow.

Conclusion

The end result is ukinflation.appspot.com. It’s basic but deals with the job at hand. It’s also been a good introduction to various components of the App Engine environment: Datastore, Memcache, Cron, templates and the built-in webapp framework.

I’ve used in all of these types of technologies in other forms over the years and it’s amazing that you get so much functionality out of the box and as long as you embrace the constraints, scaling out comes for free.

I’ve still to make my mind up about Python though, maybe I’m just too accustomed to Ruby. Still, I’m glad to have another tool in the toolbox and to not be restricted to any one set of tech.

Share the Love

As always the code is available on GitHub, fork away!