Debugging email sending in your Web application is always tricky as you need a working SMTP and you also need to watch out that you don’t accidently spam real users (if you’re working on a local copy of real database).
There is a neat one liner that acts as a “sink smtpd” server, meaning that it implements SMTP protocol, so you app can communicate with it, while printing everything it receives on screen:
I’m working on some visualizations and I want to achieve the look of Last.fm visualization lastgraph3:
The great thing about this is that Andew Godwin, author of the site open sourced the underlying library – Graphication.
Since I’m an OS X user, I decided to make the whole thing work on my system – Leopard 10.5.6 at the time of this writing. Here are the notes, mostly for my reference and because it might be also useful to others:
- you’ll need to edit cairo/Makefile.in file by modifying parameter _cairo_la_LDFLAGS (around line 215) to remove ‘-export-symbols-regex init_cairo’
(thanks Michael Dales)
- just follow INSTALL file. Essential running:
./configure –prefix=/System/Library/Frameworks/Python.framework/Versions/2.5 (sys.path for my system)
and then make && sudo make install
Now you can finally build and install Graphication package
All the installations steps are just ./configure && make && sudo make install and just work out of the box. I already have Python PIL installed from sources and I think you need this for one of the steps, but I’m not sure anymore for which one.
After you go through all the steps, you can start drawing something like that:
Now to figure out how to create something meaningful with it.
Saturdays are the days for hacking (after having a great run earlier of course). This time I’ve been preparing a network data set for a friend. The idea was to take a look at who follows who on Koornk.
This is what I’ve got after a productive afternoon:
I’ve only followed nodes that can be found by starting with Matija as initial node. Quick look at the resulted graph, we can see that their is a well connected group of people in a middle, with another group that is only partially connected to the first group. There are of course many others who are not well connected.
As this is only first prototype, there are a few more things to do on some other nice Saturday:
figure out a way to get list of all nicknames (one way would be to just go through the list of messages)
weight different connections, based on who’s talking to who
interpret the data (but since that’s not my homework, I hope the recipient of data set will want to do a guest-blog about this)
While building something nice on Koornk (Slovenian Twitter like service), I stopped for a few months to learn how to do Authenticated POST requests using Python. I found urllib2 way too complicated, but soon I stumbled across great Yahoo Developer page – Make Yahoo! Web Service REST calls with Python that also lists alternative approach using httplib2 which then works beautifully.
Most of my readers are by now probably already aware of Wordle, Java applet, that allows neat visualization tags. Given that Zemanta released early alpha API preview recently, I was looking for a fun project to showcase some of it.
So for this experiment I’m going to try to visualize some of the popular classic books, using text files of Gutenberg project. Technical details at the bottom of the post.
Jane Austen – Pride and Prejudice
Herman Melville – Moby-Dick
George Orwell – 1984
The whole process is done using a simple python script. The script reads in the text file, breaks it into chunks of 360 words, as is roughly one A5 page and then sends it to Zemanta API. It repeats this process for first 30 thousand words of the book. The limit is arbitrary, I just didn’t want to run the script for too long.
Afterward, the text was manually pasted into Wordle and I played with random function and details until I started to like the image. You can also take a look at my full Wordle gallery.
I’m especially happy how 1984 turned out. For this kind of visualization it’s important to choose source carefuly, so you can get more powerful results that way. I’ll probably continue experimenting with this on 1984 text.