Friday, January 30, 2009

edendb - A thin, flexible and fast python DBAPI wrapper for those who like SQL but don't like to type

If you are like me, you have looked for ways to make connecting to database from your python code easier and less painful.

For a long time I looked into the myriad ORMs available for python and they all seemed to be overkill for me. I don't mind using SQL. In fact I like it, but when putting it into python code and using the DBAPI I found my productivity was declining. I needed something to make executing sql commands faster and easier from python code. I needed something abstracted away from the DBAPI, but that also allowed me to execute straight sql if needed and easily handle all the possible values that could be returned.

So, I wrote a python library to do it.

Meet edendb!

Check it out and let me know what you think.

Thursday, January 29, 2009

Google Talk on Ubuntu Linux

Chat, Voip calls, system tray, Excellent!

http://jamesselvakumar.wordpress.com/2008/11/17/good-news-for-google-talk-users-on-linux/

Thursday, January 22, 2009

How to configure mutt to use Gmail as smtp and imap server

The following helped me the most when configuring this.

http://shreevatsa.wordpress.com/2007/07/31/using-gmail-with-mutt-the-minimal-way/

The only thing I changed was

set postponed =~/Mail/Drafts

so that I could write messages offline and then send them when I get back to an internet connection.

I can't wait to try this out on my Asus Eeepc 2G Surf

Tuesday, January 20, 2009

Creating an application to insert events into Google Calendar

Here is how you can create a quick command-line application in python that will post events into Google Calendar.
  1. Get a Google Calendar account (go here to get one).
  2. Install the python gdata client which you can get from here.
  3. Find out the url to use to post to your calendars. To do that just go to this url and then view the source of the xml document that it returns to you. Each of your google calendars will be listed with the url that you need to use for each one. Remove the 'http://www.google.com' part of the url when you use it in your code.
  4. Write up some code to post with. Here is an example.
import gdata.calendar.service
import gdata.calendar
import atom

def add_to_gcal(item):
cal_client = gdata.calendar.service.CalendarService()
cal_client.email = 'youremail@gmail.com'
cal_client.password = 'yourpassword'
cal_client.ProgrammaticLogin()

event = gdata.calendar.CalendarEventEntry()
event.content = atom.Content(text=item)
event.quick_add = gdata.calendar.QuickAdd(value='true');

new_event = cal_client.InsertEvent(event, 'url from step 3 above')

add_to_gcal('Dentist Appt today at 4pm')
print "Your event was created"
There you have it.

Pretty Printing XML in Ubuntu on the command line

Ever wanted a quick and easy way to reformat xml so that it is more readable?

In ubuntu just do this.

sudo aptitude install xml-twig-tools

Then you have a nice little program called xml_pp with which you can easily format xml documents.

Use it like this.

xml_pp document.xml | less

Saturday, January 17, 2009

Gears 64 Bit in Unbuntu Intrepid (8.10)

Gears (formally called Google Gears) does not (yet!) officially support 64 bit builds for linux/Ubuntu.

But, I have found that there has been significant work in the open source community to overcome this shortcoming with unofficial builds/patches.

Here are some links to background.
- http://groups.google.com/group/gears-users/browse_thread/thread/4584842dd14a4882?pli=1
- http://code.google.com/p/gears/issues/detail?id=335

Here is the link to the one that work for me.
- http://dev.laptop.org/~joel/gears/
- I used the latest version as of this writing which is gears-linux-opt-0.5.11+r3162_FIREFOX3_ONLY.xpi
- Works in Kubuntu 8.10 Intrepid with Firefox 3
- When you go to a page that has Gears capability, just try to enable and click the install button (even though it is already installed) and it will skip the installation and enable gears for that page.

Ubuntu 64bit

My Employer just gave me a new laptop to use with a shiny dual core, 64bit processor!

I installed Ubuntu 8.10 in both 32 bit and 64 bit versions and played with each just to get a feel of which is faster and to see if 64bit would be more trouble than it was worth.

I have to say that I DO notice a difference in speed in the 64 bit version.
- This may be only the placebo affect, but I don't care, it feels faster!

The only downside I have seen to it is there are a few applications that are just not yet available in 64 bit versions.
- The most important of which for me is Gears (formally called Google Gears) as I like to use a few key offline applications (read Remember The Milk).

Next post I'll show you how I got around the gears problem.