One feature that Python’s built-in string replacement facilities does not provide is case-insensitive string replacement. This is a reasonably useful construct (that I use fairly frequently in other languages, such as PHP), which I couldn’t find code for after Googling — so here’s some code that does it (licenced under the WTFPL, of course)
import re def ireplace(self,old,new,count=0): ''' Behaves like string.replace(), but does so in a case-insensitive fashion. ''' pattern = re.compile(re.escape(old),re.I) return re.sub(pattern,new,self,count)
You can also subclass str in order to use it as a bound method:
import re class str_cir(str): ''' A string with a built-in case-insensitive replacement method ''' def ireplace(self,old,new,count=0): ''' Behaves like S.replace(), but does so in a case-insensitive fashion. ''' pattern = re.compile(re.escape(old),re.I) return re.sub(pattern,new,self,count)
I generally have a policy of not allowing Flash onto my website (and sorry if any of you PLOAers object), but this opportunity was hard to pass up. Toni Westbrook has written Shredz64, a Guitar Hero-like-game for the Commodore 64. Following is part 2 of his video (the first part take a long time for him to get going, so I’ve not posted it here).
Today was the AGM for the UTas Internet Developers’ Society. Other than the usual blather that occurs in AGMs for these sorts of things, we’ve approved a change of name to TUCS (or rather the Tasmania University (union) Computing Society). For the moment this name change is purely cosmetic (as we really haven’t done that much in the way of Internet Development for as long as I’ve been at the Uni. The new name (in my opinion) reflects the membership, and the aims of the society a lot better.
One item of Business that I raised was the upcoming Linux.conf.au 2009, which you probably already know by now is being held at the University of Tasmania in Hobart. It’s been resolved that the Society establish better ties with the Free Software/Open Source Community (in Tasmania, in Particular with TasLUG) with the intention of better promoting Free/Open Source software amongst the student and staff body in the leadup to the conference; and I ran for the executive (successfully) on that basis.
Here’s hoping it’s a successful year for the society (which now has a cool name!)
I had dinner at my Grandparents’ place last night, they live on the waterfront in Lindisfarne, and as the evening was clear and still, I took an opportunity to go and take some photographs. Here are some of my favourites: