Tag Archives: python

Hadoop example for Exim logs with Python.

The following is an example of parsing an exim_mainlog using Hadoop streaming. I’ve implemented both the mapper and the reducer in Python. The mapper and reducer don’t handle all of Exim’s log formats yet but this can be easily extended in the mapper and reducer if you actually end up using the output (this is [...]
Posted in Programming | Also tagged , , | Comments closed

Heap sort in Python.

Here is an example of heapsort in Python. This sorting method happens to be my favorite of the bunch – I like to think that this is the most elegant sorting method, but I’m sure you could argue against me. Edit: I renamed percolateDown to percolateUp because I realized its really more of a “move [...]
Posted in Programming | Also tagged , | Leave a comment

Generators in Python.

The following examples are using Python 2.x but now after seeing Python 3.x released I’m interested in generators larger role in Python. Generators remind me of accumulators: generators accumulate a comprehensive result that you can add to with calls to yield. Take the following as an example. def cubes(c): for i in range(c): yield i [...]
Posted in Programming | Tagged | Leave a comment