<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dark Views &#187; Python</title>
	<atom:link href="http://blog.pdark.de/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pdark.de</link>
	<description>Opinions and views about computers, writing SciFi and everything else.</description>
	<lastBuildDate>Wed, 08 Feb 2012 06:43:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.pdark.de' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/7741f06d762e6a53700b2915f21e3d77?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Dark Views &#187; Python</title>
		<link>http://blog.pdark.de</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.pdark.de/osd.xml" title="Dark Views" />
	<atom:link rel='hub' href='http://blog.pdark.de/?pushpress=hub'/>
		<item>
		<title>Boo</title>
		<link>http://blog.pdark.de/2011/07/08/boo/</link>
		<comments>http://blog.pdark.de/2011/07/08/boo/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 19:34:21 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Boo]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=2191</guid>
		<description><![CDATA[It seems a dream of mine has come true: A language like Python, compiled into something that can be executed as fast as Java or C++ and which allows to extend the compiler at compile time. Ladies and gentlemen, please a warm welcome for Boo. Guess I&#8217;ve found a reason to install Mono. Tagged: Boo, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=2191&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It seems a dream of mine has come true: A language like <a class="zem_slink" title="Python (programming language)" href="http://www.python.org/" rel="homepage">Python</a>, compiled into something that can be executed as fast as Java or C++ and which allows to extend the compiler at compile time.</p>
<p>Ladies and gentlemen, please a warm welcome for <a href="http://boo.codehaus.org/Getting+Started" target="_blank">Boo</a>.</p>
<p>Guess I&#8217;ve found a reason to install <a href="http://www.mono-project.com/Main_Page" target="_blank">Mono</a>.</p>
<br /> Tagged: <a href='http://blog.pdark.de/tag/boo/'>Boo</a>, <a href='http://blog.pdark.de/tag/programming/'>Programming</a>, <a href='http://blog.pdark.de/tag/python/'>Python</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/2191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/2191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/2191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/2191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/2191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/2191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/2191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/2191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/2191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/2191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/2191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/2191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/2191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/2191/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=2191&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2011/07/08/boo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>Maven Tools for Eclipse: M2 Repository Analysis And Dependency Management</title>
		<link>http://blog.pdark.de/2011/05/13/maven-tools-for-eclipse-m2-repository-analysis-and-dependency-management/</link>
		<comments>http://blog.pdark.de/2011/05/13/maven-tools-for-eclipse-m2-repository-analysis-and-dependency-management/#comments</comments>
		<pubDate>Fri, 13 May 2011 13:11:20 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Apache Maven]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[plug-ins]]></category>
		<category><![CDATA[Project Dash]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=1952</guid>
		<description><![CDATA[I&#8217;ve finished RC1 of my set of tools to import Eclipse plug-ins into Maven 2 repositories. You can find the source on github. It needs Python 2.7 and lxml. pip is your friend. The new features: There is now a tool to analyze the M2 repository for oddities. Currently, it can find these issues: Dependencies which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=1952&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finished RC1 of my set of tools to import <a class="zem_slink" title="Eclipse (software)" href="http://www.eclipse.org" rel="homepage">Eclipse</a> plug-ins into Maven 2 repositories. You can find the <a href="https://github.com/digulla/org.eclipse.dash.m4e.tools" target="_blank">source on github</a>. It needs <a href="http://www.python.org/" target="_blank">Python 2.7</a> and <a href="http://lxml.de/" target="_blank">lxml</a>. <a href="http://www.pip-installer.org/" target="_blank">pip</a> is your friend.</p>
<p>The new features: There is now a tool to analyze the M2 repository for oddities. Currently, it can find these issues:</p>
<ul>
<li>Dependencies which are used but not part of the repository</li>
<li>Dependencies which are used with different versions or version ranges (i.e. when one POM includes a dependency with 1.0 and another POM pulls in the very same dependency with version 1.1)</li>
<li>Dependencies which are used without versions or version ranges or a catch-all version like [0,)</li>
<li>Several versions of the same artifact in the repository</li>
</ul>
<p>Plus it prints a list of all POMs in the repo with files (jar, pom, sources, test-sources, &#8230;). Here is a <a href="http://maven.eclipse.org/m2repo-analysis-20110513-050244.html" target="_blank">sample report</a>.</p>
<p>The last tool can create a POM file with a <a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies" target="_blank">dependencyManagement element</a> containing the versions of the POMs in the repository. You can use this to nail down all versions to the ones existing in your repository (so you don&#8217;t accidentally pull in something you don&#8217;t want).</p>
<p>Lastly, I&#8217;ve enhanced the patch tool. Instead of overwriting replaced dependencies, it will now move them into a new profile. This way, users of the repository can specify which dependency they want (the one from the repository or, say, one from Maven Central).</p>
<p>I will try to build a new testing repo over the weekend so we can start wrapping up the necessary patches for a release.</p>
<p>Related posts: <a title="Permanent Link to Eclipse 3.6.2 Artifacts for Maven 2" href="http://blog.pdark.de/2011/03/20/eclipse-3-6-2-artifacts-for-maven-2/" rel="bookmark">Eclipse 3.6.2 Artifacts for Maven 2</a></p>
<br /> Tagged: <a href='http://blog.pdark.de/tag/apache-maven/'>Apache Maven</a>, <a href='http://blog.pdark.de/tag/eclipse/'>Eclipse</a>, <a href='http://blog.pdark.de/tag/java/'>Java</a>, <a href='http://blog.pdark.de/tag/plug-ins/'>plug-ins</a>, <a href='http://blog.pdark.de/tag/project-dash/'>Project Dash</a>, <a href='http://blog.pdark.de/tag/python/'>Python</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/1952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/1952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/1952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/1952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/1952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/1952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/1952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/1952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/1952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/1952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/1952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/1952/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/1952/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/1952/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=1952&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2011/05/13/maven-tools-for-eclipse-m2-repository-analysis-and-dependency-management/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>Numpty Physics</title>
		<link>http://blog.pdark.de/2011/03/17/numpty-physics/</link>
		<comments>http://blog.pdark.de/2011/03/17/numpty-physics/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 20:09:59 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Game]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Numpty Physics]]></category>
		<category><![CDATA[Physics]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=1831</guid>
		<description><![CDATA[I really liked Crayon Physics. It was simple idea, great brain teaser, the perfect UI. If you liked it as well, have a look at Numpty Physics. Tagged: Game, Linux, Numpty Physics, Physics, Python<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=1831&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I really liked <a href="http://kloonigames.com/crayon">Crayon Physics</a>. It was simple idea, great brain teaser, the perfect UI.<a href="http://numptyphysics.garage.maemo.org/"><img class="alignnone" title="Start Screen" src="http://numptyphysics.garage.maemo.org/images/np_title.jpg" alt="" width="480" height="288" /></a></p>
<p>If you liked it as well, have a look at <a href="http://numptyphysics.garage.maemo.org/">Numpty Physics</a>.</p>
<br /> Tagged: <a href='http://blog.pdark.de/tag/game/'>Game</a>, <a href='http://blog.pdark.de/tag/linux/'>Linux</a>, <a href='http://blog.pdark.de/tag/numpty-physics/'>Numpty Physics</a>, <a href='http://blog.pdark.de/tag/physics/'>Physics</a>, <a href='http://blog.pdark.de/tag/python/'>Python</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/1831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/1831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/1831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/1831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/1831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/1831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/1831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/1831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/1831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/1831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/1831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/1831/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/1831/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/1831/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=1831&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2011/03/17/numpty-physics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>

		<media:content url="http://numptyphysics.garage.maemo.org/images/np_title.jpg" medium="image">
			<media:title type="html">Start Screen</media:title>
		</media:content>
	</item>
		<item>
		<title>pygments syntax highlighting</title>
		<link>http://blog.pdark.de/2011/01/04/pygments-syntax-highlighting/</link>
		<comments>http://blog.pdark.de/2011/01/04/pygments-syntax-highlighting/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 20:03:26 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Pygments]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Syntax Highlighting]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=1662</guid>
		<description><![CDATA[Need a good syntax highlighter? Check out Pygments. Tagged: Pygments, Python, Syntax Highlighting<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=1662&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Need a good syntax highlighter? Check out <a href="http://pygments.org/">Pygments</a>.</p>
<br /> Tagged: <a href='http://blog.pdark.de/tag/pygments/'>Pygments</a>, <a href='http://blog.pdark.de/tag/python/'>Python</a>, <a href='http://blog.pdark.de/tag/syntax-highlighting/'>Syntax Highlighting</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/1662/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/1662/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/1662/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/1662/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/1662/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/1662/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/1662/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/1662/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/1662/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/1662/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/1662/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/1662/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/1662/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/1662/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=1662&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2011/01/04/pygments-syntax-highlighting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>The Python Module of the Week Blog</title>
		<link>http://blog.pdark.de/2010/03/17/the-python-module-of-the-week-blog/</link>
		<comments>http://blog.pdark.de/2010/03/17/the-python-module-of-the-week-blog/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 10:16:02 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[PyMOTW]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=854</guid>
		<description><![CDATA[If you love Python, this blog is for you: Doug Hellmann posts about one Python module every week (PyMOTW). The posts contain lots of real world examples how to use a module. This week, it&#8217;s ElementTree. Tagged: PyMOTW, Python<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=854&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you love <a href="http://www.python.org/">Python</a>, this blog is for you: <a href="http://blog.doughellmann.com/">Doug Hellmann</a> posts about one Python module every week (PyMOTW). The posts contain lots of real world examples how to use a module. This week, it&#8217;s <a href="http://blog.doughellmann.com/2010/03/pymotw-parsing-xml-documents-with.html">ElementTree</a>.</p>
<br /> Tagged: <a href='http://blog.pdark.de/tag/pymotw/'>PyMOTW</a>, <a href='http://blog.pdark.de/tag/python/'>Python</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/854/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=854&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2010/03/17/the-python-module-of-the-week-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>PyScan 0.6</title>
		<link>http://blog.pdark.de/2009/10/10/pyscan-0-6/</link>
		<comments>http://blog.pdark.de/2009/10/10/pyscan-0-6/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 15:50:52 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[HP]]></category>
		<category><![CDATA[hplip]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PyQt4]]></category>
		<category><![CDATA[PyScan]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SANE]]></category>
		<category><![CDATA[Scanner]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=717</guid>
		<description><![CDATA[I&#8217;ve done some more work on PyScan. Most work is under the hood but I&#8217;ve got a system to load and save projects and a bug was fixed: If you pressed the Scan button too quickly with 0.4, the last image could have been overwritten. PyScan is now based on hplip 3.9.8. PyScan 0.6.tar.gz (16KB, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=717&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve done some more work on PyScan. Most work is under the hood but I&#8217;ve got a system to load and save projects and a bug was fixed: If you pressed the Scan button too quickly with 0.4, the last image could have been overwritten. PyScan is now based on <a href="http://hplipopensource.com/hplip-web/index.html">hplip 3.9.8</a>.</p>
<p><a href="http://www.pdark.de/PyScan-0.6.tar.gz">PyScan 0.6.tar.gz</a> (16KB, MD5 Sum: 2b5e23099be438ceceb69ec23d64cec6)</p>
<p>See the <a href="http://blog.pdark.de/2009/04/18/pyscan-a-little-helper-for-the-hp-cm1312nfi-mfp-scanner/">original post</a> for features and the system requirements.</p>
<br /> Tagged: HP, hplip, Linux, PyQt4, PyScan, Python, SANE, Scanner <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/717/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/717/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/717/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=717&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/10/10/pyscan-0-6/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>Attaching Sources To Eclipse Artifacts</title>
		<link>http://blog.pdark.de/2009/10/08/attaching-sources-to-eclipse-artifacts/</link>
		<comments>http://blog.pdark.de/2009/10/08/attaching-sources-to-eclipse-artifacts/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 08:14:56 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Maven2]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=713</guid>
		<description><![CDATA[After running mvn eclipse:make-artifacts -DstripQualifier=true -DeclipseDir=...path/to/eclipse, you might have lots of source JARs but they aren&#8217;t in the right place for Maven 2 to pick them up. This little Python script fixes that. Just run it after eclipse:make-artifacts. Note: You may be wondering why I use eclipse:make-artifacts instead of the recommended eclipse:to-maven. Simple: I don&#8217;t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=713&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After running <code>mvn eclipse:make-artifacts -DstripQualifier=true -DeclipseDir=...path/to/eclipse</code>, you might have lots of source JARs but they aren&#8217;t in the right place for <a href="http://maven.apache.org/">Maven 2</a> to pick them up.</p>
<p>This little Python script fixes that. Just run it after <code>eclipse:make-artifacts</code>.</p>
<p><strong>Note:</strong> You may be wondering why I use <code>eclipse:make-artifacts</code> instead of the recommended <code>eclipse:to-maven</code>. Simple: I don&#8217;t like to have a dozen <code>core-*.jar</code> in my project.</p>
<p><pre class="brush: python;">
&quot;&quot;&quot;Maven 2 Eclipse Artifact Source resolver

After importing Eclipse artifacts into an M2 repository with

&gt; mvn eclipse:make-artifacts -DstripQualifier=true -DeclipseDir=.../eclipse

run this script to move all source JARs in the right place for
Maven 2 to pick them up.
&quot;&quot;&quot;
import os, sys
from shutil import copyfile

def processGroup(path):
    print 'group %s' % path
    for dir in os.listdir(path):
        path2 = os.path.join(path, dir)
        if '.' in dir:
            processArtifact(path2)
        else:
            processGroup(path2)

def processArtifact(path):
    srcPath = path + '.source'
    #print 'processArtifact',srcPath
    if os.path.exists(srcPath):
        processArtifactWithSource(path)

def processArtifactWithSource(basePath):
    binPath = basePath
    srcPath = basePath + '.source'
    baseName = os.path.basename(basePath)
    print 'artifact', baseName
    
    for version in os.listdir(binPath):
        vbinPath = os.path.join(binPath, version)
        vsrcPath = os.path.join(srcPath, version)
        
        srcJar = os.path.join(vsrcPath, '%s.source-%s.jar' % (baseName, version))
        destJar = os.path.join(vbinPath, '%s-%s-sources.jar' % (baseName, version))
        
        if os.path.exists(srcJar):
            print '%s -&gt; %s' % (srcJar, destJar)
            copyfile(srcJar, destJar)

m2repo = os.environ['M2_REPO']
if not m2repo:
    raise Exception('Env variable M2_REPO is not set')

root = os.path.join(m2repo, 'org', 'eclipse')
for dir in os.listdir(root):
    path = os.path.join(root, dir)
    processGroup(path)
</pre></p>
<p>Updated 01. December 2009: The script now figures out where your M2 repo is. Plus a minimum of documentation.</p>
<br /> Tagged: Eclipse, Maven2, Python <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/713/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/713/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/713/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=713&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/10/08/attaching-sources-to-eclipse-artifacts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>Printing Big Stuff On Linux</title>
		<link>http://blog.pdark.de/2009/06/22/printing-big-stuff-on-linux/</link>
		<comments>http://blog.pdark.de/2009/06/22/printing-big-stuff-on-linux/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 09:45:36 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[GenealogyJ]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[graphviz]]></category>
		<category><![CDATA[Inkscape]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[poster]]></category>
		<category><![CDATA[Printing]]></category>
		<category><![CDATA[pstops]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=629</guid>
		<description><![CDATA[During the weekend, I tried to print my family tree. It was pretty simple to generate with GenealogyJ but frankly, the family tree view sucks. I was constantly shifting my &#8220;root&#8221; node to be able to see the parts I was interested in, etc. And printing this sucks even more. GJ will use lots of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=629&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>During the weekend, I tried to print my family tree. It was pretty simple to generate with <a href="http://genj.sourceforge.net/">GenealogyJ</a> but frankly, the family tree view sucks. I was constantly shifting my &#8220;root&#8221; node to be able to see the parts I was interested in, etc. And printing this sucks even more. GJ will use lots of paper, printing huge empty boxes with lots of space around them. If I reduced the size of the parts which I don&#8217;t need, the layout fell apart. In short, I needed something better.</p>
<p><a href="http://www.graphviz.org/">Graphviz</a> to the rescue. A small <a href="http://www.python.org/">Python</a> program (100 lines) read the GED file and turned it into a graph with the layout of the persons just the way I wanted them to be. dot thought about the graph for a few seconds until it emitted a nice SVG which I could then print. Or so I thought.</p>
<p>I opened <a href="http://www.inkscape.org/">Inkscape</a> and clicked on print. Yeah &#8230; that looks like the document &#8230; or rather a small part of it. Where is the poster print option? Ah, there is none. Great. Export as PNG with &#8230; oh &#8230; 150 DPI. Starting <a href="http://www.gimp.org/">GIMP</a>. No poster printing either. lpr tries to scale the image by .114537 which results in a 87 MB file. You gotta be kidding! <a href="http://printing.kde.org/overview/kprinter.php">kprinter</a>? Nope &#8230; unless the command poster can be found.</p>
<p>A word of warning: The poster for openSUSE 11.1 (which you get with zypper) is broken. I tried it with both PostScript and Encapsulated PostScript and both resulting files were unusable in GhostView, GhostScript and Okular. Use <a href="http://printing.kde.org/downloads/">this one instead</a>.</p>
<p>After installing psutils, I could rotate the file to fit better on the page, too.</p>
<p>Conclusion: Most programs on Linux create PostScript files but printing them is still something for the command line. The recent print dialogs all look somewhat similar (but are different in tiny, annoying ways), each version is missing some important detail and most of them fail to simply print an oversized image on a single piece of paper or spread it over several. That Inkscape  spits out an empty page after the document is just a minor issue.</p>
<p>What&#8217;s worse: The print preview either doesn&#8217;t work or doesn&#8217;t exist, printing to file is not implemented either or isn&#8217;t persistent. In the whole process, I ruined roughly 50 sheets of paper. *sigh*</p>
<p>In the end, I had a process which involved six different programs (GenealogyJ, Python, graphviz, Inkscape, pstops, poster) just for this standard task. Printing on Linux has some way to go, yet. On the positive side, I could script all these tasks and I <em>could</em> do it.</p>
<br /> Tagged: GenealogyJ, GIMP, graphviz, Inkscape, Linux, poster, Printing, pstops, Python <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/629/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/629/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/629/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=629&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/06/22/printing-big-stuff-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>PyScan: A Little Helper For The HP CM1312nfi MFP Scanner</title>
		<link>http://blog.pdark.de/2009/04/18/pyscan-a-little-helper-for-the-hp-cm1312nfi-mfp-scanner/</link>
		<comments>http://blog.pdark.de/2009/04/18/pyscan-a-little-helper-for-the-hp-cm1312nfi-mfp-scanner/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 21:20:09 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[HP]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PIL]]></category>
		<category><![CDATA[PyQt4]]></category>
		<category><![CDATA[PyScan]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SANE]]></category>
		<category><![CDATA[Scanner]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=586</guid>
		<description><![CDATA[Update: Find the latest version (0.6) here. I recently bought a HP CM1312nfi MFP scanner (multi function device with scanner and color laser printer). After scanning some 1&#8217;000 pages, I&#8217;m still satisfied with the device. The document feeder (ADF) sometimes tries to eat the paper after spitting it out and the colors could be a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=586&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Update: <a href="http://blog.pdark.de/2009/10/10/pyscan-0-6/">Find the latest version (0.6) here</a>.</p>
<p>I recently bought a<a title="Permanent Link to hpaio: unable to read device-id" rel="bookmark" href="http://blog.pdark.de/2009/03/21/hpaio-unable-to-read-device-id/"> HP CM1312nfi MFP scanner</a> (multi function device with scanner and color laser printer). After scanning some 1&#8217;000 pages, I&#8217;m still satisfied with the device. The document feeder (ADF) sometimes tries to eat the paper after spitting it out and the colors could be a little more brilliant but overall, a good deal for the price.</p>
<p>What bothered me was that the &#8220;Start scan&#8221; button <a href="https://bugs.launchpad.net/hplip/+bug/256541">doesn&#8217;t work on Linux</a>. But someone posted a script in the bug report which can poll the button by reading the URL <strong>http://$ip/hp/device/notifications.xml</strong> (replace &#8220;$ip&#8221; with the IP address or DNS name of the scanner). This returns some XML with two interesting elements: <strong>StartScan</strong> and <strong>ADFLoaded</strong>. The first one becomes 1 when someone presses the &#8220;Start scan&#8221; button on the scanner and the second one tells us whether there is some paper in the ADF.</p>
<p>With that and some source code, it was simple to create a little tool that works quite like <a href="http://www.xsane.org/">xsane</a> but fixes a couple of things that annoyed me for a long time:</p>
<ol>
<li>The UI of xsane is dead while it scans</li>
<li>There is no online preview of the scan; you have to open the file in some extra tool to verify that the scan looks OK</li>
<li>xsane doesn&#8217;t know about scan &#8220;projects&#8221;</li>
<li>xsane doesn&#8217;t start to scan when I press the button on the scanner</li>
</ol>
<p>As with all OSS software, this thing can seriously ruin your day, so be a bit careful. One of the biggest problems is the file size: To be able to edit files without loss of quality, TIFF format is the default. Each full page scan takes 26MB, 100 pages need 2.6GB!</p>
<p>Plans for 0.5: Allow to edit projects in the UI, select them, save and load them. Right now, you must define your projects via the command line or by editing the source code.</p>
<p>Download: <a href="http://www.pdark.de/PyScan-0.4.tar.gz">PyScan-0.4.tar.gz</a> (12KB, <a href="http://www.pdark.de/PyScan-0.4.md5">MD5 checksum</a>)</p>
<p>Dependencies (see README.txt for download links):</p>
<ul>
<li>Python 2.6</li>
<li>PyQt4 4.4.3</li>
<li>Python Imaging Library 1.1.6</li>
<li>Python Imaging SANE 1.1.6 (needs included patch; see README.txt for instructions).</li>
</ul>
<h3>Features</h3>
<ul>
<li>Code to load images in a background thread, generate thumbnails (compatible to Konqueror/Dolphin) and display them in a list view</li>
<li>Display a (big) image with various manual and automatic zoom levels and modes (fit to window, percent) with zoom and pan</li>
<li>Online preview of scan in progress</li>
</ul>
<h3>Hideous details of the source</h3>
<p>Again and again, I&#8217;m astonished how simple some tasks are in Python and Qt &#8230; if you&#8217;re willing to accept some &#8220;non-OO-ness&#8221; of the solution. I&#8217;ll explain some things I did here to give you an idea what&#8217;s going on.</p>
<h3>Online preview</h3>
<p>PyScan has an online preview of the currently active scan. If you look at the documentation, the Python Imaging SANE interface offers no way to do that. After looking at the source, I found that the SANE interface simply reads bytes from the SANE scanner module and copies these into a PIL image which was created on the Python side.</p>
<p>So my solution is to be notified that a scan is in progress and then copy said image every second (all 26MB) into a string. That string is then used to build a QImage which is turned into a QPixmap which is then displayed in the right pixmap view. See pilImage2QImage() for the details.</p>
<h3>Background threads</h3>
<p>I also moved all expensive code into threads: Loading big TIFF images, scaling them down to thumbnails, saving the images, etc. All threads have a method to add work to their input queues and they send Qt signals when they&#8217;re done. Continuing the scanning when there is paper in the ADF tray was a bit of a problem, through.</p>
<p>Since the saving of the images is happening in a background thread, the code could start the next scan before the saving was completed. This wasn&#8217;t such a big problem except that the &#8220;scan next image&#8221; code looks for files on the disk to determine the next filename. This would lead to overwrites. So I had to synchronize this somehow. My simple hack was to set a boolean &#8220;waiting&#8221; in the scanner thread which indicates that the scanner has more paper to process and waits for the save thread to complete. When the UI gets the &#8220;image saved&#8221; signal, it triggers the scanner to continue.</p>
<h3>Generating thumbnails</h3>
<p>The last hack in the code is the generation of the thumbnails. The main issue here was that I need the thumbnails for the gallery view really deep down in the Qt render code. Wasting time at that level is really a no-no but at first glance, the API offers no way to defer loading of the images and then later update the items in the list view when the data is available. Keep in mind what I need to do:</p>
<ol>
<li>Load a 26MB file from disk</li>
<li>Scale it with antialiasing</li>
<li>&#8230; for hundreds, possibly thousands of files!</li>
</ol>
<p>My solution: In the render code, I create a <strong>LazyPixmap</strong>. This is just dumb object to save the filename and a placeholder pixmap which is used into the real thumbnail becomes available. The <strong>LazyPixmap</strong> will schedule a job for the <strong>LoaderThread</strong>.</p>
<p>In my first code, I tried to create a <strong>QPixmap</strong> in the <strong>LoaderThread</strong> but that doesn&#8217;t work: Only the UI thread is allowed to create a <strong>QPixmap</strong>. Duh. But luckily, Qt offers the <strong>QImage</strong> class which works even without a UI and which offers basically the same API as <strong>QPixmap</strong>. So the <strong>LoaderThread</strong> can load the image from disk and scale it down (to save memory and avoid heavy computation in the UI thread) right before emitting a &#8220;loaded&#8221; signal.</p>
<p>There are two places where a <strong>LazyPixmap</strong> is used: In the <strong>PixmapWidget</strong> (which can display and zoom a <strong>QPixmap</strong>) and in the <strong>ThumbnailDelegate</strong> which draws the thumbnails for the filenames in the <strong>GalleryModel</strong>.</p>
<p>In the case of the <strong>PixmapWidget</strong>, the signal will be handled in <strong>lazyLoaded()</strong>. Here, we convert the <strong>QImage</strong> into a <strong>QPixmap</strong> (in <strong>lpm.getPixmap()</strong>) and assign that pixmap, recalculate the zoom factor, realign the view, etc.</p>
<p>The <strong>GalleryModel, </strong>I have the problem that I need to tell Qt somehow that the pixmap has changed but the API offers nothing except rendering the whole widget by calling <strong>update()</strong>. This will render at most (on a huge screen) 30 pixmaps. Happens one time per visible pixmap, causes no flicker. Probably not worth to waste another second on it.</p>
<p>If you look at the code, you&#8217;ll see that a class called <strong>KDEThumbnailCache</strong> is used. This class accesses the same thumbnails als konqueror (KDE3) or Dolphin (KDE4). This means once the images are scaled down (either by my code or Dolphin), all tools can quickly load the small, precalculated thumbnails instead of having to scale the 26MB files <em>again</em>.</p>
<h3>Conclusion</h3>
<p>Well, that&#8217;s it for a small walk through the code. Feel free to give feedback if you like PyScan (or not) or when you have patches.</p>
<br /> Tagged: HP, Linux, PIL, PyQt4, PyScan, Python, SANE, Scanner <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/586/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=586&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/04/18/pyscan-a-little-helper-for-the-hp-cm1312nfi-mfp-scanner/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
		<item>
		<title>Subtext: Visual Programming, New Angle</title>
		<link>http://blog.pdark.de/2009/03/02/subtext-visual-programming-new-angle/</link>
		<comments>http://blog.pdark.de/2009/03/02/subtext-visual-programming-new-angle/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 16:06:54 +0000</pubDate>
		<dc:creator>digulla</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Subtext]]></category>

		<guid isPermaLink="false">http://blog.pdark.de/?p=553</guid>
		<description><![CDATA[If you have no idea what subtext is, lean back and watch this presentation. It&#8217;s nice to finally find another person concerned about the state of programming languages. I started with C, toyed a bit with some other languages, moved to Java and today, I&#8217;m working mostly with Java, Groovy and Python. I&#8217;m doing all [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=553&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you have no idea what subtext is, lean back and <a href="http://subtextual.org/subtext2.html">watch this presentation</a>.</p>
<p>It&#8217;s nice to finally find another person concerned about the state of programming languages. I started with C, toyed a bit with some other languages, moved to Java and today, I&#8217;m working mostly with Java, Groovy and Python. I&#8217;m doing all my spare-time code in Python. Why Python? Because I get more bang for the key press. And my spare time is most valuable.</p>
<p>So while I thoroughly agree that the idea of subtext is convincing, it&#8217;s too limiting at the same time: There are simple problems which you can&#8217;t express well in subtext, for example: A switch with 10 cases and some complex code in each case. It would just become too wide. The same applies when formulas have more than ten parameters. You&#8217;re flow tree looks nice but it takes more screen real estate than the &#8220;traditional&#8221; version.</p>
<p>So my argument is that we need a way to choose. Software projects need to give up the holy grail of &#8220;one language to rule them all&#8221; but the IDE should allow to mix and match various languages and more complex &#8220;objects&#8221; like tables, rich text, animations. Why do I have to waste my time formatting tabular content in a Java file (think array of values) when I can have Excel? Why can&#8217;t Java read the data directly from Excel? Why can&#8217;t I embed Excel tables in Java source code and access them like a primitive array? Why can&#8217;t I use a rich word processor to write my comments? Why is TAB 1-8 spaces instead of &#8220;one level of indent&#8221;? Why do I have to use braces when I already indent my code?</p>
<p>Because our computers are not powerful enough today. With every key we press, we have to worry about RAM and performance. Because companies still believe in lock in. Sun would probably add a cross-platform COM API into Java but will Microsoft port Excel to any platform where a Java compiler is available? Oh, we could use OpenOffice. Let&#8217;s see. People working for a software development company that has more then two employees: Comment here if your company policy allows to use OO instead of Office. Now let&#8217;s see how long it takes to get 10 comments.</p>
<p>In the end, what we have today is the most simple thing that actually works and doesn&#8217;t take too much RAM. I hope the time is ripe for the next step. I&#8217;m sick of fixed-width fonts, curly braces and source code which is 1% functionality and 99% &#8220;make the damn compiler happy&#8221;.</p>
<br /> Tagged: Python, Software Development, Subtext <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/darkviews.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/darkviews.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/darkviews.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/darkviews.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/darkviews.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/darkviews.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/darkviews.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/darkviews.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/darkviews.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/darkviews.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/darkviews.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/darkviews.wordpress.com/553/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/darkviews.wordpress.com/553/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/darkviews.wordpress.com/553/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.pdark.de&amp;blog=6384723&amp;post=553&amp;subd=darkviews&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.pdark.de/2009/03/02/subtext-visual-programming-new-angle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/8a4d6f03a8879432d8563aefbf48e787?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">digulla</media:title>
		</media:content>
	</item>
	</channel>
</rss>
