Where there is a Will

Will McGugan's Blog

I am a freelance software developer living in Glasgow.

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

Background: A code monkey

My cousin Mirren got married recently, and I went to her wedding. I'm not going to bore you with details of people you don't know - this is not one of those blogs. If you are interested though, have a look at the pictures on my flickr page.

A while ago I wrote a chess module for Python. Now this is not a chess-playing module, rather it parses chess moves, stores board positions and works out legal moves. It can also read and write PGN files. I can fairly confidently declare myself as an expert in this kind of thing, having written the PC chess game Chess Commander.

Chess is something that is very well defined, the rules are laid out in black and white, but there are enough juicy problems and gotchas to make it interesting to work on. It was the special case moves such as en passant and castling that were most tricky. I made extensive use of Python's generators extensively which did simplify things a great deal. continue reading…

I love this photo I took - it could almost pass for one of those classic computer graphics images with spheres reflecting spheres, that you would see on the walls of students bedrooms in the 90s. Thank you Sony Cybershot!

Day 2 of my pseudo-holiday led me to the Blue Planet Aquarium, near Chester. Now since I was at an aquarium, you may be expecting pictures of fish. A perfectly reasonable assumption, but you would be dead wrong. It turns out that taking pictures of fish is actually quite difficult to do. The flash reflects off the glass and water, and the little buggers wont stay still. Fortunately there were also bugs* and amphibians to snap.

*Technically speaking, none of the above are bugs. A 'bug' is actualy an insect with sucking mouth-parts. This is one of those little facts that you can quote verbatim in order to appear smarter than you actualy are. I know I do.

My sister visited to day and it gave me the opportunity to go out in Chester and take a few photos with my digital camera. Im not going to bore you with tourist snaps, I'm going to bore you with pretentious arty photos.

I recently mastered behind the back throws. What? You don't believe me?! Well screw you buddy, I have video evidence.

My cactus is in bloom. That's all I have to say about that.

Netstring.py’ is a Python module to encode / decode netstrings. A netstring is a simple protocol for encoding arbitrary strings in a file or datastream. They have the major advantage over the traditional zero terminated strings in that the reader knows the size of the string up front and does not have to examine the data a byte at the time.

There is no documentation for this module other than the docstrings, but hopefuly that should cover it. For more information on the netstring protocol see the official netstring protocol document.