13.9.11

The switch to PyPy

After many frustrating nights with python i have decided to make the jump to PyPy, any new project that i start will most likely run on PyPy. As you may know PyPy is compatible entirely with python.

28.6.10

link grammar python interface

I now have separated the link grammar module from my NLP project so that is available for others to use, see here

To use:
git clone git://github.com/bluemoon/linkgrammar_module.git
cd linkgrammar_module
python setup.py build
sudo python setup.py install

27.6.10

Python design pattern series: recursive data structures

I introduce a recursive structure in which you can create and object, and add to it at will.



class ObjectProxy(object):
def __init__(self, dictionary=None):
if dictionary:
for a, b in dictionary.items():
if isinstance(b, (list, tuple)):
setattr(self, a, [ObjectProxy(x)\
if isinstance(x, dict) else x for x in b])
else:
setattr(self, a, ObjectProxy(b)\
if isinstance(b, dict) else b)

def __repr__(self):
return '' % ', '.join(self.__dict__.keys())

def __getattr__(self, attr):
try:
return dict.__getattr__(self, attr)
except:
if not self.__dict__.has_key(attr):
self.__dict__[attr] = ObjectProxy()
return self.__dict__[attr]

def __setattr__(self, attr, value):
if self.__dict__.has_key(attr) or '__' in attr:
dict.__setattr__(self, attr, value)
else:
self.__dict__[attr] = value

a = ObjectProxy()
a.b.c.d = 3
a.m.d_ = 2


16.6.10

A simplified deferred method

This is much like the twisted deferred, but is simplified down for use without twisted.


class Deferred(object):
def __init__(self):
self._callbacks = []

def add_callback(self, callback):
if hasattr(self, 'result'):
callback(self.result)
else:
self._callbacks.append(callback)

def callback(self, result):
assert not hasattr(self, 'result')
for cb in self._callbacks:
cb(result)
self.result = result


def defer(result):
d = Deferred()
d.result = result
return d



My dot-emacs

see here! you will need, yasnippet, rope, pymacs, ido(i think its included now), smex, cython-mode

# git clone git://github.com/bluemoon/all_configs.git
# cd all_configs
# ./install.sh

emacs!

My emacs setup, i will post this later on to a git repository.

15.6.10

hestia


The basic core of hestia is done! The status icon is currently working and as soon as i figure out how i want to plan the rest out i will start on that bit. See the check mark icon, in the status icon tray in this screenshot.

Currently the project runs a set of commands that you have chosen, and gets the return status and sets the icon accordingly. If the build fails it sets and X and if not you get a pretty green check mark. Also if it fails, you get a notification from notify or notify-osd