If you have noticed, there are now icons next to each comments link. These are provided, free of cost, by famfamfam.com. If some 16x16 icons are needed, and you are not graphically or creatively inclined, this is your one-stop-shop.
In other news, a Speed graph has been added to the running page as well as a distance graph. In doing that, I ran into a problem which was hard to debug, since it only happens on the live site. In Django, trying to serialize a Numeric data type with simplejson will not work, so make sure to cast it to a python-native data type first.
Problem code:
i = 0
for run in runs:
distance = run.distance()
speed_data.append((i,distance/run.time))
distance_data.append((i,distance))
i = i + 1
Solution:
i = 0
for run in runs:
distance = run.distance()
speed_data.append((i,distance/float(run.time)))
distance_data.append((i,distance))
i = i + 1
I also noticed a problem with my Pygments function, due to the regular expression, where it only allowed me to post one code snippet. As you can see in this post, that has been fixed (although it was another particularly nasty bug to track down, and required a complete refactoring of my code in the end).
Hello all! I have finally put my new website up for the world to see! I'm still not much for designing the look and feel of websites, but after learning all about Django, I felt like I just had to update my website to use Django.
Under the hood, there is low-level caching being done on both the Digg RSS feed and the Yahoo Flickr feed. There are two RSS feeds available for the site: new blog posts, and new run information. To show the graph under runs, I've used some AJAX to get the running data dynamically and create the graph with javascript. Finally, I've created a custom Django template tag to allow me to post syntax-highlighted code using Pygments.
Example of pygmentized code (the one from this site, actually, that gets my latest digg articles):
def get_digg_rss():
d = feedparser.parse('http://www.digg.com/rss/floguy/index2.xml')
dugg_dicts = cache.get('dugg_dicts')
if dugg_dicts == None:
print "Had to re-fetch digg links"
dugg_dicts = []
for entry in d.entries:
dugg_dicts.append({'title':entry.title, 'link':entry.link})
cache.set('dugg_dicts', dugg_dicts, 60*60)
return dugg_dicts
I hope that you all enjoy the website, and I also hope that you'll begin to frequent it, because I'll be keeping it up-to-date with the goings-on of my professional life.
All Content

