will

Where there is a Will

Will McGugan's Blog

I am a freelance software engineer living in Edinburgh.

I post mostly about tech (particularly Python) and photography.

Background: A code monkey

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'm going away for a week on holiday. I will be back on the 24th. All mail, death-threats, wealthy Nigerian widows and Viagra special offers will go unanswered until then.

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…

In 2005 I released a fun little puzzle game called Ping Ball. It took me 9 months of spare time to write, and I did all the coding down to the hand tuned assembler code for the blitters, and even render the sprites myself with Povray. It was the first project where I used the sub-pixel sprite technique, that I recently replicated in Python. The resolution is only 640x480, but you would swear it was a lot higher. I thought it was a great game, I enjoyed working on it, and I loved playing it. So I assumed I would do well selling it. I was wrong! It sold very few copies, apparently it was too hard for the casual games market, and didn't appeal to more dedicated gamers. *sigh* Here are a couple of screenshots... continue reading…