Tag Archives: coding

Open Sauce Hackathon – Post Mortem

This weekend saw the second ‘Open Sauce Hackathon‘ run by undergraduate students here in the school. Last years was pretty successful, and they improved upon it this year, pulling in many more sponsors and offering more prizes.

Unlike last year, when I turned up having already decided with Jon Quinn what we were doing, I went along this year with no real ideas. I had a desire to do something with a map, as I’m pretty sure building stuff connected to maps is going to play a big part in work over the next couple of months. Other than that though, I was at a bit of a loss. After playing around with some ideas and APIs I finally came up with my app: dionysus.

Dionysus Screenshot

It’s a mobile friendly mapping app that shows you two important things: Where the pubs are (using venue data from Foursquare) and where the gigs are at (using event data from last.fm). If you sign in to either last.fm or Foursquare it will also pull in recommended bars and recommended gigs and highlight these for you.

The mapping is done using leaflet.js, which I found to be nicer and easier to use than Google Maps. The map tiles are based on OpenStreetMap data and come from CloudMade, while the (devastatingly beautiful) icons were rushed together by me over the weekend. The entire app is just client side Javascript and HTML, with HTML5 persistent localStorage used to maintain login authentication between sessions. It’s a simple app, but I’m pretty pleased with it. In the end I even won a prize for it (£50), so it can’t be too bad.

The app is hosted here, and the source code is available here. Obviously though the code is not very pretty and quite hacky, but it does the job!

LaTeX notes and links

During the `LaTeX for Beginners’ UGC course on Friday 1st February I promised that I would upload the source code for my presentations along with some useful links:

Some useful links for people new to LaTeX:

LaTeX beamer handouts (with frames and borders)

I’m working on some notes for a beginners LaTeX course that I’m giving for the University Graduate College this week. In a temporary fit of insanity I decided it would be nice to write all the slides in LaTeX, so that I can distribute the source to the students so they get some real world LaTeX examples to go along with the course notes.

I was attempting to make handouts for the students using the great handoutWithNotes package. However, as my slides are white, they looked a bit odd on a page without a frame around them:

Slides without border

I wanted to add a border to make the handouts look better, but there were no suggestions at the site I got the package from as to how to add a frame, and I’m too lazy to go digging in CTAN to see if there’s any documentation.

Instead, a little bit of googling (thank you tex.stackexchange!) revealed the answer:

\pgfpageslogicalpageoptions{1}{border code=\pgfusepath{stroke}}
\pgfpageslogicalpageoptions{2}{border code=\pgfusepath{stroke}}
\pgfpageslogicalpageoptions{3}{border code=\pgfusepath{stroke}}

You’ll need one command for each slide on a page, and you get simple frames around the slides:

Handouts with Frames Easy!

Foursquare Personality Experiment

Today we are finally starting to promote our latest experiment. It’s been online for about a month, but we haven’t told anyone about it while we’ve been finishing up the Year 2 deliverables for Recognition (the review is in a couple of weeks – fingers crossed!) Now however I can start publicly talking about it and encouraging people to take part and get involved!

We’re calling it the Foursquare Personality Experiment, and it’s available on the School of Computer Science & Informatics‘ website here:

http://www.cs.cf.ac.uk/recognition/foursqexp

It’s basically looking at comparing people’s five-factor OCEAN personality profiles to the places that they check in to on Foursquare. So, you go along to the site, sign in with your Foursquare account and take a really short 44-question personality test. While you’re doing that, we retrieve the list of places you’ve been to from Foursquare. When it’s all done, we show you your personality, and how it compares to the average personality of people in your area (average personality comes from the mypersonality.org data, thanks guys!). All the venues you’ve checked into on Foursquare are simultaneously displayed on a map, and selecting one of them will show you the average personality profile for that venue. This allows you to compare yourself to all the other people who go to the same places as you

Meanwhile, we get a bunch of (anonymised) personality profiles that are linked to venues, so we can see if there are any correlations between places/categories of places and personality profiles. For instance, one of the things we may find is that the average personality profiles of “non-places” (those places frequented by everybody: the supermarket, the train station etc.) are different from the average personality profiles of “places” (the places visited by a subset of people: independent coffee shops, your local pub etc). We may also expect people with different visiting patterns to have different personalities. For instance, maybe I mainly check-in to pubs and bars on Foursquare, while someone else mainly checks in to shops. Is there a difference between the personality profiles of people who check into more pubs and people who mainly check in to shops?

Obviously we’ve only just started collecting data, but hopefully we’ll start to see some answers to some of these questions soon.

Select a tag and the other bands with that tag appear in the lineup column

SWN Artist Explorer

It’s that time of year again: SWN Festival is once more upon us. It’s the highlight of the musical year in Cardiff, and probably the one thing I’ll miss about the city when (if?) I leave. In fact, I’m pretty certain that even if I left the city I’d make the pilgrimage back once a year for SWN because it’s just too much fun to miss.

The lineup this year is another cracking one, but as usual with four days of bands spread across so many venues there are a whole bunch of names that I don’t recognise. As per usual I’ve cooked up a Spotify playlist, but even sorting through that takes some time:

I decided this year that it would be nice to have an easy visual way to see what the bands are like, so decided to build myself a little artist explorer. This uses tags from Last.FM and generates word clouds using a nice javascript plugin for d3 written by Jason Davies. Most of the word cloud js was hacked together from Jason’s example, with some mangling and modification from me. I downloaded the tags for artists offline and stuck them in a .json file so it doesn’t hit the Last.FM servers on every page load. What we end up with is a fairly simple tag cloud example that allows you to see at a glance how Last.FM users have categorised the bands. Selecting a tag in the word cloud will show you the other bands in the lineup that have also had that tag applied to them. Screenshots of the site are below:

but of course it’s also online here!

Meanwhile, the code is available on github, with no guarantees that any of it actually works.

Django + Last.FM Authentication

Following a conversation with Jon last week, I’ve been having thoughts about playing around with Last.FM data again, having not looked at that API for a couple of years. We had discussed the possibility of using the Last.FM web services as part of a project at a hackathon that some of the undergraduates are running in a couple of weeks time, and since I’ve moved from primarily developing using Java to mainly using Python since I last did anything with Last.FM I thought it would be useful to develop some basic python examples using the Last.FM API.

Yesterday I made a basic skeleton Django site that uses Last.FM for user authentication and includes a basic API wrapper for making queries. The code is all up on github for those that are interested.