Ur_Fry

Photo from the YourFry hackathon

Penguin organised a bunch of hackathons to celebrate the latest instalment of Stephen Fry's autobiography, and I went to the one they held in the Bodleian in October. I was in a team of awesome programmers, artists, and scientists, and we put together a website. You can visit it at yourfry.bethmcmillan.com, or watch my hastily-constructed youtube video. My main contributions were a bit of web development (I can't take any credit for the design, the perl, the content, or the cluster analysis, though) and another one of my silly twitter bots, @ur_fry.

@ur_fry works just like my old @markov_holmes bot, with a few changes. We used the text of the complete works of Stephen Fry as training data - from which I didn't manage to strip out page numbers and other messy things. The text creation works backwards, by starting with the end of a sentence. This makes them end more sensibly, but makes the beginnings a little sillier. I'm not sure which way around is best.

You could have a look at the source of the main page, but it might be easier to see my simplified version. The fun things that I used for the page were d3-cloud to make tag clouds from the cluster analysis of Fry's books, and draggable.ui to make the text boxes draggable around the screen.

The thing I'm the most proud of is how the boxes come to the front when you click on them. The way this works is using z-indices, which are the way that elements are stacked in CSS. What happens here is that every time an element is clicked on, its z-index is increased to above the current highest element. This works using JavaScript - the original z-index is set in the head of the page like so:

<script>
$(function() {
  window.zed = 3;
});
</script>

This index is assigned to an element when it's clicked, and then incremented for the next time, using onMouseDown commands like this:

<div class="headline" id="c" onMouseDown='document.getElementById("c").style.zIndex = window.zed ;window.zed+=1;'>

I don't speak JavaScript very often (and this was actually dynamically generated using Perl, which I have only previously used under duress), so this was a fun departure for me.

Stephen Fry even turned up later in the day to have a wander around and talk to people. In between quietly hyperventilating with the joy of meeting my hero, I spent a few minutes talking to him about Markov chains while he looked at me kindly. Reading his books, watching A Bit of Fry and Laurie, and listening to Saturday Night Fry when I was growing up made me feel infinitely less alone, so meeting him in person was cool.

Soupy twist!

p.s. If you have any questions about how to use the bits and bobs in the webpage yourself, I'd be happy to answer them.

...

One thought on “Ur_Fry”

  1. Dude! I've nominated you (read: you used my invitation and nominated yourself) for a Liebster Award! Check it one time pon mablog.

    You're totally awesome and I <3 you

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.