University of Moratuwa tops GSOC 2009

University of Moratuwa has been able to top the Google Summer of Code program, yet again. With 22 participating students university of Moratuwa was far ahead from the second place, University of Campinas Brazil which had 12 participating students. I’m glad i was a part of this success. Here are some stats of GSOC 2009.

Debugging in Python

Python has a simple yet powerful builtin module for debugging called pdb. Using this module you can debug your python code easily even without any IDE.

1. First step is to import the pdb module

2. Next step is to mark the entry point where the debugger would be called in. We use the set_trace() method for that.

3. When the program is run the execution would stop at the set_trace() method and would wait for debugging commands.

4. To run the next statment enter ‘n’ or ‘next’

5. To print a variable enter ‘pp variable_name’

6. To run until exit enter ‘c’ or ‘continue’

7. To display the current location enter ‘l’ or ‘list’
This would display an appropiate part of the source code with a pointer to the current statement.

8. To step into a method enter ‘s’ or ‘step’ when debugger is met with a method

9. To insert a break point enter ‘b filename:linenumber’

10. You can also dynamically assign values into variables.
Let’s assume there is a variable called num initialized to 10. You want to see what would happen when that variable is initialized to 20. You just do this. (pdb) num = 20 and then enter ‘n’ to execute next statement or enter ‘c’ to execute program until the end.

An example would look like this

import pdb

def method():
i = 10
name = ‘kasun’
last_letter = name[-1]

last_num = ord(last_letter)

print ‘last_num is’, last_num
if __name__ == ‘__main__’:

When Linux crashes

Yes Linux been another piece of software, gets crashed once in a while. Once I used to work with a Ubuntu machine that after 10 hours of work would always get stuck when trying to shutdown. Luckily for Linux users there are some options before reaching for the power button.

You can use a sequence of <alt + sysreq(Prnt Scrn) + key> to issue commands straight into the kernel even when the system is in a total non responsive state.

For example the following sequence of commands can rescue you from a crash and would execute a safe reboot.

ALT + SysReq + r
ALT + SysReq + s
ALT + SysReq + e
ALT + SysReq + i
ALT + SysReq + u
ALT + SysReq + b

Here you can find what each command actually does.

For the easiness of remembering the commands, the idiom, ‘Raising Skinny Elephant Is Utterly Boring’ is used.

Remember that the above commands would only work when the system is in a non-responsive state. Otherwise it would just throw a bunch of print screen windows at you.

What if by Ron Paul

Ron Paul is one of those rare politicians who make sense more often than not but find it hard to make a big enough impact to actually change the status-quo. Why? I don’t know, maybe this whole democracy thing is a delusion, maybe you always need some special interest group behind you to win an election.

I found this speech by Ron Paul, a very thoughtful speech indeed.

These are the most interesting points I found in the speech.

  • What if we wake up one day and realize that terrorist threat is a predictable consequence of our meddling in the affairs of others.
  • What if conservatives who preach smaller government wake up and realize that our interventionist foreign policy provides the greatest incentive to expand the government.
  • What if we as a nation came to realize that the quest for empires eventually destroys all great nations.
  • What if Christianity actually preaches peace and not preventive wars of aggression.
  • What if diplomacy is found to be superior to bombs and bribes.

Ahmadinejad’s win

Contrary to the hopes of West and anyone like me who would not mind a saner regime anywhere in the world that maybe, Ahmadinejad have won the Iranian presidential election and in a landslide too. There are stories of vote rigging and many malpractices but you should always think twice when Western media report on Iran. Whatever the malpractices that were supposedly took place, the win is convincing enough for me.

What I was thinking was actually who would welcome Ahmadinejads win?Of course other than the public of Iran. Ultra nationalist Zionists of Israel could keep using Iran’s nuclear threat to come to power and keep refusing any reasonable middle ground regarding the problems of Palestinians. Neocons in USA who don’t want to see any dialog between USA and Iran would find a very good excuse. Then of course is the religious conservative, terror loving, ruling elite of Tehran, who could keep ignoring reforms and modernity for Iranians and continue on their imaginary revolutions and destabilization of their neighbors. It is very interesting how hardliners in opposite sides of the line could rely on each other for their survival.

The bright side of story? Looks like the majority behind the reformist opposition had been youth and students. Would the next generation be able to take Iran, a country with a wonderful History that had done so much for the human civilazation on a more secular, modern path? Time will tell.

I am on GitHub

Github is a web based project hosting service based on git that has social networking concepts embedded into it. They call it Social Coding. Apart from standard version control facilities github includes social networking features like RSS feeds and followers. Currently I have the GSOC 2009 project hosted in github and hopefully many more in the future.

You can follow my social codings at

My silly quotes – 4

Democracy is the biggest delusion of our time.