Tag Archives: python

Algorithms in Python: Binary Operations

Today I’d like to demonstrate a simple implementation of Kenneth Rosen‘s binary addition and multiplication algorithms as outlined in "Discrete Mathematics and its Applications". Both algorithms are very simple and work the same way we’ve all learned to do decimal … Continue reading

Posted in Computer Science, Programming, tech | Tagged , , , , | Leave a comment

Algorithms in Python: Base Expansion

I felt it would be helpful to folks interested in Python and studying algorithms, to review some commonly studied algorithms in Computer Science by providing a small description and a Python implementation of each algorithm. This week, we’ll cover an … Continue reading

Posted in Programming, tech | Tagged , , , , | Leave a comment

Django Context Processors Best Practice

In this post, i’ll show you a simple trick to ensure your Django context-processors don’t break when Django 1.2 (and possibly future releases as well) is released. If you’re not familiar with the concept of context-processors, I’ll also explain what … Continue reading

Posted in Django, Web Development, Web Frameworks, tech | Tagged , , , , | Leave a comment

Extending PostgreSQL with Python

One of the features I enjoy the most about PostgreSQL is the ability to write stored procedures in C, Perl, TCL, PgSQL, and yes… obviously also in Python. I’ve been using this feature since 7.4, so any recent version of … Continue reading

Posted in Databases, linux, tech, unix | Tagged , , , , , , | 2 Comments

Fixing custom sequences in PostgreSQL

PostgreSQL provides a mechanism called sequences, which I believe is extracted from ANSI-SQL92, though I’m too lazy to check, which are basically stateful counters that provide some helper functions. The primary use of sequences in PostgreSQL and Oracle, is to … Continue reading

Posted in Databases, linux, tech, unix | Tagged , , , , | Leave a comment