Entries tagged ‘iphonedevcampcph08’
Last month, together with Andreas Rasmussen and Anders Borre Hansen of MacVærk and Aron Allen of Copenhagen Cocoa, I co-organized iPhone Dev Camp Copenhagen. We saw fifty people show up for pizza and a quick iPhone crash course, and during the night about 20 people stayed to work on their iPhone apps.
Together with Aron, Jonathan Bunde-Pedersen and Philip Bruce I worked on TrainTrack, a neat little app which shows the next departures from S-Train stations here in Copenhagen.
Above is a small sketch of the TrainTrack UI. Here’s what we ended up with after a night of hard work (back then, it was less broken):
The feature set on the morning of October 4th:
- Displaying next ten departures from all S-Train stations.
- Support for favorite stations.
- Finding the nearest station, based on GPS coordinates. Or, well, finding whether København H or Lyngby is the closest station, since we had only entered GPS coordinates for those two stations.
Since we wanted the app to work even without a data connection, and we didn’t want to query a web service to find the next departures, we had to figure out a way of getting the departure time table. The best hackish way to do that was to parse a RTF file found on the DSB website.
This then was my task. That’s right, I went to iPhone Dev Camp and I wrote Python code!
I figured out how to parse the RTF file to extract stations and departure intervals from those stations, taking into account the various exceptions, such as weekends, rush hour trains, et cetera. At least, I hope I did. I’ve had to make some improvements to the database since the camp, and I’m still not confident that it’s fully accurate. Which makes sense, because parsing an RTF file is the wrong way to get the data!
As it turns out, it should be possible to get the database from Rejseplanen, which gives us a reliable solution. Then, of course, we’ll also have to figure out how to keep the database up to date, and perhaps discover last minute delays.
For the camp though, getting the data from an RTF file worked out quite okay.
Jonathan and Philip did most of the application programming. The departure times and favorites were stored in a SQLite database. Following the MVC paradigm, we used a model to manage favorites, query train stations and departure times. There were views and controllers for the station list, favorites list, nearby stations list, and the departures list. This, of course, worked quite nicely. Unfortunately we arrived at a hacky way of figuring out the next departures, by using integers for departure times rather than NSDate objects. This introduced some bugs, especially after midnight. Another example of where the quick ‘n dirty way breaks down quickly and dirty.
That said, we really did build a prototype of the app. We’d like to take it further, make some big improvements and hopefully put it up on the App Store. The current version is working a lot better, at least:
I had a great time at iPhone Dev Camp, and it was quite cool building a small app. It helped me grasp the concepts of Cocoa development and Cocoa itself. It’s a bit different from web programming, but still quite straightforward.
TrainTrack screenshots on Flickr



