<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Ikke's blog</title>
	<link>http://eikke.com</link>
	<description>'cause this is what I do</description>
	<pubDate>Mon, 25 Aug 2008 23:05:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>Embedding JavaScript in Python</title>
		<link>http://eikke.com/embedding-javascript-in-python/</link>
		<comments>http://eikke.com/embedding-javascript-in-python/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 23:05:16 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[python javascript webkit javascriptcore]]></category>

		<guid isPermaLink="false">http://eikke.com/embedding-javascript-in-python/</guid>
		<description><![CDATA[Reading some posts about embedding languages/runtimes in applications on Planet GNOME reminded me I still had to announce some really quick and incomplete code blob I created some days after last GUADEC edition (which was insanely cool, thanks guys).
It takes WebKit&#8217;s JavaScriptCore and allows you to embed it in some Python program, so you, as [...]]]></description>
			<content:encoded><![CDATA[<p>Reading some posts about embedding languages/runtimes in applications on <a href="http://planet.gnome.org" title="Planet GNOME">Planet GNOME</a> reminded me I still had to announce some really quick and incomplete code blob I created some days after last <a href="http://www.guadec.org" title="GUADEC">GUADEC</a> edition (which was insanely cool, thanks guys).</p>
<p>It takes <a href="http://www.webkit.org" title="WebKit">WebKit</a>&#8217;s JavaScriptCore and allows you to embed it in some <a href="http://www.python.org" title="Python">Python</a> program, so you, as a Python developer, can allow consumers to write plugins using JavaScript. Don&#8217;t ask me whether it&#8217;s useful, maybe it&#8217;s not, but anyway.</p>
<p>There&#8217;s one catch: currently there is no support to expose custom Python objects to the JavaScript runtime: you&#8217;re able to use JavaScript objects and functions etc. from within Python, but not the other way around. I started working on this, but the JSCore API lacked some stuff to be able to implement this cleanly (or I missed a part of it, that&#8217;s possible as well), maybe it has changed by now&#8230; There is transparent translation of JavaScript base types: unicode strings, booleans, null (which becomes None in Python), undefined (which becomes jscore.UNDEFINED) and floats.</p>
<p>I did not work on the code for quite a long time because of too much real-job-work, maybe it no longer compiles, sorry&#8230; Anyway, it&#8217;s available in git <a href="http://git.nicolast.be/?p=python-jscore.git;a=summary" title="python-jscore git">here</a>, patches welcome etc. I guess <a href="http://git.nicolast.be/?p=python-jscore.git;a=blob;f=test/test_object.py;h=1604e4db7bb1e9333bcbed305ec3107921708ab0;hb=HEAD#l261">this</a> is the best sample code around. It&#8217;s using <a href="http://www.cython.org" title="Cython">Cython</a> for compilation (never tried with Pyrex, although this might work as well). If anyone can use it, great, if not, too bad, I did learn Cython doing this <img src='http://eikke.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Embedding JavaScript in Python' to Del.icio.us" alt="Add 'Embedding JavaScript in Python' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Embedding JavaScript in Python' to digg" alt="Add 'Embedding JavaScript in Python' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=Embedding+JavaScript+in+Python&amp;u=http://eikke.com/embedding-javascript-in-python/" title="Add 'Embedding JavaScript in Python' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Embedding JavaScript in Python' to FURL" alt="Add 'Embedding JavaScript in Python' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Embedding JavaScript in Python' to reddit" alt="Add 'Embedding JavaScript in Python' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/embedding-javascript-in-python/" title="Add 'Embedding JavaScript in Python' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Embedding JavaScript in Python' to Technorati" alt="Add 'Embedding JavaScript in Python' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/embedding-javascript-in-python/&amp;t=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Embedding JavaScript in Python' to Yahoo My Web" alt="Add 'Embedding JavaScript in Python' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python&amp;description=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Embedding JavaScript in Python' to Ma.gnolia" alt="Add 'Embedding JavaScript in Python' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Embedding JavaScript in Python' to Stumble Upon" alt="Add 'Embedding JavaScript in Python' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Embedding JavaScript in Python' to Google Bookmarks" alt="Add 'Embedding JavaScript in Python' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python&amp;v=3&amp;blocked=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'Embedding JavaScript in Python' to Spurl" alt="Add 'Embedding JavaScript in Python' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'Embedding JavaScript in Python' to Blogmarks" alt="Add 'Embedding JavaScript in Python' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/embedding-javascript-in-python/&amp;title=Embedding+JavaScript+in+Python" title="Add 'Embedding JavaScript in Python' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'Embedding JavaScript in Python' to Co.mments" alt="Add 'Embedding JavaScript in Python' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/embedding-javascript-in-python/" title="Add 'Embedding JavaScript in Python' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'Embedding JavaScript in Python' to Bloglines" alt="Add 'Embedding JavaScript in Python' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/embedding-javascript-in-python/" title="Add 'Embedding JavaScript in Python' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Embedding JavaScript in Python' to FaceBook" alt="Add 'Embedding JavaScript in Python' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/embedding-javascript-in-python/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Free Software startups</title>
		<link>http://eikke.com/free-software-startups/</link>
		<comments>http://eikke.com/free-software-startups/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 13:39:43 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://eikke.com/free-software-startups/</guid>
		<description><![CDATA[At GUADEC last days, fun times. One thing I noticed (again) is the growth of the number of small companies, some of them driven by young guys (like, between 25 and 30) doing some really great stuff with Free Software, combining a steady income, whilst still providing valuable contributions to the community.
I&#8217;d want to write [...]]]></description>
			<content:encoded><![CDATA[<p>At GUADEC last days, fun times. One thing I noticed (again) is the growth of the number of small companies, some of them driven by young guys (like, between 25 and 30) doing some really great stuff with Free Software, combining a steady income, whilst still providing valuable contributions to the community.</p>
<p>I&#8217;d want to write more about this seen, but here&#8217;s a quick idea: how about creating a mailing list for, at one side, these young startups or people interested in starting one, and on the other side people who already got their business running, or already established investors or managers, to discuss issues they encounter, potential business plans, how to get in contact with potential customers, how to combine open communication at one side and dealing with closed environments on the other,&#8230;</p>
<p>This could lower the barrier for people to start working full-time on the projects they love, it&#8217;d add value to Free Software because larger companies can start using it even more, because more expertise and consultancy is available on the market,&#8230;</p>
<p>I guess this is just a shot in the dark, but I think it could be pretty useful. Thoughts?</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups" title="Add 'Free Software startups' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Free Software startups' to Del.icio.us" alt="Add 'Free Software startups' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups" title="Add 'Free Software startups' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Free Software startups' to digg" alt="Add 'Free Software startups' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=Free+Software+startups&amp;u=http://eikke.com/free-software-startups/" title="Add 'Free Software startups' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Free Software startups' to FURL" alt="Add 'Free Software startups' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups" title="Add 'Free Software startups' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Free Software startups' to reddit" alt="Add 'Free Software startups' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/free-software-startups/" title="Add 'Free Software startups' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Free Software startups' to Technorati" alt="Add 'Free Software startups' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/free-software-startups/&amp;t=Free+Software+startups" title="Add 'Free Software startups' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Free Software startups' to Yahoo My Web" alt="Add 'Free Software startups' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups&amp;description=Free+Software+startups" title="Add 'Free Software startups' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Free Software startups' to Ma.gnolia" alt="Add 'Free Software startups' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups" title="Add 'Free Software startups' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Free Software startups' to Stumble Upon" alt="Add 'Free Software startups' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups" title="Add 'Free Software startups' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Free Software startups' to Google Bookmarks" alt="Add 'Free Software startups' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups&amp;v=3&amp;blocked=Free+Software+startups" title="Add 'Free Software startups' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'Free Software startups' to Spurl" alt="Add 'Free Software startups' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups" title="Add 'Free Software startups' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'Free Software startups' to Blogmarks" alt="Add 'Free Software startups' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/free-software-startups/&amp;title=Free+Software+startups" title="Add 'Free Software startups' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'Free Software startups' to Co.mments" alt="Add 'Free Software startups' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/free-software-startups/" title="Add 'Free Software startups' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'Free Software startups' to Bloglines" alt="Add 'Free Software startups' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/free-software-startups/" title="Add 'Free Software startups' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Free Software startups' to FaceBook" alt="Add 'Free Software startups' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/free-software-startups/feed/</wfw:commentRss>
		</item>
		<item>
		<title>GUADEC</title>
		<link>http://eikke.com/guadec/</link>
		<comments>http://eikke.com/guadec/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 13:53:37 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Various]]></category>

		<category><![CDATA[gnome]]></category>

		<category><![CDATA[GUADEC]]></category>

		<guid isPermaLink="false">http://eikke.com/guadec/</guid>
		<description><![CDATA[Leaving for GUADEC &#8216;08 with RubenV tomorrow. We&#8217;re staying in the Golden Horn Sultanahmet hotel. Packing starts in a minute, see you around.

]]></description>
			<content:encoded><![CDATA[<p>Leaving for <a href="http://guadec.expectnation.com/public/content/main" title="GUADEC '08">GUADEC &#8216;08</a> with <a href="http://www.savanne.be/" title="savanne.be">RubenV</a> tomorrow. We&#8217;re staying in the <a href="http://www.goldenhornhotel.com/eng/index.php" title="Golden Horn Hotel">Golden Horn Sultanahmet</a> hotel. Packing starts in a minute, see you around.</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/guadec/&amp;title=GUADEC" title="Add 'GUADEC' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'GUADEC' to Del.icio.us" alt="Add 'GUADEC' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/guadec/&amp;title=GUADEC" title="Add 'GUADEC' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'GUADEC' to digg" alt="Add 'GUADEC' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=GUADEC&amp;u=http://eikke.com/guadec/" title="Add 'GUADEC' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'GUADEC' to FURL" alt="Add 'GUADEC' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/guadec/&amp;title=GUADEC" title="Add 'GUADEC' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'GUADEC' to reddit" alt="Add 'GUADEC' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/guadec/" title="Add 'GUADEC' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'GUADEC' to Technorati" alt="Add 'GUADEC' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/guadec/&amp;t=GUADEC" title="Add 'GUADEC' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'GUADEC' to Yahoo My Web" alt="Add 'GUADEC' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/guadec/&amp;title=GUADEC&amp;description=GUADEC" title="Add 'GUADEC' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'GUADEC' to Ma.gnolia" alt="Add 'GUADEC' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/guadec/&amp;title=GUADEC" title="Add 'GUADEC' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'GUADEC' to Stumble Upon" alt="Add 'GUADEC' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/guadec/&amp;title=GUADEC" title="Add 'GUADEC' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'GUADEC' to Google Bookmarks" alt="Add 'GUADEC' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/guadec/&amp;title=GUADEC&amp;v=3&amp;blocked=GUADEC" title="Add 'GUADEC' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'GUADEC' to Spurl" alt="Add 'GUADEC' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/guadec/&amp;title=GUADEC" title="Add 'GUADEC' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'GUADEC' to Blogmarks" alt="Add 'GUADEC' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/guadec/&amp;title=GUADEC" title="Add 'GUADEC' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'GUADEC' to Co.mments" alt="Add 'GUADEC' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/guadec/" title="Add 'GUADEC' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'GUADEC' to Bloglines" alt="Add 'GUADEC' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/guadec/" title="Add 'GUADEC' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'GUADEC' to FaceBook" alt="Add 'GUADEC' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/guadec/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python &#8216;all&#8217; odity</title>
		<link>http://eikke.com/python-all-odity/</link>
		<comments>http://eikke.com/python-all-odity/#comments</comments>
		<pubDate>Thu, 01 May 2008 13:57:00 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[performance]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://eikke.com/python-all-odity/</guid>
		<description><![CDATA[[update] Question solved, see bottom of post.
Since Python 2.5 the language got a new built-in method &#8216;all&#8217; (and it&#8217;s nephew &#8216;any&#8217;). I wanted to play around with this a little, combined with generators, so I created a little testcase to test performance.
Here&#8217;s the test-case: take a list L of X random numbers in a given [...]]]></description>
			<content:encoded><![CDATA[<p>[update] Question solved, see bottom of post.</p>
<p>Since Python 2.5 the language got a new built-in method &#8216;all&#8217; (and it&#8217;s nephew &#8216;any&#8217;). I wanted to play around with this a little, combined with generators, so I created a little testcase to test performance.</p>
<p>Here&#8217;s the test-case: take a list L of X random numbers in a given range [A, B], and check whether</p>
<ul>
<li>all elements in L are &gt;= A</li>
<li>all elements in L are &gt;= (A + Z) where Z is a number in [0, (B - A)]</li>
</ul>
<p>The first test should always result True, the second test could result to False.</p>
<p>Here&#8217;s the output of a test-run:</p>
<pre>In [1]: import random, sys

In [2]: a = [random.randint(100, sys.maxint) for i in xrange(2000000)]

In [3]: len(a)
Out[3]: 2000000

In [4]: #Check whether all elements are &gt;= 100 

In [5]: %timeit all(i &gt;= 100 for i in a)
10 loops, best of 3: 515 ms per loop

In [6]: %timeit any(i &lt; 100 for i in a)
10 loops, best of 3: 454 ms per loop

In [7]: def f(l):
   ...:     for i in l:
   ...:         if i &lt; 100:
   ...:             return False
   ...:     return True
   ...: 

In [8]: %timeit f(a)
10 loops, best of 3: 292 ms per loop

In [9]: #Same thing for 100000, since now the list shouldn't be completely iterated

In [10]: %timeit all(i &gt;= 100000 for i in a)
100 loops, best of 3: 4.73 ms per loop

In [11]: %timeit any(i &lt; 100000 for i in a)
100 loops, best of 3: 4.29 ms per loop

In [12]: def g(l):
   ....:     for i in l:
   ....:         if i &lt; 100000:
   ....:             return False
   ....:     return True
   ....: 

In [13]: %timeit g(a)
100 loops, best of 3: 2.82 ms per loop

In [14]: #For reference

In [15]: %timeit False in (i &gt;= 100 for i in a)
10 loops, best of 3: 531 ms per loop

In [16]: %timeit False in (i &gt;= 100000 for i in a)
100 loops, best of 3: 5.03 ms per loop</pre>
<p>It&#8217;s as if &#8216;all&#8217;, &#8216;any&#8217; or &#8216;in&#8217; don&#8217;t break/return when a first occurence of False (or True, obviously) is found. Is this the desired behaviour, and if it is, why? The calculation time difference between using all/any/in or a custom-made function (which is, unlike all etc, not written in C) which breaks whenever it can, is pretty astonishing.</p>
<p>[update] Question solved. It&#8217;s pretty normal the function-based approach performs better, since it combines what &#8216;all&#8217; and the generator provided to &#8216;all&#8217; do, taking away the generator function-call overhead. Damn <img src='http://eikke.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Python &#8216;all&#8217; odity' to Del.icio.us" alt="Add 'Python &#8216;all&#8217; odity' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Python &#8216;all&#8217; odity' to digg" alt="Add 'Python &#8216;all&#8217; odity' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=Python+%26%238216%3Ball%26%238217%3B+odity&amp;u=http://eikke.com/python-all-odity/" title="Add 'Python &#8216;all&#8217; odity' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Python &#8216;all&#8217; odity' to FURL" alt="Add 'Python &#8216;all&#8217; odity' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Python &#8216;all&#8217; odity' to reddit" alt="Add 'Python &#8216;all&#8217; odity' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/python-all-odity/" title="Add 'Python &#8216;all&#8217; odity' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Python &#8216;all&#8217; odity' to Technorati" alt="Add 'Python &#8216;all&#8217; odity' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/python-all-odity/&amp;t=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Python &#8216;all&#8217; odity' to Yahoo My Web" alt="Add 'Python &#8216;all&#8217; odity' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity&amp;description=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Python &#8216;all&#8217; odity' to Ma.gnolia" alt="Add 'Python &#8216;all&#8217; odity' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Python &#8216;all&#8217; odity' to Stumble Upon" alt="Add 'Python &#8216;all&#8217; odity' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Python &#8216;all&#8217; odity' to Google Bookmarks" alt="Add 'Python &#8216;all&#8217; odity' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity&amp;v=3&amp;blocked=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'Python &#8216;all&#8217; odity' to Spurl" alt="Add 'Python &#8216;all&#8217; odity' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'Python &#8216;all&#8217; odity' to Blogmarks" alt="Add 'Python &#8216;all&#8217; odity' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/python-all-odity/&amp;title=Python+%26%238216%3Ball%26%238217%3B+odity" title="Add 'Python &#8216;all&#8217; odity' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'Python &#8216;all&#8217; odity' to Co.mments" alt="Add 'Python &#8216;all&#8217; odity' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/python-all-odity/" title="Add 'Python &#8216;all&#8217; odity' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'Python &#8216;all&#8217; odity' to Bloglines" alt="Add 'Python &#8216;all&#8217; odity' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/python-all-odity/" title="Add 'Python &#8216;all&#8217; odity' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Python &#8216;all&#8217; odity' to FaceBook" alt="Add 'Python &#8216;all&#8217; odity' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/python-all-odity/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python if/else in lambda</title>
		<link>http://eikke.com/python-ifelse-in-lambda/</link>
		<comments>http://eikke.com/python-ifelse-in-lambda/#comments</comments>
		<pubDate>Sat, 16 Feb 2008 21:24:43 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[functional programming]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://eikke.com/python-ifelse-in-lambda/</guid>
		<description><![CDATA[Scott, in your &#8220;Functional Python&#8221; introduction you write:
The one limitation that most disappoints me is that Python lacks is a functional way of writing if/else.  Sometimes you just want to do something like this:

lambda x : if_else(x&#62;100, “big number”, “little number”)

(This would return the string “big number” if x was greater than 100, and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://scott.andstuff.org/" title="Scott Moonen">Scott</a>, in your &#8220;<a href="http://scott.andstuff.org/FunctionalPython" title="Scott Moonen: Functional Python">Functional Python</a>&#8221; introduction you write:</p>
<blockquote><p>The one limitation that most disappoints me is that Python lacks is a functional way of writing <tt>if</tt>/<tt>else</tt>.  Sometimes you just want to do something like this:</p>
<blockquote>
<pre>lambda x : if_else(x&gt;100, “big number”, “little number”)</pre>
</blockquote>
<p>(This would return the string “big number” if <em>x</em> was greater than 100, and “little number” otherwise.)  Sometimes I get around this by defining my own <tt>if_else</tt> that I can use in lambda-functions:</p>
<blockquote>
<pre>def if_else(condition, a, b) :
   if condition : return a
   else         : return b</pre>
</blockquote>
</blockquote>
<p>Actually, you don&#8217;t need this helper if_else function at all:</p>
<pre>In [1]: f = lambda x: x &gt; 100 and 'big' or 'small'</pre>
<pre>In [2]: for i in (1, 10, 99, 100, 101, 110):
...:     print i, 'is', f(i)
...:
1 is small
10 is small
99 is small
100 is small
101 is big
110 is big</pre>
<p><a href="http://blogs.gnome.org/jamesh/2008/02/12/python-metaclasses/" title="James Henstridge: Python metaclasses">James</a>, obviously you&#8217;re right&#8230; Stupid me didn&#8217;t think about that. Your version won&#8217;t work when a discriminator isn&#8217;t known at import time. But even then a function taking <tt>*args</tt> and <tt>**kwargs</tt> with a class-like name, returning a correct class instance, would cut the job.</p>
<p>Regarding the module/plugin stuff, I&#8217;d rather use setuptools/pkg_resources <img src='http://eikke.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Python if/else in lambda' to Del.icio.us" alt="Add 'Python if/else in lambda' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Python if/else in lambda' to digg" alt="Add 'Python if/else in lambda' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=Python+if%2Felse+in+lambda&amp;u=http://eikke.com/python-ifelse-in-lambda/" title="Add 'Python if/else in lambda' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Python if/else in lambda' to FURL" alt="Add 'Python if/else in lambda' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Python if/else in lambda' to reddit" alt="Add 'Python if/else in lambda' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/python-ifelse-in-lambda/" title="Add 'Python if/else in lambda' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Python if/else in lambda' to Technorati" alt="Add 'Python if/else in lambda' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/python-ifelse-in-lambda/&amp;t=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Python if/else in lambda' to Yahoo My Web" alt="Add 'Python if/else in lambda' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda&amp;description=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Python if/else in lambda' to Ma.gnolia" alt="Add 'Python if/else in lambda' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Python if/else in lambda' to Stumble Upon" alt="Add 'Python if/else in lambda' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Python if/else in lambda' to Google Bookmarks" alt="Add 'Python if/else in lambda' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda&amp;v=3&amp;blocked=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'Python if/else in lambda' to Spurl" alt="Add 'Python if/else in lambda' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'Python if/else in lambda' to Blogmarks" alt="Add 'Python if/else in lambda' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/python-ifelse-in-lambda/&amp;title=Python+if%2Felse+in+lambda" title="Add 'Python if/else in lambda' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'Python if/else in lambda' to Co.mments" alt="Add 'Python if/else in lambda' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/python-ifelse-in-lambda/" title="Add 'Python if/else in lambda' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'Python if/else in lambda' to Bloglines" alt="Add 'Python if/else in lambda' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/python-ifelse-in-lambda/" title="Add 'Python if/else in lambda' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Python if/else in lambda' to FaceBook" alt="Add 'Python if/else in lambda' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/python-ifelse-in-lambda/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Code Review comic</title>
		<link>http://eikke.com/code-review-comic/</link>
		<comments>http://eikke.com/code-review-comic/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 20:43:33 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[comic]]></category>

		<guid isPermaLink="false">http://eikke.com/code-review-comic/</guid>
		<description><![CDATA[
I just love this comic.

]]></description>
			<content:encoded><![CDATA[<p><img src="http://eikke.com/wp-content/uploads/2008/02/wtfm.jpg" alt="OSNews: WTFs per minute" /></p>
<p>I just <em>love</em> this comic.</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic" title="Add 'Code Review comic' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Code Review comic' to Del.icio.us" alt="Add 'Code Review comic' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic" title="Add 'Code Review comic' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Code Review comic' to digg" alt="Add 'Code Review comic' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=Code+Review+comic&amp;u=http://eikke.com/code-review-comic/" title="Add 'Code Review comic' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Code Review comic' to FURL" alt="Add 'Code Review comic' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic" title="Add 'Code Review comic' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Code Review comic' to reddit" alt="Add 'Code Review comic' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/code-review-comic/" title="Add 'Code Review comic' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Code Review comic' to Technorati" alt="Add 'Code Review comic' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/code-review-comic/&amp;t=Code+Review+comic" title="Add 'Code Review comic' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Code Review comic' to Yahoo My Web" alt="Add 'Code Review comic' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic&amp;description=Code+Review+comic" title="Add 'Code Review comic' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Code Review comic' to Ma.gnolia" alt="Add 'Code Review comic' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic" title="Add 'Code Review comic' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Code Review comic' to Stumble Upon" alt="Add 'Code Review comic' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic" title="Add 'Code Review comic' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Code Review comic' to Google Bookmarks" alt="Add 'Code Review comic' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic&amp;v=3&amp;blocked=Code+Review+comic" title="Add 'Code Review comic' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'Code Review comic' to Spurl" alt="Add 'Code Review comic' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic" title="Add 'Code Review comic' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'Code Review comic' to Blogmarks" alt="Add 'Code Review comic' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/code-review-comic/&amp;title=Code+Review+comic" title="Add 'Code Review comic' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'Code Review comic' to Co.mments" alt="Add 'Code Review comic' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/code-review-comic/" title="Add 'Code Review comic' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'Code Review comic' to Bloglines" alt="Add 'Code Review comic' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/code-review-comic/" title="Add 'Code Review comic' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Code Review comic' to FaceBook" alt="Add 'Code Review comic' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/code-review-comic/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python factory-like type instances</title>
		<link>http://eikke.com/python-factory-like-type-instances/</link>
		<comments>http://eikke.com/python-factory-like-type-instances/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 19:31:20 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://eikke.com/python-factory-like-type-instances/</guid>
		<description><![CDATA[When designing applications or libraries, sometimes you need to be able to create instances of a certain interface (in a liberal sense) at runtime without knowing at write/compile time which specific implementation (class) you&#8217;ll need to use, as this could depend on runtime variables.
An example of this is an interface providing some functionality which should [...]]]></description>
			<content:encoded><![CDATA[<p>When designing applications or libraries, sometimes you need to be able to create instances of a certain interface (in a liberal sense) at runtime without knowing at write/compile time which specific implementation (class) you&#8217;ll need to use, as this could depend on runtime variables.</p>
<p>An example of this is an interface providing some functionality which should be implemented differently on different platforms, eg Linux and Windows.</p>
<p>There are some standard patterns how to achieve this. One of them is the <a href="http://en.wikipedia.org/wiki/Factory_method_pattern" title="Wikipedia: Factory method pattern">factory pattern</a>, which works somewhat like this <a href="http://www.python.org" title="Python">Python</a> example (let&#8217;s pretend &#8216;PLATFORM&#8217; is &#8216;linux2&#8242; or &#8216;win32&#8242;, ie sys.platform):</p>
<pre>#Pretend we use sys.platform instead of PLATFORM where we use it
PLATFORM = 'linux2'

class FooBase(object):
    def say_foo(self):
        print 'foo'

class PlatformFoo(FooBase):
    def say_platform_foo(self):
        raise NotImplementedError

    @staticmethod
    def get_class():
        #Several ways to get this (dict, introspection, if-tree,...), pick yours
        klass = {
            'linux2': LinuxFoo,
            'win32': WindowsFoo,
        }.get(PLATFORM, None)
        if not klass:
            raise Exception, 'Platform not supported'
        return klass

class WindowsFoo(PlatformFoo):
    def say_platform_foo(self):
        print 'win32 foo'

class LinuxFoo(PlatformFoo):
    def say_platform_foo(self):
        print 'linux foo'

def main():
    foo_class = PlatformFoo.get_class()
    foo = foo_class()
    foo.say_platform_foo()

if __name__ == '__main__':
    main()</pre>
<p>Executing this code will, as expected, write &#8216;linux foo&#8217; to the console. Obviously we could not return the platform-specific class in a PlatformFoo function, but an actual instance, up to you.</p>
<p>Python allows you to handle this situation somewhat nicer though, without introducing any intermediate functions, by using metaclasses.</p>
<p> <a href="http://eikke.com/python-factory-like-type-instances/#more-61" class="more-link">(more&#8230;)</a></p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Python factory-like type instances' to Del.icio.us" alt="Add 'Python factory-like type instances' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Python factory-like type instances' to digg" alt="Add 'Python factory-like type instances' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=Python+factory-like+type+instances&amp;u=http://eikke.com/python-factory-like-type-instances/" title="Add 'Python factory-like type instances' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Python factory-like type instances' to FURL" alt="Add 'Python factory-like type instances' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Python factory-like type instances' to reddit" alt="Add 'Python factory-like type instances' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/python-factory-like-type-instances/" title="Add 'Python factory-like type instances' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Python factory-like type instances' to Technorati" alt="Add 'Python factory-like type instances' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/python-factory-like-type-instances/&amp;t=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Python factory-like type instances' to Yahoo My Web" alt="Add 'Python factory-like type instances' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances&amp;description=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Python factory-like type instances' to Ma.gnolia" alt="Add 'Python factory-like type instances' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Python factory-like type instances' to Stumble Upon" alt="Add 'Python factory-like type instances' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Python factory-like type instances' to Google Bookmarks" alt="Add 'Python factory-like type instances' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances&amp;v=3&amp;blocked=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'Python factory-like type instances' to Spurl" alt="Add 'Python factory-like type instances' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'Python factory-like type instances' to Blogmarks" alt="Add 'Python factory-like type instances' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/python-factory-like-type-instances/&amp;title=Python+factory-like+type+instances" title="Add 'Python factory-like type instances' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'Python factory-like type instances' to Co.mments" alt="Add 'Python factory-like type instances' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/python-factory-like-type-instances/" title="Add 'Python factory-like type instances' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'Python factory-like type instances' to Bloglines" alt="Add 'Python factory-like type instances' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/python-factory-like-type-instances/" title="Add 'Python factory-like type instances' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Python factory-like type instances' to FaceBook" alt="Add 'Python factory-like type instances' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/python-factory-like-type-instances/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Funky C</title>
		<link>http://eikke.com/funky-c/</link>
		<comments>http://eikke.com/funky-c/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 00:04:29 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[C]]></category>

		<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://eikke.com/funky-c/</guid>
		<description><![CDATA[It&#8217;s pretty funny to know this is valid C99 code, implementing a very basic array assignment and hello world:
%:include &#60;stdio.h&#62;
??=include &#60;stdlib.h&#62;

int main(int argc, char *argv&#60;::&#62;) ??&#60;
    int i??(:&#62; = {1, 2, 3??&#62;;
    printf("Hello world\n");
    return 0;
%&#62;
It&#8217;s (ab)using an obscure feature in the C89 and C99 specifications [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s pretty funny to know this is valid C99 code, implementing a very basic array assignment and hello world:</p>
<pre>%:include &lt;stdio.h&gt;
??=include &lt;stdlib.h&gt;

int main(int argc, char *argv&lt;::&gt;) ??&lt;
    int i??(:&gt; = {1, 2, 3??&gt;;
    printf("Hello world\n");
    return 0;
%&gt;</pre>
<p>It&#8217;s (ab)using an obscure feature in the C89 and C99 specifications called Trigraph and Digraph, when using GCC you need to pass the &#8216;-trigraphs&#8217; parameter to enable this functionality. More information can be found on the <a href="http://en.wikipedia.org/wiki/C_trigraph" title="Wikipedia: C Trigraph">Wikipedia page</a> about it. I wonder whether people joining code obfuscation games use this.</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/funky-c/&amp;title=Funky+C" title="Add 'Funky C' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Funky C' to Del.icio.us" alt="Add 'Funky C' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/funky-c/&amp;title=Funky+C" title="Add 'Funky C' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Funky C' to digg" alt="Add 'Funky C' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=Funky+C&amp;u=http://eikke.com/funky-c/" title="Add 'Funky C' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Funky C' to FURL" alt="Add 'Funky C' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/funky-c/&amp;title=Funky+C" title="Add 'Funky C' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Funky C' to reddit" alt="Add 'Funky C' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/funky-c/" title="Add 'Funky C' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Funky C' to Technorati" alt="Add 'Funky C' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/funky-c/&amp;t=Funky+C" title="Add 'Funky C' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'Funky C' to Yahoo My Web" alt="Add 'Funky C' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/funky-c/&amp;title=Funky+C&amp;description=Funky+C" title="Add 'Funky C' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Funky C' to Ma.gnolia" alt="Add 'Funky C' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/funky-c/&amp;title=Funky+C" title="Add 'Funky C' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Funky C' to Stumble Upon" alt="Add 'Funky C' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/funky-c/&amp;title=Funky+C" title="Add 'Funky C' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'Funky C' to Google Bookmarks" alt="Add 'Funky C' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/funky-c/&amp;title=Funky+C&amp;v=3&amp;blocked=Funky+C" title="Add 'Funky C' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'Funky C' to Spurl" alt="Add 'Funky C' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/funky-c/&amp;title=Funky+C" title="Add 'Funky C' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'Funky C' to Blogmarks" alt="Add 'Funky C' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/funky-c/&amp;title=Funky+C" title="Add 'Funky C' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'Funky C' to Co.mments" alt="Add 'Funky C' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/funky-c/" title="Add 'Funky C' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'Funky C' to Bloglines" alt="Add 'Funky C' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/funky-c/" title="Add 'Funky C' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Funky C' to FaceBook" alt="Add 'Funky C' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/funky-c/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How not to write Python code</title>
		<link>http://eikke.com/how-not-to-write-python-code/</link>
		<comments>http://eikke.com/how-not-to-write-python-code/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 20:50:16 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://eikke.com/how-not-to-write-python-code/</guid>
		<description><![CDATA[Lately I&#8217;ve been reading some rather unclean Python code. Maybe this is mainly because the author(s) of the code had no in-depth knowledge of the Python language itself, the &#8216;platform&#8217; delivered with cPython,&#8230; Here&#8217;s a list of some of the mistakes you should really try to avoid when writing Python code:

Remember Python comes batteries included
Python [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been reading some rather unclean Python code. Maybe this is mainly because the author(s) of the code had no in-depth knowledge of the Python language itself, the &#8216;platform&#8217; delivered with cPython,&#8230; Here&#8217;s a list of some of the mistakes you should really try to avoid when writing Python code:</p>
<ul>
<li>Remember Python comes batteries included<br />
Python is shipped with  a whole bunch of standard modules implementing a broad range of functionality, including text handling, various data types, networking stuff (both low- and high-level), document processing, file archive handling, logging, etc. All these are documented in the <a href="http://docs.python.org/lib/" title="Python Library Documentation">Python Library Documentation</a>, so it is a must to browse at least through the list of available modules, so you get some notions of what you can use by default. An example: don&#8217;t introduce a dependency on <a href="http://www.twistedmatrix.com" title="Twisted">Twisted</a> to implement a very basic and simple custom HTTP server if you don&#8217;t have any performance needs, use <a href="http://docs.python.org/lib/module-BaseHTTPServer.html" title="Python BaseHTTPServer">BaseHTTPServer</a> and derivates.</li>
<li>Python is Python, don&#8217;t try to emulate bad coding patterns from other languages<br />
Python is a mature programming language which provides great flexibility, but also has some pretty specific patterns which you might not know in other languages you used before.<br />
As an example, don&#8217;t try to emulate PHP&#8217;s &#8216;include&#8217; or &#8216;require&#8217; function, at all. This could be done, somewhat, by writing the code to be included (and executed on inclusion) in a module on the top level (ie. not in functions/classes/&#8230;), and using something like &#8216;from foo import *&#8217; where you want this code to be executed. This will work, but it can become hard to maintain this. Modules are not meant to be used like this, so don&#8217;t. If you need to execute some code at some point, put it in a module as a function, import the function and call it wherever you want.</li>
<p> <a href="http://eikke.com/how-not-to-write-python-code/#more-59" class="more-link">(more&#8230;)</a></p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code" title="Add 'How not to write Python code' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'How not to write Python code' to Del.icio.us" alt="Add 'How not to write Python code' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code" title="Add 'How not to write Python code' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'How not to write Python code' to digg" alt="Add 'How not to write Python code' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=How+not+to+write+Python+code&amp;u=http://eikke.com/how-not-to-write-python-code/" title="Add 'How not to write Python code' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'How not to write Python code' to FURL" alt="Add 'How not to write Python code' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code" title="Add 'How not to write Python code' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'How not to write Python code' to reddit" alt="Add 'How not to write Python code' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/how-not-to-write-python-code/" title="Add 'How not to write Python code' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'How not to write Python code' to Technorati" alt="Add 'How not to write Python code' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/how-not-to-write-python-code/&amp;t=How+not+to+write+Python+code" title="Add 'How not to write Python code' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'How not to write Python code' to Yahoo My Web" alt="Add 'How not to write Python code' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code&amp;description=How+not+to+write+Python+code" title="Add 'How not to write Python code' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'How not to write Python code' to Ma.gnolia" alt="Add 'How not to write Python code' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code" title="Add 'How not to write Python code' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'How not to write Python code' to Stumble Upon" alt="Add 'How not to write Python code' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code" title="Add 'How not to write Python code' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'How not to write Python code' to Google Bookmarks" alt="Add 'How not to write Python code' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code&amp;v=3&amp;blocked=How+not+to+write+Python+code" title="Add 'How not to write Python code' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'How not to write Python code' to Spurl" alt="Add 'How not to write Python code' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code" title="Add 'How not to write Python code' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'How not to write Python code' to Blogmarks" alt="Add 'How not to write Python code' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/how-not-to-write-python-code/&amp;title=How+not+to+write+Python+code" title="Add 'How not to write Python code' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'How not to write Python code' to Co.mments" alt="Add 'How not to write Python code' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/how-not-to-write-python-code/" title="Add 'How not to write Python code' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'How not to write Python code' to Bloglines" alt="Add 'How not to write Python code' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/how-not-to-write-python-code/" title="Add 'How not to write Python code' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'How not to write Python code' to FaceBook" alt="Add 'How not to write Python code' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/how-not-to-write-python-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>VirtualBox launch script</title>
		<link>http://eikke.com/virtualbox-launch-script/</link>
		<comments>http://eikke.com/virtualbox-launch-script/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 01:55:55 +0000</pubDate>
		<dc:creator>Nicolas</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[iscsi]]></category>

		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://eikke.com/virtualbox-launch-script/</guid>
		<description><![CDATA[I&#8217;ve been playing around with VirtualBox some more today (more on it, and other virtualization related stuff might follow later). I got a Windows XP instance running fine (and fast!) in it. Still got some issues (shared folders seem not to work when logged in as a non-administrator user in XP, although I tend to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with VirtualBox some more today (more on it, and other virtualization related stuff might follow later). I got a Windows XP instance running fine (and fast!) in it. Still got some issues (shared folders seem not to work when logged in as a non-administrator user in XP, although I tend to blame Windows for this issue, not VirtualBox), played around with a little Linux installation acting as an iSCSI target for its virtual block devices, accessing them from Windows using the Microsoft iSCSI initiator, etc. Here&#8217;s a <a href="http://key.nicolast.be/files/vbox-iscsi-seamless.png" title="VirtualBox, LIO, seamless Windows XP and iSCSI">screenshot</a> of all this.</p>
<p>I added a launcher for my Windows VM to my panel, which was simply running &#8216;VBoxManage startvm &lt;VM UUID&gt;&#8217;. This was not an optimal solution though, as I wanted it to show a little error dialog when something went wrong when attempting to launch the VM (eg because I forgot it was already running), when the virtual disk files aren&#8217;t accessible (because I forgot to mount the volume they reside on), etc.</p>
<p>So I cooked a little script which runs some sanity checks before launching the virtual machine, and reports any errors. Here it is:</p>
<p> <a href="http://eikke.com/virtualbox-launch-script/#more-57" class="more-link">(more&#8230;)</a></p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><a class="social_img" href="http://del.icio.us/post?url=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to Del.icio.us"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'VirtualBox launch script' to Del.icio.us" alt="Add 'VirtualBox launch script' to Del.icio.us" /></a><a class="social_img" href="http://digg.com/submit?phase=2&amp;url=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to digg"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'VirtualBox launch script' to digg" alt="Add 'VirtualBox launch script' to digg" /></a><a class="social_img" href="http://furl.net/storeIt.jsp?t=VirtualBox+launch+script&amp;u=http://eikke.com/virtualbox-launch-script/" title="Add 'VirtualBox launch script' to FURL"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'VirtualBox launch script' to FURL" alt="Add 'VirtualBox launch script' to FURL" /></a><a class="social_img" href="http://reddit.com/submit?url=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to reddit"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'VirtualBox launch script' to reddit" alt="Add 'VirtualBox launch script' to reddit" /></a><a class="social_img" href="http://www.technorati.com/faves?add=http://eikke.com/virtualbox-launch-script/" title="Add 'VirtualBox launch script' to Technorati"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'VirtualBox launch script' to Technorati" alt="Add 'VirtualBox launch script' to Technorati" /></a><a class="social_img" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://eikke.com/virtualbox-launch-script/&amp;t=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to Yahoo My Web"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/yahoo_myweb.png" title="Add 'VirtualBox launch script' to Yahoo My Web" alt="Add 'VirtualBox launch script' to Yahoo My Web" /></a><a class="social_img" href="http://ma.gnolia.com/bookmarklet/add?url=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script&amp;description=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to Ma.gnolia"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'VirtualBox launch script' to Ma.gnolia" alt="Add 'VirtualBox launch script' to Ma.gnolia" /></a><a class="social_img" href="http://www.stumbleupon.com/submit?url=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to Stumble Upon"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'VirtualBox launch script' to Stumble Upon" alt="Add 'VirtualBox launch script' to Stumble Upon" /></a><a class="social_img" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to Google Bookmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'VirtualBox launch script' to Google Bookmarks" alt="Add 'VirtualBox launch script' to Google Bookmarks" /></a><a class="social_img" href="http://www.spurl.net/spurl.php?url=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script&amp;v=3&amp;blocked=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to Spurl"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/spurl.png" title="Add 'VirtualBox launch script' to Spurl" alt="Add 'VirtualBox launch script' to Spurl" /></a><a class="social_img" href="http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;url=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to Blogmarks"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bmarks.png" title="Add 'VirtualBox launch script' to Blogmarks" alt="Add 'VirtualBox launch script' to Blogmarks" /></a><a class="social_img" href="http://co.mments.com/track?url=http://eikke.com/virtualbox-launch-script/&amp;title=VirtualBox+launch+script" title="Add 'VirtualBox launch script' to Co.mments"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/comments.png" title="Add 'VirtualBox launch script' to Co.mments" alt="Add 'VirtualBox launch script' to Co.mments" /></a><a class="social_img" href="http://www.bloglines.com/sub/http://eikke.com/virtualbox-launch-script/" title="Add 'VirtualBox launch script' to Bloglines"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/bloglines.png" title="Add 'VirtualBox launch script' to Bloglines" alt="Add 'VirtualBox launch script' to Bloglines" /></a><a class="social_img" href="http://www.facebook.com/share.php?u=http://eikke.com/virtualbox-launch-script/" title="Add 'VirtualBox launch script' to FaceBook"><img src="http://eikke.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'VirtualBox launch script' to FaceBook" alt="Add 'VirtualBox launch script' to FaceBook" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://eikke.com/virtualbox-launch-script/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
