Useful Python snippet #1

Found this useful Python snippet in Python Essential Reference by David M.Beazley today. It seems you can write to files in a similar way to how you would with IOStream in C++ by using the ‘>>’ syntax.

Example

f = open('out.txt', 'w')
print >>f, 'Hello, World'
f.close()

Unfortunately this only works in Python 2.x, and will break in Python 3 — so perhaps it is best left alone. Nonetheless, it’s a feature I didn’t realize before today!

New release of hangman.cpp

Four years ago I wrote a script with Brandon Kite to demonstrate vectors (and to make a text based while learning C++). It was released shortly afterwards, just for the hell of it, even though it was certainly nothing special.

Anyways, four years later, and it is still online. I just came across it again and updated it from version 0.1 to 0.2.

You can find it on the scripts page, or download it from pastebin.

Blog back up (again!)

My site/blog has been down in recent months as my old domain (kahrn.com) expired. I have now moved the blog over to this new domain (rickyhewitt.com).

I have also opted to use WordPress as the main platform for my site form now on, dropping my custom scripting and CodeIgniter.

I haven’t really had a chance to update much of the blog, so some of the stuff will be broken, and I have also lost a few posts which were made last year. Hopefully I will have some time to update some of the old content, and also add some of the new content of which I have planned.

Take note that some of the content/scripts/applications/etc on this site are very old, and will likely be broken until I take a look. I will also be using the default WordPress theme until I have the time to develop my own.

Until then, if you have an iPad, go download some free iPad Wallpapers from http://ipadwalls.net!