Blog

GWT, Django, and JSON (with padding)

August 8, 2011

A couple of months ago I was working on a project where I needed to retrieve data in JSON format from a web service written in Python (using the Django web framework) under GWT. The data is then loaded into GXT/Ext GWT grids and charts.

After looking at a GXT example of loading JSON data to a grid, I thought this would be pretty straightforward, but of course I was wrong. Since the Django …

Extra secure, automated, offsite backup with TrueCrypt and Dropbox

August 3, 2011

I love Dropbox, it really does simplify my life.

If you’ve never used Dropbox before, you should definitely check it out as it’s a very painless way to synchronize files from multiple computers and supports all major operating systems, including mobile platforms (it’s free for up to 2GB). Your data is stored offsite so if someone breaks in to your home, steals your computer and that external hard drive lying next to it where …

How to convert a list of dictionaries to CSV format in Python

July 26, 2011

I was working on something last night where I needed to dump JSON data to a text file. I figured it might be a good idea to give an option to export it to a CSV file with headers as well so I wrote this simple function to do so:

import csv

def export_dict_list_to_csv(data, filename):
    with open(filename, 'wb') as f:
        # Assuming that all dictionaries in the list have the same keys.
        headers = sorted([k …

Windows Tip: Run applications in the background using Task Scheduler

July 21, 2011

I was working on a project a couple of weeks ago which involves Celery for processing tasks. I wanted the Celery process to run in the background as a service but it didn’t come with a Windows service installer, we will have to write our own. Since we were still just working on a proof of concept, I didn’t want to spend too much time on this at this point and then I realized I …

How to use client certificate authentication with Suds

July 15, 2011

This is related to my last post. I was finally able to communicate to an SSL-enabled SOAP service with my computer behind a proxy but then ran into another problem: certificate-based authentication.

Suds actually doesn’t support certificate authentication directly, but fortunately someone created a custom transport for it here.

I tried his code but then ran into connection issues again, I had to modify it a little bit to include the proxy settings …