Thanks to everyone who enjoyed and commented on my talk today titled ‘Accelerate Your Game Development with Pyglet’. I am happy to see so much enthusiasm within the python community for game development. This was my first lightning talk (and the first one for the day as well) and though, I slightly overshot the timelimit, it was a great experience.
The talk was about creating a simple casual game using Pyglet called ‘FruitCatch’. The source code is really small and very readable. I also compared Pyglet with Pygame and why I prefer Pyglet (in certain situations:)). The demo showed the working game in the end.
You can download the game source code and presentation slides (PDF) here. I’ve shared this with the organisers as well, so it will be put up at the http://in.pycon.org/ site as well
UPDATE: The video of the [lightning talk][videolink] is now available and has been added below:
This weekend I was pretty productive. Among other things, I was able to perform a much needed upgrade for my laptop after my hard disk crashed and to bring it at par to the prevailing standards, as well. I bought a 320 GB hard disk (up from 100 GB) and added a RAM module bringing the total RAM to 2.5 GB (up from 1 GB). So it’s a Big Deal :D
While purchasing the hard disk, I was sure that I don’t need it to fill it up with lots of data (like movies or songs). I would rather use my external hard disk for that. I had planned to use majority of the space for Linuxes (is that the correct plural form?). Why not Windows, you may ask. Especially with the snazzy Windows 7 being already available for Beta?
Well the reasons are quite simple. Firstly, too many viruses and malware. Especially, if you have removable storage like pendrives or CDs. Next, it’s not very stable. Though Windows XP is a comparatively stable member of the Windows family, I have had more than my share of screen freezes and blue screens. This causes bad sectors and reduces the life of your hard disk. Next, most of the apps I use are open source anyways – Firefox, Open Office, GIMP, Inkscape, Emacs, Foxit etc. Then why not run the same in a better OS like Linux? Lastly, distributions like Ubuntu have become really user-friendly. Vidya and many others who use my laptop really don’t find it difficult or inconvenient to use.
Well, you must have noticed the plural form of Linux I’d used. This weekend I installed the following OSes and they are all working fine:
- Ubuntu (Jaunty): Perfect for most multimedia and productivity apps
- Fedora 11: For trying out Java apps and other enterprisey stuff
- Arch Linux: An ideal hacker’s OS
- Windows XP: For the necessary evils like movie playback
- FreeDOS: This is the good ol’ DOS. For classic DOS games and simple low level programming
I am planning to add a couple of more varied distributions. I am currently thinking of adding Puppy Linux and Rescue CD. Any suggestions?
This Saturday, I started working on something that many of my colleagues had complained about a long time ago. They work on reports all the time and most of these reports have small changes in each version. They are only interested in seeing what changed rather than read the entire report.
You might suggest a lot of ‘diff’ tools which can do the job in either Word or Textpad. The issue was that they were working with Excel spreadsheets rather than text files and I couldn’t find any free or open source solution for them. So I ended up creating a new tool called Office Diff. Interestingly, it handles not just Excel, but also all the Office 2007 and 2003 file formats plus PDF and HTML formats as well. It features an intuitive GUI interface and is completely written in Python.
The next best thing was to open source it. I am using the BSD licence. I found sourceforge a good choice because they support Bazaar, my version control of choice at the moment.
Please visit Office Diff homepage for screenshots and check out the first release.
Old habits die hard. Whenever we have to send huge attachments; the wise ones used to say ‘Don’t clog their mailbox, zip it and send it’. Everyone religiously used to follow the rule and every word document, presentation or excel sheet was zipped before sending. The zipped file would be a good 40% smaller. The mails would reach faster and everyone would be happy in the process.
Fast forward to 2009, most people now use Office 2007. The new Office is vastly more ….well…new and the preferred file formats all have changed. There is a x at the end of the all filenames so we have .docx, .pptx and .xlsx floating all over the place (how do you pronounce these anyways?!). The documents are still religiously sent as zipped files. Except there is no 40% reduction. Actually it isn’t even 10%. Why?
Because you cannot zip a file that’s already zipped. Yep…. all the new office documents are already zipped anyways. You can even open them using Winzip by simply renaming their extensions to .zip.
So folks, next time you mail someone, don’t bother to zip it. There is only the added annoyance of the recipient having to unzip before opening the file.
Tony Collins has compiled a list of Project Management facts which might very well be the ‘Mythical Man-Month’ for the new era. It explains why so many IT projects fail so aptly that I had to reproduce it here:
Projects with realistic budgets and timetables don’t get approved
Activity in the early stages should be dedicated to finding the correct questions
The more desperate the situation the more optimistic the progress report
A user is somebody who rejects the system because it’s what he asked for
The difference between project success and failure is a good PR company
Nothing is impossible for the person who doesn’t have to do it
Every failing, overly ambitious project, has at its heart a series of successful small ones trying to escape
A freeze on change melts whenever heat is applied
There’s never enough time to do it right first time
You understood what I said, not what I meant
If you don’t know where you’re going, just talk about specifics
If at first you don’t succeed, rename the project
Everyone wants a strong project manager – until they get him
Only idiots own up to what they really know (thank you to President Nixon)
The worst project managers sleep at night
A failing project has benefits which are always spoken of in the future tense
Projects don’t fail in the end; they fail at conception
Visions are usually treatable
Overly ambitious projects can never fail if they have a beginning, middle and no end
In government we never punish error, only its disclosure
The most difficult way is, in the long run, the easiest
A realist is one who’s presciently disappointed in the future
I am pretty sure most of us can relate to these ;)
Most of you must have read the news that Google finally jumped into the Twitter Bandwagon. In their trademark style, they have chosen to announce this in a cryptic way. Their first tweet was essentially this:
I’m 01100110 01100101 01100101 01101100 01101001 01101110 01100111 00100000 01101100 01110101 01100011 01101011 01111001 00001010
I will explain in this post how to crack this simple code with the help of some Python one-liners (Google’s favourite language). If you are a Google aspirant (who isn’t? ;) ), this might help you clear the interview. So pay attention.
To most people it is immediately obvious that it is a text encoded in binary. Since each binary word is 8 characters long, it is most probably written in the extended 8-bit ASCII code. In fact, it is and you can read this with a simple ASCII chart.
But they have made it slightly difficult for you by writing in binary. Since most charts would provide you a lookup from decimal or hexadecimal numbers to ASCII representations only. So how do you convert from binary to decimal? It’s quite simple:
decimal = lambda s: sum(int(j) * pow(2,i) for i,j in enumerate(reversed(s)))
This line defines a function decimal which works in a manner similar to how we would manually convert binary numbers into decimal. Each position is multiplied by increasing powers of two from the right. Then, these numbers are added together. for e.g. ‘1010′ will be 1 * 8 + 0 * 4 + 1 * 2 + 0 * 1 = 10.
Next, we split the binary part of the tweet string and apply the decimal function on each part
tweet = "01100110 01100101 01100101 01101100 01101001 01101110 01100111 00100000 01101100 01110101 01100011 01101011 01111001 00001010"
print ''.join(chr(decimal(s)) for s in tweet.split())
The result is something that you might have already guessed seeing the first 2 words:
“I’m feeling lucky\n”
Hope you learnt some interesting python constructs. If there are other ways of decoding this in Python, please comment below.
Q. What’s the Difference between Cloud Computing & SaaS?
A. It is the same as the difference between TV and Cable TV. TV is a technology. However, Cable TV is a business model using this technology.
Cloud Computing refers to an architecture where web applications can scale easily to any number of users. Software as a Service (SaaS) is a business model where computing software is provided in a ‘pay as you use’ model. SaaS is often built using Cloud Computing. But all Cloud Computing apps don’t use the SaaS model.
Therefore Cloud Computing != SaaS
Have to even seen yourself briefly other than in your own reflection? Have you ever wondered if there are other people who are identical to you in appearance but nowhere related to you? There is a word for it – Doppelgänger. As per Wikipedia:
…They are generally regarded as harbingers of bad luck. In some traditions, a doppelgänger seen by a person’s friends or relatives portends illness or danger, while seeing one’s own doppelgänger is an omen of death. In Norse mythology, a vardøger is a ghostly double who precedes a living person and is seen performing their actions in advance.
There also a Malayalam movie called Aparan based on this concept. It is the first film of the actor Jayaram by the acclaimed Director/Writer Padmarajan. In the film, the doppelgänger truly upturns the protagonist’s life. However, there are no double role gimmicks employed. The presentation is very sensitive and gripping.
In this era of cloning, any part of your body – split hair or even saliva can be used to create an entire replica of yours. Gene therapy may soon make this a reality. Will your clone bring you bad luck as some Hollywood movies predict? Most likely, because most people wouldn’t enjoy the company of someone with exactly the same nature as yours. Even worse he or she will covet the same things you would covet. This could mean you will be competing with your clone in many spheres of your life for e.g. dating. And the winner would be, most probably, based on chance because your skills/qualities are evenly matched. A little frustrating isn’t it?
Whoever said Imitation is the most sincere form of Flattery, most certainly didn’t think of clones!
Reddit had a heated debate about the AJAX paging pattern. The debate sidetracked into the benefits of Paging. Nobody seemed to mention the excellent greasemonkey script Autopagerize which is proof that the concept works brilliantly. I find it one of the most indispensable Greasemonkey scripts available today.
The idea is simple. Assume you are reading a blog in blogspot.com. When you scroll towards the end of the blog, Autopagerize realizes that you are really interested in reading more blog posts. In other words, soon you would click on ‘Older Entries’ links. This would have caused a fresh page to load. How terribly annoying! Instead, Autopagerize will silently load the older posts in the background and seamlessly add them to the end of the page. By the time you finish reading the second page, the third page will be added to the end and so on and so forth. This results in a smooth and breezy browsing experience, which has to be experienced to be believed.
Installing Autopagerize
Autopagerize uses greasemonkey plugin and hence works only if you have Firefox installed. The steps are quite simple:
- Install Greasemonkey
- Go to Autopagerize script page and click on ‘Install this Script’ button
- Visit any of the supported sites e.g. stackoverflow.com or a blog like simblog
- If the page supports Autopagerize, a green square will appear at the top right of the page. Scroll to the end and it will momentarily turn blue to indicate that the next page is loading in the background.

How does Autopagerize work?
Autopagerize works on all kinds of sites which have pages. But how does it manage to understand the structure of them all? The answer is the community maintained SITEINFO database which is the result of hundreds of hours of effort.
Autopagerize is turned on for a particular site if its URL matches the url property. Once the page is loaded, it searches for the next link based on the xpath provided by nextLink property. The next page’s content is identified by the pageElement property. Anything which is not part of this content is discarded. This content is then appended to the existing page either by appending as a sibling to the existing pageElement or if insertBefore is defined, it is inserted before the element identified by insertBefore property.
How to Add any Website to Autopagerize?
Note: This is not for the faint of heart. It involves opening and working with some code (to the extend of editing some regular expressions).
So you would like extend the Autopagerize experience to more and more sites? Don’t worry, you have come to the right place. For this section you would need to install the excellent Firebug plugin. Firebug’s javascript console is the best interactive XPath debugger I am aware of.
It is the first Onam in our flat and we thought, why not go full traditional? The floral carpet took a couple of hours of dedicated effort in the wee hours of morning. So, was it worth the effort? Check it out:
Math Behind the Scenes
Well, there is a bit of geometry involved in a pookalam unless you are willing to spend a lot of time improvising. Like a good piece of engineering, a good design was essential. Here are some of the mockups made using Inkscape:
The Sadhya this time was at Prestige Hotel. Was pretty good with 3 different kinds of Payasam. Now time to munch some banana chips ;)


