Downgrade

October 19th, 2009

I was quite happy to notice, that my favourite VCS, Mercurial, was released in version 1.3.1! And I’m still using 1.1.2 out of the Ubuntu repository.

Eagerly I updated from the release PPA, but what did I know back than. First thing I noticed was the half done translation. German technical terms just suck.

More importantly they broke the zeroconf module. As most of my hg pulls are within my network, this is pretty serious for me. A fix is already committed, but not yet released. So back to 1.1.2 for me, as I like my VCS stable.

Simple ML to Python

July 26th, 2009

While studying for my exams, I tried to implement some examples from a book about virtual machines.

The result was a nice little program which can compile simple functional programs into python bytecode!

The only thing you need is the ply parser generator. To compile a function just use:

import topcompiler

@topcompile.compile
def func(x, y):
    """let i = x*x in y*i"""
    pass # Compiles the docstring into a function

func(2, 3) == 12

Update:

TOPCompiler now also understands recursive definitions!

@topcompiler.compile
def fac(x):
    """
    let rec fac = fun i ->
    if i > 1 then
        fac (i-1)*i
    else
        1
    in fac x
    """
    pass

There is a working quicksort in tests.py.

Check out the code at http://bitbucket.org/ebo/pyvm!

Using Pylons-Controller in Turbogears 2.0

May 16th, 2009

If you want to enhance your TG2 app with some tech, like .. say a RPC-XML Interface, you can use the special Controller provided by Pylons: XMLRPCController. Unfortunately you can not just mount this controller as any other Turbogears Controller, because it does not support object dispatch.
Instead you have to use the Pylons function forward to dispatch requests to your controller.

@expose()
def xmlrpc(self, *args, **kw):
    return forward(XMLRPCServiceController())

Sprox and TG2

May 10th, 2009

While playing around with Sprox and TG2, I found a little bug for which a fix is commited to Sprox, but not yet released. I had to a bit until I found a nice and easy workaround. I just copied the changed code into a Mixin class, which can be patched into the declarative Sprox classes.

class ValidateMixin(object):
    def validate(self, params, state=None):
        """A pass-thru to the widget's validate function."""
        return self.__widget__.validate(params, state)

It can be used with any Formbase class. Just inherit from ValidateMixin first:

class PostEditForm(ValidateMixin, EditableForm):
    pass

This works until a new version of Sprox is released and should continue to do so afterwards, even if it can be removed than.

Mercurial: hggnome-keyring Extension

April 24th, 2009

While surfing around I discovered a nice little Mercurial Extension: hgkeychain. Unfortunately it’s only for Mac. As Gnome has password management of it’s own, I looked there is someway to access it via Python. And there is!

So I wrote a quick extension myself: hggnome-keyring

It uses the usual yadda yadda for installing (see mercurial docs). Only drawback: Access to the keyring is determined by executable name, so any python programm is allowed to access those keys :-(

There are two first in this post:

  1. I used bitbucket.org to host the repo. It’s quite nice and very free.
  2. This post is relayed to my twitter account.

Perl

March 5th, 2009

If you do not know perl, don’t fret.. it’s extremely easy to learn.

Found in a programming forum from non-coders for non-coders…

I lol’d!

Molecular Dynamics

February 14th, 2009

I created a little video with the md simulation, I’m working on for my diploma thesis. It simulates condensing Argon atoms using 8 cpus and around 130 cpu hours. Parallelization was done with Space-Filling curves. I used around 500 thousand particles … try that with your standard O(n2) algorithms.

Condensing Argon

Of course I used some fanciful coloring.

Unlösbares Problem, gelöst!

February 12th, 2009

unlosbar

Gefunden in einem Computerforum bei der Recherche für RepairExpert.

repair.4geeks.de

February 9th, 2009

Endlich habe ich es geschafft mein neues ‘kleines’ Projekt fertigzustellen:

repair.4geeks.de

Wie jeder der sich irgendwie mit Computern beschäftigt, habe auch ich meinen Ruf weg. Das hat zur Folge, dass ich genötigt werden Computer von Freunden und Bekannten zu reparieren. Irgendwann kam mir der Gedanke, meine Erlebnisse in wiederverwertbare Form zu gießen. Erste Versuche mit Pyke waren zwar vielversprechend, leider war die Bibliothek nicht komplett kompatibel mit meinem Ansatz: Erstens kann man Regeln nur aus Dateien lesen und zweitens hatte ich Zweifel daran, dass ich einen Zustand ordentlich serialisieren kann wärend eine Frage beantwortet wird.

Kurzerhand habe ich mir meine eigene Inference Engine geschrieben. Dazu noch ein paar Regeln einfügen und fertig war RepairExpert.

Ich hoffe, im Laufe der Zeit noch mehr Probleme und Lösungen einzufügen, aber leider muss das erstmal vor meiner Diplomarbeit zurückstehen.

Rawr TankDK

January 8th, 2009

Finally my latest addition to Rawr got released with the new version: The TankDK module!

It’s a theory craft program that provides Death Knights with the possibility to optimize their gear to the best. It is not finished yet, so if you have any proposals or comments post them at Elitist Jerks.

ThWBoard and reCAPTCHA

January 5th, 2009

At UO-BaB we still use ThWBoard as forum software. While bots seem not be able to spam it, probably because of the low distribution, we get a lot of bogus registrations. These generate a lot of undeliverable mails which choke our support mailbox.

I finally decided to do something against this and implemented a reCAPTCHA check on the registration page. I have made a patch for anyone who still uses ThWBoard.

Mathematik

December 17th, 2008

Erster Hauptsatz über die praktische Bedeutung von Schul-/Universitäts-Mathematik:

Wenn man eine kubische Gleichung lösen soll, ist eine der Nullstellen immer -1, 0 oder 1.

ToscaWidgets headache

December 14th, 2008

I just spent 2 hours to find a way to set the value of a tw HiddenField. Unfortunately the author did not think, it would be a good thing to mention such nonrelevant tasks in the documentation.

To save you searching for yourself:

options = {'form_name' : {'attrs' : {'value':'your_value'}}}

Later in the template to show your form:

${tmpl_context.form(child_args=options)}

Gestern beim D&D spielen…

November 24th, 2008

Dungeonmaster: Ein Ritter kommt auf euch zu! Ihr seht ihn in tiefschwarzer Rüstung, mit schwarzem Schild und schwarzem Helm.

Spieler: Oh ein Emo!

Digital Restriction Management

October 23rd, 2008

Via Slashdot

Make DRM invisible and people will use it.

(Un-)fortunately this is impossible by design. DRM wants to restrict usage and therefor can never be invisible.