new blog 2.0


Blog move!

I'm retiring this blog in favor of its successor

I created this now-legacy blog five years ago with an intention to post notes-to-self. Over time, the blog struggled to maintain this identity, as some of my posts were terse notes to self, while others were addressed to general public in hope that someone else would find my every day discoveries useful. I now realize that from a reader's point of view such blogs are impossible to follow consistently, and I'm intending to make this one more reader-friendly. Hope to see you on!


Inspiration for veggie meals

If you're looking for veg cooking ideas, consider adding the following gadget to your iGoogle page or some other personalized dashboard. The gadget presents a new vegetarian or vegan meal suggestion every 24 hours and the user can click-through to the recipe.

Click here for instructions on embedding it from


Learn natural English with daily Collocations

Collocations are best defined by Christopher Manning & Hinrich Schütze:
A COLLOCATION is an expression consisting of two or more words that correspond to some conventional way of saying things. Or in the words. (Read the full text here paper)
Collocations of words make the language sound "native" and other combinations may cause it to sound unnatural. The new service helps English learners absorb the natural language faster through visual representation of collocations. Take a look:

  • The word being the subject of collocation analysis is placed in the yellow ellipse.
  • Words in rectangular boxes are collocating words.
  • The thickness of the line linking two words implies the strength of their collocation in terms of the subject word.
 For more, subscribe to the feed on


Python issublist()

An inefficient yet basic and mostly sufficient implementation of a Python function asserting that elements of one iterator are a sublist another's.

def issublist(a, b):
    sep = '\xC0\xFF\xEE'
    a_str = '%s%s%s' % (sep, sep.join(['%s' % e for e in a]), sep)
    b_str = '%s%s%s' % (sep, sep.join(['%s' % e for e in b]), sep)
    return a_str in b_str

2011/10/23 - Český Rozhlas live stream czech

A webapp looking up M3U and XSPF streams for Czech National Radio channels


A Finite State Machine module for Python

In preparation for yet another maths exam I created a Python module for modeling, building and describing finite-state automata. I used it for doing my homework assignment and got a nice enough score. The following transducer (my homework) describes the operation of a microwave oven. Green - current state; blue - possible transitions from the current state.

The python-fsm project is hosted at

where more examples and some docs can be found.


Python exec module in namespace, an importless import.

The following code demonstrates how to import a Python module into a namespace if the module file does not end with ".py" extension, contains dots or the filename is established during execution. It might be useful for unit testing of scripts of which path is known but which can't be imported directly in the testing module.

I assume that module's name is "", the content follows.
def hello():
    for i in range(3):
       print 'oO',

The interactive interpreter:
Python 2.6.5 (r265:79063, Jun  3 2010, 14:39:13)
[GCC 4.1.2 20090703] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class Module(object):
...     """Module object."""
...     def __init__(self, ns_dict):
...         """Populate the module."""
...         self.__dict__ = ns_dict
>>> mod_filename = ''
>>> mod_ns_alias = 'mymodule'
>>> source = open(mod_filename).read()
>>> module_code = compile(source, mod_filename, 'exec')
>>> mod_ns = {}
>>> exec module_code in mod_ns
>>> exec('%s = Module(mod_ns)' % mod_ns_alias)
>>> mymodule.hello()
oO oO oO