Programming Blog

Programming related articles.

Advanced json manipulation with python

Python provides really simple api for json manipulation. Here is some code that does basic json to python conversation...

Convert python dict to xml

Among all those terrible technologies, I hate the DOM API most. It accomplishes simple tasks with most complicated way possible. So Instead of manipulating XML with DOM API I wrote a simple python dict to XML converter which converts dictionary structures to python minidom object or xml string.

How to convert python tuple to dict

Sometimes you might need to convert tuple (or list) to dict object to make it more readable. After all l['product_id'] is more readable than l[4]...

Django ORM performance tips - part 2

This is the second part of the two-part series. First part can be found here. Here are some more tips that every django developer should know in order to write faster apps....

Pretty printing JSON output in terminal

If you need to pretty print the json output of a terminal command (so you can inspect it more easily), you can use python's json module. I usually use it to pretty print the output of curl command. Here is an example

    curl | python -m json.tool

This utility can also be used to pretty print json files like following

    python -m json.tool minified.json > prettyprint.json

Django ORM performance tips - part 1

This blog post will be split into two part. After I finish part two, I will add a link at the bottom of this one. For both parts I will use a sample project with sqlite3 database. file for sample application is here...