will

It's All Geek to Me

Posts about technology, with a focus on web development with Python.

I am the author of Beginning Games Development with Python and PyGame.

For the first part series of post, click here for Part I.

Writing a Facebook application is in essence the same as writing any web application, only with an additional step where the output from your web app is processed and inserted in to a Facebook page. Although PHP seems the most popular choice (and is what Facebook itself is written in) you can use any of the Python frameworks to write an app. You could even roll your own if you were so inclined. I used Turbogears, but you could easily adapt this to another Framework. continue reading…

I promised to write up my experiences developing Virtual Microbes, a Facebook application. Its a lot to get through so I've decided to split it up in to installments. This installment is a lightning tour of the components in a Facebook application.

Facebook applications are basically content served up by any http server and seamlessly presented to users within Facebook pages. There are two ways this is done; either with an iframe tag or with Facebook Markup Language (FBML), which is basically HTML with additional tags to access Facebook features. Using an iframe may be the simplest option because you can just serve pages in the way you would with any web application, but FBML offers some additional capabilities that you wouldn't otherwise be able to take advantage of. continue reading…

I hacked together a Facebook application recently. I was looking in to integrating Becontrary.com with Facebook, but I had an idea for a simple app that would help me learn the ropes with FB. Its called Virtual Microbes -- the idea is that you give your friends a virtual disease and encourage them to pass it on. You gain a point each time you give a friend a microbe and each time a friend (or friend of friend) passes it on, which has the potential for exponential growth. Its completely pointless, and couldn't exist outside of the social networking sandbox, but it gave me the opportunity to experiment with integrating Turbogears with Facebook's application system. There was some pain initially, but ultimately it went smoothly. I'll write up my experiences with it, and give away some of the code soon.

Rotonyms are words that ROT-13 in to other words. I discovered the term from this site, which I found during my morning Reddit session. I think the author invented the term, because the only reference I found to 'rotonym' came from his site. Long story short, I knocked out a Python script to find all the rotonyms, given a list of words (just for the heck of it). I like problems like this. Its like the kind of work you had to do in high school and uni, before you enter the real word of programming and discover that most problems have blurry definitions and its hard to tell if your solution actualy works in all cases. Here's the code, let me know if you have a better solution. continue reading…

I have create a google code project for my Python netstring module.

So what is a netstring? A netstring is a way of encoding strings of data in a file or network stream. The classic way of doing this is to terminate the string with a special character, such as carriage return, line-feed or a null byte. But this means that when reading the encoded data you have to check every character in the stream to see if it is the terminator character -- which can be inefficient. It also makes it impossible to encode a string that contains the terminator character, because it will be incorrectly interpreted as the end of the string. Netstrings solve both these problems by encoding the size of the string up-front. continue reading…

Santa Claus. Naughty or Nice? Is Santa a symbol of giving who brings joy to millions or an evil corporate shill who promotes shameless materialism?

Award extra points for arguments that are venomous and vitriolic. We don't want no apologists in this debate!

Peanut butter. Its loaded with calories, but absolutely delicious and goes well with with jelly. But which is better: crunchy or smooth?

Extra points will be awarded for arguments that involve religion or politics! Voters - if an argument skillfully brings up the topic of the Iraq war, give it an extra point!

Just read an interesting blog post about comparing Python and Haskell code to calculate the Fibonacci sequence. I wrote a faster version, just for the hell of it. I realise that it is not a fair comparison any more, and doesn't prove anything, but it does demonstrate a useful optimization technique. Here's the code...

When I run it on my machine, it claims to take 0.00000 seconds. Damn, thats fast!

My employer has placed a number of bounties for wxPython features. Pays cash!

I got a bad review of my book on Amazon.com. I wanted to post a comment to address his points, but Amazon told me that I must have purchased an item to post -- which I have (many times)! So I thought I would post my comment here (below).

I'm the author of Beginning Game Development with Python and Pygame. Let me take a moment to comment on your scathing review.

1) As the title of the book indicates, the book is intended for beginners. As such there is an introduction to Python in the first two chapters. A total of 30 pages out of approximately 300. I don't think this is unreasonable. continue reading…