SWN Festival 2013 plans - part 1: the data

August 14, 2013

As I mentioned, I’m planning on doing a bit more development work this year connected to the SWN Festival. The first stage is to get hold of the data associated with the festival in an accessible and machine readable form so it can be used in other apps.

Unfortunately (but unsurprisingly), being a smallish local festival, there is no API for any of the data. So, getting a list of the bands and their info means we need to resort to web scraping. Fortunately, with a couple of lines of python and the BeautifulSoup library, getting the list of artists playing the festival is pretty straightforward:

import urllib2
import json

from bs4 import BeautifulSoup
root_page = "http://swnfest.com/"
lineup_page = root_page + "lineup/"

try:
response = urllib2.urlopen(lineup_page)
except urllib2.HTTPError, e:
raise e
except urllib2.URLError, e:
raise e

raw_data = response.read()

soup = BeautifulSoup(raw_data)

links = soup.select(".artist-listing h5 a")

artists = {}

for link in links:
url = link.attrs["href"]
artist = link.contents[0]

artists[artist] = {}
artists[artist]["swn_url"] = url

All we’re doing here is loading the lineup page for the main festival website, using BeautifulSoup to find all the links to individual artist pages (which are in a div with a class of “artist-listing”, each one in a h5 tag), then parsing these links to extract the artist name, and the url of their page on the festival website.

Each artist page on the website includes handy links to soundcloud, twitter, youtube etc (where these exist), and since I’m going to want to include these kinds of things in the apps I’m working on, I’ll grab those too:

for artist, data in artists.iteritems():
try:
response = urllib2.urlopen(data["swn_url"])
except urllib2.HTTPError, e:
raise e
except urllib2.URLError, e:
raise e

raw_data = response.read()

soup = BeautifulSoup(raw_data)

links = soup.select(".outlinks li")

for link in links:
source_name = link.attrs["class"][0]
source_url = link.findChild("a").attrs["href"]
data[source_name] = source_url

This code iterates through the list of artists we just extracted from the lineup page, retrieves the relevant artist page, and parses it for the outgoing links, stored in list items in an unordered list with a class of ‘outlinks’. Fortunately each link in this list has a class describing what type of link it is (facebook/twitter/soundcloud etc) so we can use the class as a key in our dictionary, with the link itself as an item. Later on once schedule information is included in the artist page we can add some code to parse stage-times and venues, but at the moment that data isn’t present on the pages, so we can’t extract it yet.

Finally we can just dump our artist data to json, and we have the information we need in an easily accessible format:

with open("bands.json", "w") as outfile:
json.dump(artists, outfile)

Now we have the basic data for each artist, we can go on to search for more information on other music sites. The nice thing about this script is that when the lineup gets updated, we can just re-run the code and capture all the new artists that have been added. I should also mention that all the code I’m using for this is available on github.

SWN Festival 2013 - plans

August 11, 2013

Last year I had a go at creating a couple of web apps based around the bands playing the SWN Festival here in Cardiff. I love SWN with all my heart, it’s a permanent fixture in my calendar and even if (when) I leave Cardiff it’ll be the one thing I come back for every year. It’s a great way to see and discover new bands, but sometimes the sheer volume of music on offer can be overwhelming. So I wanted to see if I could create some web apps that would help to navigate your way through all the bands, and find the ones that you should go and see.

The first was a simple app that gathered artist tags from Last.FM, allowing you to see which artists playing the festival had similar tags - so if you knew you liked one artist you could find other artists tagged with the same terms. The second (which technically wasn’t ever really finished) would allow you to login with a last.fm account and find the artists whose tags best matched the tags for your top artists in your last.fm profile.

I liked both these apps and found them both useful - but I don’t think they went far enough. I only started development late in the year, about a month before the festival, so didn’t have a lot of time to really get into it. This year I’m starting a lot earlier, so I’ve got time to do a lot more.

Firstly I’d like to repeat the apps from last year, but perhaps combining them in some way. I’d like to include more links to the actual music, making it easy to get from an artist to their songs by including embeds from soundcloud, spotify, youtube etc. I’d also like to try making a mobile app guide to the festival (probably as an android app as the official app is iOS only). I’m hopeful that given enough free time I should be able to get some genuinely useful stuff done, and I’ll be blogging about it here as I work on it.

Summer Project update

July 25, 2013

We are storming along with summer projects now, and starting to see some really good results.

Liam Turner (who is starting a PhD in the school in October) has been working hard to create a mobile version of the 4SQPersonality app. His work is coming along really well, with a great mobile HTML version now up and running, a native android wrapper working, and an iOS wrapper on its way. With any luck we’ll have mobile apps for both major platforms ready to be released before the summer is over.

Max Chandler, who is now a second year undergraduate, has done some great work looking at the Foursquare venues within various cities around the UK, analysing them for similarity and spatial distribution. He’s just over halfway through the project now and is beginning to work on visualising the data he’s collected and analysed. He’s creating some interesting interactive visualisations using D3, so as soon as he’s done I’ll link to the website here.

It’s been a really good summer for student projects so far, with some really pleasing results. I’ll post more description of the projects and share some of the results as they come to a close in the coming weeks.

Open Sauce Hackathon - Post Mortem

April 22, 2013

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.

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!

Social Media Lecture Experiment

April 22, 2013

I’ve very recently had the opportunity to be involved in a different kind of lecture here at the School of Computer Science and Informatics. For his final year project one of our third year students (Samuel Boyes) is assessing the use of modern technology, social networking and video conferencing as part of the traditional lecture. As I had already been asked a few weeks ago to give a guest lecture in Matt Williams’ module Fundamentals of Computing with Java, on the topic of code maintainability/readability, we were presented with a nice opportunity to test out Sam’s theories in an actual lecture.

So, rather than giving a dull, fifty-minutes-of-me-waffling-on-about-things-at-the-front-of-a-lecture-theatre lecture, we changed things around. Instead, I spoke for twenty minutes on the general theory aspects of the topic, and following that we were joined in the lecture by an external speaker, Carey Hiles of Box UK, who joined via a Google+ Hangout to deliver some material about his experiences of the topic in the real world. The students were encouraged to get involved during the lecture, tweeting with a particular hashtag and leaving messages in a dedicated facebook group. We could then wrap the session up by going over the questions posted by the students, putting them to Carey through the video conferencing.

This was very interesting, as it allowed us to include the experiences and knowledge of someone out in the real world within the lecture, adding some extra value to the course and introducing students to ideas that are used in practice. It’s the kind of thing that we should be doing more of, and that I’d love to include in more lectures in the future. There are people out there with relevant real world experience and a desire to talk to students and improve the quality of education. Given the availability of tools that allow people to get involved in lectures remotely, it seems like a no-brainer that this kind of thing could and should happen more often.

It’s also directly relevant as there seems to be a strong desire to increase the added value of attending lectures and to improve the quality of teaching. The Higher Education sector in the UK is undergoing something of a transformation at the moment. Massive unjustified increases in tuition fees have fundamentally altered the relationship between universities and students, increasing the feeling that students are customers of the the institution. As such, students are now (rightly) demanding much better customer service and value for money from their institution (caution: PDF link!). (We’ll leave aside for now how the the universities are having to increase the value for money and customer service without actually having any more money, as that’s another argument.)

Seen in a global context, this customer-institution relationship becomes even more important. Massive online open course (MOOC) providers such as Coursera, EdX, Udacity and the UK based FutureLearn (in which my employer, Cardiff University, is involved) are providing large numbers of people with free educational material and courses. It’s still not clear how universities will end up continuing to make money from teaching while also giving away all their material for free. Some MOOC providers will charge other institutions licensing fees to use materials, while it seems fairly plausible that instead of charging to access material, universities will instead start to charge for providing credentials and certification once the courses have been completed.

If that really is a large part of the future of higher education, will the traditional lecture continue to exist? Will universities need lecture theatres full of hundreds of students, when they can put their material online and deliver teaching to thousands of students without the physical presence? Will the traditional university institution continue to exist? It’s entirely possible that many institutions could stop teaching and focus purely on research. It’s more than possible that some institutions will close entirely in the face of competition of ‘free’ teaching from higher ranked institutions. Is consolidation of teaching delivery between fewer larger institutions a good thing?

Until we discover the answers to these questions over the next few years (decades?), there’s still a need to ensure that students feel they are getting value for money. We need to ensure that the institution continues to provide a reason for students to pay to attend lectures where material is delivered that could instead be had online for free. Value added is more important than ever and maybe sessions like the one we had last week could play a part in that.

CUROP Summer Project

March 27, 2013

As in previous years, I (along with Walter as co-supervisor) have managed to score some University funding for a summer project through the CUROP programme.

This years project is titled “How Unique is my City? An online analysis of the UK”.

A huge amount of information regarding places is available online. Services such as Foursquare, Yelp, Google Places, TripAdvisor etc. allow users to rate and review locations and venues, creating a ’long-tail’ of content describing peoples feelings and interactions with these places. This project seeks to harness this vast wealth of information to examine the relationship between places and people within the urban environment. Analysis of the distribution of types of venues will allow us to assess the individual characteristics of cities, allowing us to determine what makes a city individual and what makes the city similar to all other cities. Further textual analysis of user interactions with venues may allow a deeper understanding towards ‘sense of place’.

This 8-week funded project can cover topics such as large scale data mining, analysis, visualisation and social network analysis, and will largely be shaped by the interests and skills of the student undertaking it.

Interested students can contact me.

Advanced LaTeX Course

March 15, 2013

Here are the slides and source code for the UGC Advanced LaTeX course, 15th March 2013

Introduction (Beginners Recap, Graphics & Figures) - handouts and source
BibTeX and Referencing - handouts & source
Custom Commands & Environments, Source Code Listings, Tips & Tricks - handouts & source
Exercise Sheets - handouts & source

Cinema 2012 - the review

February 6, 2013

At the beginning of the year I embarked upon a challenge: watch 100 movies in the cinema in 1 year. I thought it would be fun, but difficult.

It was fun.

It was difficult.

This is a not very brief account of that year, starting with the best movies that were released this year and that I saw in the cinema. In no particular order, I think the best movies released this year that I saw in the cinema were:

  • Moonrise Kingdom

  • Beasts of the Southern Wild

  • End of Watch

  • The Hunt

  • Rust and Bone

  • Sightseers

  • The Artist

  • Argo

  • Killer Joe

The Artist was really fun and original in a non-original way, showing us nothing that hadn’t already been done before, but doing it in a fashion that nobody is used to, and that many people will never have seen. No, it didn’t deserve the plaudits later awarded to it by the Academy et. al, but it was certainly one of the better movies this year. Moonrise Kingdom was beautifully Wes Anderson, full of wonderful visuals, subtle humour and outlandish scenarios, all wrapped around a strong and affecting emotional core. The acting performances from the two young leads were really good, and as usual the soundtrack was fantastic. I laughed a lot, and still chuckle now on recalling much of the film. No, it’s not as good as The Royal Tenenbaums, but then what is? Killer Joe was strongly disturbing, a brilliant showcase for Matthew McConaughey. I’d never really thought he was much cop before, but his performance in this movie was amazing, as were many of the performances by the rest of the cast that made this brutal and depressing tale far more watchable than it should have been. Argo surprised me; I’d had high hopes but was waiting for them to be destroyed upon watching. How pleased I was to see that Ben Affleck had pulled it off, crafting an involving and suspenseful film that was massively entertaining. On the whole I was amazed at how well the movie managed to keep the suspense going in a movie where the outcome was already known to me. Sightseers was hilarious and yet brutal, a great mix. The characters were perfectly formed, the type of people you could find in any local midlands pub, but with a far darker edge than most (I hope!). The movie whipped along at a great pace, leading to the inevitable final scene that still surprised. I wasn’t expecting to be as affected by Rust and Bone as I actually was, but I found Marion Cotillard’s performance completely amazing. The depth of emotion she was able to put into the character was outstanding, and I found the film to be quite moving. A similarly brilliant character performance came from Mads Mikkelsen in The Hunt, a powerful film showing just how badly lives can be affected by rumour and false accusations. Again I was impressed with the acting on show, and the final few moments of the film left me with a deep feeling of unease.  In contrast, Beasts of the Southern Wild was just a delightful movie, I loved the semi-real dreamlike feel to the movie and was astounded again by the acting on show, particularly from the young main character. The strange parable of the wild beasts fit perfectly throughout the movie, and as an offbeat coming of age story it works amazingly well. Finally, End of Watch surprised me with the level of quality and realism. A `buddy cop’ movie where the cops actually talk and act like real buddies was a refreshing take on the genre. Yes, the half ‘found footage’ half ‘normal movie’ style grated for a while, but upon consideration I’m giving the movie a pass because the characters were so well done and the story so well presented that it deserves it.

There were plenty of other great movies, honourable mentions are required for **Young Adult, Carnage, Headhunters, Chronicle **and Searching for Sugarman, plus probably others that I’ve forgotten. It was also a good year for more mainstream blockbuster fare, with Hunger Games, The Avengers, Looper and The Dark Knight Rises all impressing over the course of the year.

Unfortunately, having to see so many movies in a year also meant that I watched some unspeakable shit. Anyone involved in these movies needs to have a word with themselves, so, anyone laying claim to anything to do with Man on a LedgeThe Cold Light of DayLockoutMIB3Red LightsLay the FavouriteExpendables 2Taken 2Room 237Gambit, or Abraham Lincoln Vampire Hunter, consider yourself chastised. I’m not even going to grace these poor excuses for movies with reviews, but mostly they were formulaic, poorly written and poorly acted shit. Except for Room 237, which was just a terrible documentary full of utter tripe and conspiracy nuts.

CINEMA - RE-RELEASES

I also watched a number of re-releases that I’d either missed first time around or that were getting special showings. Of these, a few really stand out and had they been released this year would probably be pushing for my best of 2012 list. In no particular order, I found Tyrannosaur, The Skin I Live In, and **Chariots of Fire **to be the best of the movies I saw for the first time as a re-release, while the special showings of both Jaws, and Manhattan, deserve mentions as they are both excellent movies that I could watch over and over again, and have, but that upon re-watching on the big screen gained something new.

HOME VIEWING

Then there’s a bunch of movies I watched at home this year that are worth remarking upon, mostly as I was watching them for the first time and found them to be completely brilliant. Network, Drive, Animal Kingdom, Dr Strangelove, Blue Valentine, Brick, We Need to Talk about Kevin, Shame, Bronson, Barton Fink, and **Moon **are all well worth checking out if you haven’t already.

So, how was the year overall? Well, I watched a number of shit movies that I probably wouldn’t have bothered with previously. I saw a number of great movies that I also perhaps wouldn’t have seen if I wasn’t doing this challenge. I missed a number of movies that I really wanted to see, but just couldn’t fit in or was too fatigued to get to before they left the cinema. On the whole though, I’d say it was a positive thing. So much so, that this year, I’m upping the challenge. 150 movies in the cinema in one year. BRING IT ON.

LaTeX notes and links

February 1, 2013

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)

January 29, 2013

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:

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:

Easy!