<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>4Geeks.de &#187; python</title>
	<atom:link href="http://www.4geeks.de/blog/archives/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.4geeks.de/blog</link>
	<description>-.-</description>
	<lastBuildDate>Sun, 14 Mar 2010 21:00:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unladen Swallow</title>
		<link>http://www.4geeks.de/blog/archives/2010/02/unladen-swallow/</link>
		<comments>http://www.4geeks.de/blog/archives/2010/02/unladen-swallow/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 15:08:22 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[unladen swallow]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/blog/?p=230</guid>
		<description><![CDATA[I recently Ding!ed committer for Unladen Swallow  
I&#8217;m currently trying to teach Unladen to recompile functions. This turned out to be more complicated than I anticipated.
There is one especially obscure &#8216;bug&#8217;. Enabling recompilation makes the subprocess module tests hang, but only if it is executed after the pickle tests. The hanging test tries to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently Ding!ed committer for <a href="http://code.google.com/p/unladen-swallow/">Unladen Swallow</a> <img src='http://www.4geeks.de/blog/wp-includes/images/smilies/icon_cool.gif' alt='8-)' class='wp-smiley' /> </p>
<p>I&#8217;m currently trying to teach Unladen to <a href="http://code.google.com/p/unladen-swallow/issues/detail?id=41">recompile functions</a>. This turned out to be more complicated than I anticipated.</p>
<p>There is one especially obscure &#8216;bug&#8217;. Enabling recompilation makes the subprocess module tests hang, but only if it is executed after the pickle tests. The hanging test tries to start a none-existent program around 2000 times. The subprocess module forks and tries to exec the command in the child process. If an exception occurs, it is pickled and send back to the parent via pipes.</p>
<p>Executing the pickle tests makes two functions considered hot and some command in the child process triggers a recompilation of these two functions.</p>
<p>Apparently the invocation of the JIT leads to a lot of memory being duplicated, which slows down the child process considerably.  Ugh.</p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2010/02/unladen-swallow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Downgrade</title>
		<link>http://www.4geeks.de/blog/archives/2009/10/downgrade/</link>
		<comments>http://www.4geeks.de/blog/archives/2009/10/downgrade/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 22:14:45 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/blog/?p=225</guid>
		<description><![CDATA[I was quite happy to notice, that my favourite VCS, Mercurial, was released in version 1.3.1! And I&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>I was quite happy to notice, that my favourite VCS, Mercurial, was released in <a href="http://mercurial.selenic.com/wiki/WhatsNew">version 1.3.1</a>! And I&#8217;m still using 1.1.2 out of the Ubuntu repository.</p>
<p>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.</p>
<p>More importantly they broke the zeroconf module. As most of my <em>hg pull</em>s 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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2009/10/downgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple ML to Python</title>
		<link>http://www.4geeks.de/blog/archives/2009/07/simple-ml-to-python/</link>
		<comments>http://www.4geeks.de/blog/archives/2009/07/simple-ml-to-python/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 21:52:16 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/blog/?p=217</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>While studying for my exams, I tried to implement some examples from a book about <a href="http://www.amazon.de/%C3%9Cbersetzerbau-Virtuelle-Maschinen-Reinhard-Wilhelm/dp/3540495967">virtual machines</a>.</p>
<p>The result was a <a href="http://bitbucket.org/ebo/pyvm">nice little program</a> which can compile simple functional programs into python bytecode!</p>
<p>The only thing you need is the <a href="http://www.dabeaz.com/ply/">ply parser generator</a>. To compile a function just use:</p>
<pre>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
</pre>
<p><em>Update:</em></p>
<p>TOPCompiler now also understands recursive definitions!</p>
<pre>@topcompiler.compile
def fac(x):
    """
    let rec fac = fun i -&gt;
    if i &gt; 1 then
        fac (i-1)*i
    else
        1
    in fac x
    """
    pass
</pre>
<p>There is a working quicksort in <a href="http://bitbucket.org/ebo/pyvm/src/6afb96eed147/tests.py#cl-430">tests.py</a>.</p>
<p>Check out the code at <a href="http://bitbucket.org/ebo/pyvm">http://bitbucket.org/ebo/pyvm</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2009/07/simple-ml-to-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Pylons-Controller in Turbogears 2.0</title>
		<link>http://www.4geeks.de/blog/archives/2009/05/using-pylons-controller-in-turbogears-20/</link>
		<comments>http://www.4geeks.de/blog/archives/2009/05/using-pylons-controller-in-turbogears-20/#comments</comments>
		<pubDate>Sat, 16 May 2009 20:06:34 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[turbogears]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/?p=204</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to enhance your <a href="http://www.turbogears.org/">TG2</a> app with some tech, like .. say a RPC-XML Interface, you can use the special Controller provided by Pylons: <a href="http://wiki.pylonshq.com/display/pylonsdocs/Using+the+XMLRPCController">XMLRPCController</a>. Unfortunately you can not just mount this controller as any other Turbogears Controller, because it does not support object dispatch.<br />
Instead you have to use the Pylons function forward to dispatch requests to your controller.</p>
<pre>@expose()
def xmlrpc(self, *args, **kw):
    return forward(XMLRPCServiceController())</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2009/05/using-pylons-controller-in-turbogears-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sprox and TG2</title>
		<link>http://www.4geeks.de/blog/archives/2009/05/sprox-and-tg2/</link>
		<comments>http://www.4geeks.de/blog/archives/2009/05/sprox-and-tg2/#comments</comments>
		<pubDate>Sun, 10 May 2009 21:37:13 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[turbogears]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/?p=201</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>While playing around with <a href="http://sprox.org/">Sprox</a> and <a href="http://turbogears.org/">TG2</a>, I found a little bug for which a <a href="http://bitbucket.org/percious/sprox/changeset/71fd6a701377/">fix is commited</a> 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.</p>
<pre>class ValidateMixin(object):
    def validate(self, params, state=None):
        """A pass-thru to the widget's validate function."""
        return self.__widget__.validate(params, state)</pre>
<p>It can be used with any Formbase class. Just inherit from ValidateMixin first:</p>
<pre>class PostEditForm(ValidateMixin, EditableForm):
    pass</pre>
<p>This works until a new version of Sprox is released and should continue to do so afterwards, even if it can be removed than.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2009/05/sprox-and-tg2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mercurial: hggnome-keyring Extension</title>
		<link>http://www.4geeks.de/blog/archives/2009/04/mercurial-hggnome-keyring-extension/</link>
		<comments>http://www.4geeks.de/blog/archives/2009/04/mercurial-hggnome-keyring-extension/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 19:15:47 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/?p=193</guid>
		<description><![CDATA[While surfing around I discovered a nice little Mercurial Extension: hgkeychain. Unfortunately it&#8217;s only for Mac. As Gnome has password management of it&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>While surfing around I discovered a nice little <a href="http://www.selenic.com/mercurial/">Mercurial</a> Extension: <a href="http://toxicsoftware.com/hgkeychain/">hgkeychain</a>. Unfortunately it&#8217;s only for Mac. As Gnome has password management of it&#8217;s own, I looked there is someway to access it via Python. And there is!</p>
<p>So I wrote a quick extension myself: <a href="http://bitbucket.org/ebo/hggnome-keyring/overview/">hggnome-keyring</a></p>
<p>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 <img src='http://www.4geeks.de/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>There are two first in this post:</p>
<ol>
<li>I used <a href="http://bitbucket.org">bitbucket.org</a> to host the repo. It&#8217;s quite nice and very free.</li>
<li>This post is relayed to my <a href="http://twitter.com/ebolad">twitter account</a>.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2009/04/mercurial-hggnome-keyring-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>repair.4geeks.de</title>
		<link>http://www.4geeks.de/blog/archives/2009/02/repair4geeksde/</link>
		<comments>http://www.4geeks.de/blog/archives/2009/02/repair4geeksde/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 22:26:42 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[turbogears]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/?p=175</guid>
		<description><![CDATA[Endlich habe ich es geschafft mein neues &#8216;kleines&#8217; 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Endlich habe ich es geschafft mein neues &#8216;kleines&#8217; Projekt fertigzustellen:</p>
<p><a href="http://repair.4geeks.de">repair.4geeks.de</a></p>
<p>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 <a href="http://pyke.sourceforge.net/">Pyke</a> 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.</p>
<p>Kurzerhand habe ich mir meine eigene <a href="http://de.wikipedia.org/wiki/Inferenzmaschine">Inference  Engine</a> geschrieben. Dazu noch ein paar Regeln einfügen und fertig war <a href="http://repair.4geeks.de">RepairExpert</a>.</p>
<p>Ich hoffe, im Laufe der Zeit noch mehr Probleme und Lösungen einzufügen, aber leider muss das erstmal vor meiner Diplomarbeit zurückstehen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2009/02/repair4geeksde/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ToscaWidgets headache</title>
		<link>http://www.4geeks.de/blog/archives/2008/12/toscawidgets-headache/</link>
		<comments>http://www.4geeks.de/blog/archives/2008/12/toscawidgets-headache/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 20:01:38 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[turbogears]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/?p=162</guid>
		<description><![CDATA[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)}
]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>To save you searching for yourself:</p>
<pre style="padding-left: 30px;">options = {'form_name' : {'attrs' : {'value':'your_value'}}}</pre>
<p>Later in the template to show your form:</p>
<pre style="padding-left: 30px;">${tmpl_context.form(child_args=options)}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2008/12/toscawidgets-headache/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mercurial</title>
		<link>http://www.4geeks.de/blog/archives/2008/06/mercurial/</link>
		<comments>http://www.4geeks.de/blog/archives/2008/06/mercurial/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 18:15:59 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/?p=135</guid>
		<description><![CDATA[I&#8217;m toying around with a new revision control system: mercurial.
It&#8217;s written in Python (first big plus) and for the amount of code it&#8217;s really awesome. It features distributed source control, fast commits and a really nice web interface. There is also a Tortoise-&#8217;Version&#8217; for it (unlike git).
Only big negative point: Its hard to control who [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m toying around with a new revision control system: <a href="http://www.selenic.com/mercurial/wiki/">mercurial</a>.</p>
<p>It&#8217;s written in Python (first big plus) and for the amount of code it&#8217;s really awesome. It features distributed source control, fast commits and a really nice web interface. There is also a <a href="http://tortoisehg.sourceforge.net/">Tortoise-&#8217;Version&#8217;</a> for it (unlike git).</p>
<p>Only big negative point: Its hard to control who pushes to a central repository. Of course thats a bit hard in a distributed rcs, but there is no way to include which http or ssh user pushed the changes.</p>
<p>But I&#8217;m still looking for solutions <img src='http://www.4geeks.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2008/06/mercurial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling Python functions from SWIG/C++</title>
		<link>http://www.4geeks.de/blog/archives/2007/10/calling-python-functions-from-swigc/</link>
		<comments>http://www.4geeks.de/blog/archives/2007/10/calling-python-functions-from-swigc/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 19:39:46 +0000</pubDate>
		<dc:creator>ebo</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Uni]]></category>
		<category><![CDATA[Use The Source]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[swig]]></category>

		<guid isPermaLink="false">http://www.4geeks.de/archives/2007/10/calling-python-functions-from-swigc/</guid>
		<description><![CDATA[To make it more easy to integrate my Sparse Grid framework into existing applications (like those almighty financial applications where one function evaluation takes a whole day to calculate) and of course for easier development/testing, I searched for a way to call python callables from my swig-wrapped c++ code.
Lets first have a look in the [...]]]></description>
			<content:encoded><![CDATA[<p>To make it more easy to integrate my Sparse Grid framework into existing applications (like those almighty financial applications where one function evaluation takes a whole day to calculate) and of course for easier development/testing, I searched for a way to call python callables from my swig-wrapped c++ code.</p>
<p>Lets first have a look in the swig <a href="http://www.swig.org/Doc1.3/SWIG.html#SWIG_nn30">documentation</a>:</p>
<blockquote><p>SWIG provides full support for function pointers provided that the callback functions are defined in C and not in the target language.</p></blockquote>
<p>That&#8217;s unfortunate. Further <a href="http://www.google.com">research</a> revealed that there is indeed a (rather hackish) way to manage that.</p>
<p>First we define a function for setting the a callback:</p>
<blockquote><p>void setCallback(PyObject* obj) ;</p></blockquote>
<p>Now SWIG expects a wrapped PyObject-object, which we don&#8217;t have. That behavior can be overwritten be defining a custom typemap. The easiest possible solution would be:</p>
<blockquote><p>%typemap(in) PyObject* {<br />
$1 = $input;<br />
}</p></blockquote>
<p>All you have to do now is to check the object in your previously defined function and grab a reference to it. Read the <a href="http://docs.python.org/">Python documentation</a> on how to do that.</p>
<p>Overall rating: Working, but not very portable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.4geeks.de/blog/archives/2007/10/calling-python-functions-from-swigc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
