FOSS4G 2009 Schedule Hack – Part 2

Note that this post is for folks who are new to ruby. I have to admit a lot of geospatial developers have not been using ruby due to the poor support for geo libraries in ruby – so it’s understandable. In this post I will show how to start parsing the FOSS4G 2009 Schedule. Lets start by gathering our tools. I am going to assume you have ruby installed. If you don’t have Ruby install, don’t fret there are now one-click installers – yes even for windows: http://www.ruby-lang.org/en/downloads/.

Reading YAML: The first thing we will need to do is to read the ‘official’ FOSS4G schedule YAML file that’s hosted at http://2009.foss4g.org/schedule.yml – as of writing this it contains data for workshops and tutorials. We will connect to the url using OpenURI module which is part of Ruby’s standard-lib. So lets try something simple, like reading the data into a Hash:

The data from the schedule is now loaded into the hash named data. If you are not familiar with ruby hashes checkout the class docs http://www.ruby-doc.org/core/classes/Hash.html also if you listen to the surreal voice in these videos you will fall in love with hashes forever – don’t say i didn’t warn you.

Ok moving on, lets poke around this data structure containing the FOSS4G schedule. Lets say I want to iterate over each tutorial and workshop then create an ical entry that we can share with our friends – so they know which sessions they may be interested in attending. Useful eh? – OK maybe not that much but it’s a start. The code for iteration would look something like this:

Next I’ll show you how to create an iCal entry and perhaps email it to your friends.

FOSS4G 2009 Schedule – iPhone + ruby Sinatra hack

Path Finder-9

Web is a great ideas playground. This is the last week for the submission of Presentations for FOSS4G 2009 (http://2009.foss4g.org/presentations). So far we have had a great set of workshops and tutorials submitted. Mark Leslie (FOSS4G 2009 Workshops Chairman) did a fantastic job coordinating the call, receipt and collation of workshops and tutorials as well as managing the voting process (Checkout Mark’s post about the workshops/tutorials). This has resulted in an impressive line up of expert instructors and tutorials on cutting edge and relevant topics.

This information was provided in a document to me by Mark. For the FOSS4G 2009 conference we want this information as widely shared as possible.

So the first thing I did was to take the information that Mark give us and converted it into a YAML format. This meant coming up with a simple data model for the data.
I did this by creating the a file for events called schedule.yml and one for presenters: http://2009.foss4g.org/schedule.yml and http://2009.foss4g.org/presenters.yml.

They both reference each other. After some trial and error I came up with something that gave us a good description of the event, authors/presenters and time of event. It had to be intuitive and easy to parse:


Next I want to demonstrate how easy it is to create build something useful from these YAML file. Well I am an iPhone owner and also enjoy developing in ruby.

Path Finder

Enter Sinatra: My first thought was to build an iPhone website where people can browse the FOSS4G 2009 – and it stuck. I decided to use Sinatra an elegant, lightweight ruby web framework. The site is up and running at http://foss4g2009.heroku.com You can get the code using git from git@heroku.com:foss4g2009.git

In the next few posts I’ll walk through and show you how I built this site using sinatra + iui and used heroku to deploy it. The site currently features:

  • Browse workshops & tutorials
  • Share ical event file of an event via email
  • Download ical event file of an event via web

Hope it will encourage others to hack around with this data or suggest ideas for building something interesting for the FOSS4G 2009 conference.