The beauty of Pdb

I never used Pdb much. I always thought that I had to run my whole script through the debugger, set some breakpoints through obscure commands and whatnot. But it is not the case. I can do simply this:

#!/usr/bin/env python
do_some_stuff()
import pdb
pdb.set_trace()
do_some_other_stuff()

Now you run your script as usual, and it stops at the pdb.set_trace() line and opens up a Pdb prompt. Then you can go line by line, explore and set variable contents and find out the source of your problem. Great! This approach is convenient and easy to use.

You need to know just a several basic commands to be able to do quite a lot in the Pdb shell. Read this 10-minute introduction, it’s worth it: Debugging in Python

Enjoy.

Flattr this

Desktop notifications in Firefox

At work I usually have a Google Calendar tab open in Firefox to remind me of my personal meetings. In Gnome 2 the reminder would flash the task bar and I would notice it. That is no longer the case in Gnome 3, the notification is no longer present. How to fix that?

Google Chrome has this concept of Desktop notifications. AFAIK it is a public spec, but it is not implemented in Firefox and not even being worked on. What a shame. But wait, have a look at this: https://addons.mozilla.org/en-US/firefox/addon/html-notifications/

Unfortunately that doesn’t work due to a bug. But this version works:

http://code.google.com/p/ff-html5notifications/issues/detail?id=32#c6

Now you just need to enable Gentle Reminders in Labs section of your Google Calendar settings. Voila, it works! It leverages native Gnome 3 notifications (which are far from ideal, but much better than nothing). Hopefully I won’t miss my appointments from now on.

It also works for GMail and other web pages using webkit notifications.

Enjoy.

Flattr this