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

<channel>
	<title>Johann Philipp Strathausen</title>
	<atom:link href="http://www.strathausen.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.strathausen.eu</link>
	<description>blogging in the internet since 2009</description>
	<lastBuildDate>Thu, 15 Dec 2011 06:53:15 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>(English) Colours for the node console</title>
		<link>http://www.strathausen.eu/2011/12/15/culoar/</link>
		<comments>http://www.strathausen.eu/2011/12/15/culoar/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 06:51:46 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Entwicklung]]></category>

		<guid isPermaLink="false">http://www.strathausen.eu/?p=295</guid>
		<description><![CDATA[Leider ist der Eintrag nur auf English verfügbar.]]></description>
			<content:encoded><![CDATA[<p>Leider ist der Eintrag nur auf <a href="http://www.strathausen.eu/en/feed/">English</a> verfügbar.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2011/12/15/culoar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(English) Hiding the gedit tabbar</title>
		<link>http://www.strathausen.eu/2011/09/08/english-hiding-the-gedit-tabbar/</link>
		<comments>http://www.strathausen.eu/2011/09/08/english-hiding-the-gedit-tabbar/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 07:24:41 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Entwicklung]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.strathausen.eu/?p=291</guid>
		<description><![CDATA[Some time ago I&#8217;ve noticed that the tabbar in gedit would always be there, even when there&#8217;s only one file open in a window, and the &#8220;remove tabbar&#8221; plug-in won&#8217;t help either. Until I stumbled upon this post mentioning the all fameous LaTeX plug-in to be responsible for that. And in fact, that was it! [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago I&#8217;ve noticed that the tabbar in gedit would always be there, even when there&#8217;s only one file open in a window, and the &#8220;remove tabbar&#8221; plug-in won&#8217;t help either. Until I stumbled upon <a href="http://ubuntuforums.org/showpost.php?p=10125090&#038;postcount=7">this post</a> mentioning the all fameous <a href="http://live.gnome.org/Gedit/LaTeXPlugin">LaTeX plug-in</a> to be responsible for that. And in fact, that was it! For some reason, the LaTeX plug-in will make the tabbar always show up. Looking into this now, probably just a small change to that plug-in&#8230; or maybe it has even been fixed in the latest code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2011/09/08/english-hiding-the-gedit-tabbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drei</title>
		<link>http://www.strathausen.eu/2010/08/17/drei/</link>
		<comments>http://www.strathausen.eu/2010/08/17/drei/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 17:31:16 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Kreativität]]></category>
		<category><![CDATA[Spaß]]></category>
		<category><![CDATA[animal]]></category>
		<category><![CDATA[atomkraft]]></category>
		<category><![CDATA[cow]]></category>
		<category><![CDATA[environmental]]></category>
		<category><![CDATA[fukushima]]></category>
		<category><![CDATA[genetic]]></category>
		<category><![CDATA[mutation]]></category>
		<category><![CDATA[nuclear power]]></category>
		<category><![CDATA[pollution]]></category>
		<category><![CDATA[tchernobil]]></category>
		<category><![CDATA[ucraine]]></category>
		<category><![CDATA[umwelt]]></category>

		<guid isPermaLink="false">http://www.strathausen.eu/?p=257</guid>
		<description><![CDATA[Hier ist ein kleines Bild, welches ich vor einiger Zeit gezeichnet habe.]]></description>
			<content:encoded><![CDATA[<p>Hier ist ein kleines Bild, welches ich vor einiger Zeit gezeichnet habe.</p>
<p style="text-align: center;"><a href="http://www.strathausen.eu/wp-content/uploads/2010/08/drei.jpg" rel="lightbox[257]"><img class="size-medium wp-image-259 aligncenter" title="drei" src="http://www.strathausen.eu/wp-content/uploads/2010/08/drei-300x209.jpg" alt="Aller guten Dinge sind drei" width="300" height="209" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2010/08/17/drei/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gutscheine für Prosite (Web-Hosting)</title>
		<link>http://www.strathausen.eu/2010/08/16/gutscheine-fur-prosite-web-hosting/</link>
		<comments>http://www.strathausen.eu/2010/08/16/gutscheine-fur-prosite-web-hosting/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 19:51:45 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Dies und das]]></category>
		<category><![CDATA[blog domain]]></category>
		<category><![CDATA[discount hosting]]></category>
		<category><![CDATA[gutschein]]></category>
		<category><![CDATA[gutscheine]]></category>
		<category><![CDATA[kostenlose domain]]></category>
		<category><![CDATA[kostenlose top-level-domain]]></category>
		<category><![CDATA[prosite]]></category>
		<category><![CDATA[v-server]]></category>
		<category><![CDATA[wordpress hosting]]></category>

		<guid isPermaLink="false">http://www.strathausen.eu/?p=251</guid>
		<description><![CDATA[Neulich fiel mir auf, dass ich von meinem netten Webhoster (prosite.de) eine Menge Gutscheine bekommen habe, die ich gar nicht benutzt bzw. verbraucht habe. Falls also jemand Interesse hat oder das braucht, hier sind sie nun (weiter unten). Welche davon noch Gültig sind, einfach ausprobieren, denn mit falschen Gutscheincodes funktioniert die Bestellung nicht! Man kann [...]]]></description>
			<content:encoded><![CDATA[<p>Neulich fiel mir auf, dass ich von meinem netten Webhoster (prosite.de) eine Menge Gutscheine bekommen habe, die ich gar nicht benutzt bzw. verbraucht habe.<span id="more-251"></span> Falls also jemand Interesse hat oder das braucht, hier sind sie nun (weiter unten). Welche davon noch Gültig sind, einfach ausprobieren, denn mit falschen Gutscheincodes funktioniert die Bestellung nicht! Man kann unten auf der Bestellseite die Gutscheine einfach mit angeben. Die Produkte sind sehr günstig, wenn auch manche Angebote die typischen Lockangebote haben (erstes Jahr kostenlos o.ä.), einfach mal genau hinschauen und dann passt das schon. Mit dem Service war ich immer sehr zufrieden, schnelle Antwortzeiten, kostenloser Support usw., keine Ausfälle, sehr zuverlässig! Übrigens haben sie auch eine<em> kostenlose echte Top-Level-Domain</em> mit einem WordPress-Blog.</p>
<p>Die Adresse:<strong> </strong><a href="http://www.prosite.de"><strong>www.prosite.de</strong></a></p>
<p>Im Einzelnen haben die Gutscheine folgende Werte &#8211; und das dauerhaft (!):</p>
<p>Dynamic Webspace &#8211; 1 Euro monatlich<br />
Webspace L       &#8211; 2 Euro monatlich<br />
Webspace XL      &#8211; 5 Euro monatlich<br />
Webspace XXL     &#8211; 8 Euro monatlich</p>
<p>V-Server S       &#8211; 2 Euro monatlich<br />
V-Server M       &#8211; 4 Euro monatlich<br />
V-Server L       &#8211; 6 Euro monatlich</p>
<p>Root Server S    &#8211; 10 Euro monatlich<br />
Root Server M    &#8211; 15 Euro monatlich<br />
Root Server L    &#8211; 20 Euro monatlich</p>
<p>Hier sind die Gutscheine, die obersten sind die neusten:</p>
<p><strong>PR9ccfad<br />
PR02aa58<br />
PR2f89d5</strong></p>
<p><strong>PRbce26b<br />
PRc00101<br />
PRfa1e6a</strong></p>
<p><strong>PR9ae201<br />
PR2d9d4b<br />
PR8e648c</strong></p>
<p><strong>PR8d585a<br />
PRc44fc8<br />
PR789cb9</strong></p>
<p><strong>PR6bea43<br />
PR743df7<br />
PR360603</strong></p>
<p><strong>PRd3aacd<br />
PR3ce125<br />
PR032130</strong></p>
<p><strong>PR1d740e<br />
PR39aea9<br />
PR523eee</strong></p>
<p><strong>PR1e1836<br />
PRd1314e<br />
PR846b6e</strong></p>
<p><strong>PRef432a<br />
PR69d518<br />
PR838d89</strong></p>
<p>PRc0836b33<br />
PRad322ec8<br />
PRb6a2d46c<br />
PRc3755a31<br />
PR030ac02b</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2010/08/16/gutscheine-fur-prosite-web-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mein neuer Netzladen: Handgefärbte Stoffe für Quilts und Patchworks</title>
		<link>http://www.strathausen.eu/2010/08/07/unikatstoff/</link>
		<comments>http://www.strathausen.eu/2010/08/07/unikatstoff/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 11:56:14 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Entwicklung]]></category>
		<category><![CDATA[Kreativität]]></category>
		<category><![CDATA[Neuigkeiten]]></category>
		<category><![CDATA[batik]]></category>
		<category><![CDATA[einzigartig]]></category>
		<category><![CDATA[handgefärbt]]></category>
		<category><![CDATA[hobby]]></category>
		<category><![CDATA[künstlerbedarf]]></category>
		<category><![CDATA[paramentik]]></category>
		<category><![CDATA[patchwork]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[quilt]]></category>
		<category><![CDATA[stoff]]></category>
		<category><![CDATA[unikatstoff]]></category>

		<guid isPermaLink="false">http://www.strathausen.eu/?p=239</guid>
		<description><![CDATA[Liebe Leute. Soeben habe ich meinen ersten Online-Shop eröffnet, welcher ab sofort eine Vielzahl einzigartiger, handgefärbter Stoffe bietet! Besonders für KünstlerInnen, welche Quilts und Patchworks arbeiten, werden sich dafür interessieren. Die Adresse ist unikatstoff.de ! Die größte Herausforderung dabei war eben jene große Zahl ähnlicher, aber einzigartiger Artikel und diese dem Besucher ansprechend und übersichtlich [...]]]></description>
			<content:encoded><![CDATA[<p>Liebe Leute.</p>
<p>Soeben habe ich meinen ersten Online-Shop eröffnet, welcher ab sofort eine Vielzahl  einzigartiger, handgefärbter Stoffe bietet! Besonders für KünstlerInnen, welche Quilts und Patchworks arbeiten, werden sich dafür interessieren. Die Adresse ist <strong><a href="http://www.unikatstoff.de" target="_blank">unikatstoff.de</a></strong> !</p>
<p><span id="more-239"></span>Die größte Herausforderung dabei war eben jene große Zahl ähnlicher, aber einzigartiger Artikel und diese dem Besucher ansprechend und übersichtlich zu präsentieren. Dazu habe ich das Layout soweit wie möglich reduziert. Die Stoffe werden nun automatisch der Farbe nach sortiert und lassen sich nach einem Klick vergrößern und verschieben. Damit kann der Besucher ähnliche Stoffe leicht gegeneinander vergleichen, falls die Wahl einmal schwer fällt.</p>
<p>Außerdem bin ich weg von den Tabellen und einer spaltenweisen Darstellung gegangen: Die Stoffe fließen von links nach rechts nach unten und füllen somit den Bildschirm optimal aus, ganz gleich welche Größe er hat.</p>
<p style="text-align: center;"><a href="http://www.strathausen.eu/wp-content/uploads/2010/08/bildschuss.png" rel="lightbox[239]"><img class="size-medium wp-image-241 aligncenter" title="bildschuss" src="http://www.strathausen.eu/wp-content/uploads/2010/08/bildschuss-300x151.png" alt="" width="300" height="151" /></a></p>
<p>Unter der Haube sitzt ein kleines Script, wie ich es in einem vorigen Beitrag bereits vorgestellt habe: Es zählt stichprobenartig die Pixel der Bilder und berechnet daraus eine Durchschnittsfarbe, anschließend wird von RGB in den HLS-Farbraum umgerechnet, um die Stoffe einfach auf einer Regenbogenskala zu sortieren. Besonders bei vorwiegend einfarbigen Stoffen funktioniert dieser Ansatz recht gut.</p>
<p>Allerdings muss ein neuer Ansatz für mehrfarbige Stoffe her. Denkbar wäre auch die Einbeziehung menschlicher Gewohnheiten: Helle, kräftige Farben werden beispielsweise stärker wahrgenommen, als dunkle oder blasse. Zudem können ähnliche Stoffe an den anderen Enden der Skala auftauchen &#8211; hier kann nur eine neue Anzeigeform helfen.</p>
<p>Für kleinere Bildschirme sind ebenfalls noch Anpassungen nötig. Die Titelseite ist noch etwas karg, mehr Angebote sind in Arbeit. Aber alles zu seiner Zeit.</p>
<p>Viel Spaß beim Einkaufen!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2010/08/07/unikatstoff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(English) Sort products by colour in web shops</title>
		<link>http://www.strathausen.eu/2010/08/04/sort_by_colour/</link>
		<comments>http://www.strathausen.eu/2010/08/04/sort_by_colour/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 16:24:38 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Entwicklung]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bulk]]></category>
		<category><![CDATA[colour]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[presta]]></category>
		<category><![CDATA[prestashop]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[shop]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[sorting]]></category>
		<category><![CDATA[xt-commerce]]></category>
		<category><![CDATA[xtcommerce]]></category>

		<guid isPermaLink="false">http://www.strathausen.eu/?p=224</guid>
		<description><![CDATA[Many on-line shop systems, like Magento, Prestashop or xt-commerce, lack the ability to automatically sort products by colour. In order to solve this, I wrote a little python script that transforms the average colour of a product image into a scalar, then generates a CSV file including the colour value in some property, allowing it [...]]]></description>
			<content:encoded><![CDATA[<p>Many on-line shop systems, like Magento, Prestashop or xt-commerce, lack the ability to automatically sort products by colour.</p>
<p>In order to solve this, I wrote a little python script that transforms the average colour of a product image into a scalar, then generates a CSV file including the colour value in some property, allowing it to be sorted easily by the web shop system of your choice. Images with many different colours are not sorted very well, but it worked for most of the products in my case.</p>
<p>You can see the script in action at <a href="http://shop.paramentextil.de/9-einfarbige-stoffe-unicolor">shop.paramentextil.de</a>. It generates a CVS file which can be imported by most e-commerce systems. You will certainly have to change the script to your needs, but this should be easy to do even with little programming experience. Changing the sorting mechanism may also be appropriate in some cases. Enjoy.<span id="more-224"></span></p>
<p>And here&#8217;s the script. The product image names must contain numbers functioning as the product ID and the files must reside in a folder structure reflecting your category names. Of course, you can change all that. You will also have to adopt the script to map the category names to product descriptions, category ids or whatever your system requires in order to import the products.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: latin-1 -*-</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> PIL <span style="color: #ff7700;font-weight:bold;">import</span> Image
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">colorsys</span> <span style="color: #ff7700;font-weight:bold;">import</span> rgb_to_hls
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
/<span style="color: #66cc66;">*</span> calculating the average color <span style="color: #66cc66;">*</span>/
<span style="color: #ff7700;font-weight:bold;">def</span> average_hls<span style="color: black;">&#40;</span>f<span style="color: black;">&#41;</span>:
    r, g, b = <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">0</span>
    count = <span style="color: #ff4500;">0</span>
    img = Image.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>f<span style="color: black;">&#41;</span>
    data = img.<span style="color: black;">load</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    /<span style="color: #66cc66;">*</span> you may <span style="color: #ff7700;font-weight:bold;">not</span> need to count <span style="color: #008000;">all</span> the pixels of the image,
        to enhance performance you could also just consider
        every 100th pixel <span style="color: #ff7700;font-weight:bold;">or</span> so... <span style="color: #66cc66;">*</span>/
    <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span>img.<span style="color: black;">size</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> y <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span>img.<span style="color: black;">size</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>:
            tempr,tempg,tempb = data<span style="color: black;">&#91;</span>x,y<span style="color: black;">&#93;</span>
            r += tempr
            g += tempg
            b += tempb
            count += <span style="color: #ff4500;">1</span>
    count <span style="color: #66cc66;">*</span>= <span style="color: #ff4500;">255</span>
    <span style="color: black;">&#40;</span>r, g, b<span style="color: black;">&#41;</span> = <span style="color: black;">&#40;</span><span style="color: #008000;">float</span><span style="color: black;">&#40;</span>r<span style="color: black;">&#41;</span>/count, <span style="color: #008000;">float</span><span style="color: black;">&#40;</span>g<span style="color: black;">&#41;</span>/count, <span style="color: #008000;">float</span><span style="color: black;">&#40;</span>b<span style="color: black;">&#41;</span>/count<span style="color: black;">&#41;</span>
    <span style="color: #808080; font-style: italic;"># calculate averages, convert to hls</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> rgb_to_hls<span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>r/count<span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>g/count<span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>b/count<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    categories = <span style="color: black;">&#123;</span>
/<span style="color: #66cc66;">*</span> Folder name without trailing <span style="color: #483d8b;">&quot;/&quot;</span> <span style="color: #66cc66;">*</span>/
        <span style="color: #483d8b;">'./Category one/Sub category/Sub sub category'</span> : <span style="color: black;">&#123;</span>
            <span style="color: #483d8b;">&quot;categories&quot;</span>:<span style="color: #483d8b;">&quot;9,20&quot;</span>,
            <span style="color: #483d8b;">&quot;short&quot;</span>:<span style="color: #483d8b;">&quot;Unicolor; 100x70cm; &quot;</span>,
            <span style="color: #483d8b;">&quot;desc&quot;</span>:<span style="color: #483d8b;">&quot;Description&quot;</span>,
            <span style="color: #483d8b;">&quot;name&quot;</span>:<span style="color: #483d8b;">&quot;Unicolor 180g&quot;</span>,
            <span style="color: black;">&#125;</span>,
        <span style="color: #483d8b;">'./Category one/Sub category two'</span> : <span style="color: black;">&#123;</span>
            <span style="color: #483d8b;">&quot;categories&quot;</span>:<span style="color: #483d8b;">&quot;11,23&quot;</span>,
            <span style="color: #483d8b;">&quot;short&quot;</span>:<span style="color: #483d8b;">&quot;Multicolor; 100x80cm; 220g&quot;</span>,
            <span style="color: #483d8b;">&quot;desc&quot;</span>:<span style="color: #483d8b;">&quot;Detailed description&quot;</span>,
            <span style="color: #483d8b;">&quot;name&quot;</span>:<span style="color: #483d8b;">&quot;Multicolor 220g&quot;</span>,
            <span style="color: black;">&#125;</span>,
        <span style="color: black;">&#125;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> arg <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span>:
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: black;">&#40;</span>h, l, s<span style="color: black;">&#41;</span> = average_hls<span style="color: black;">&#40;</span>arg<span style="color: black;">&#41;</span>
            entry = arg.<span style="color: black;">rpartition</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/'</span><span style="color: black;">&#41;</span>
/<span style="color: #66cc66;">*</span> <span style="color: #ff7700;font-weight:bold;">for</span> sorting I use the HLS colour value along <span style="color: #ff7700;font-weight:bold;">with</span> the light value <span style="color: #66cc66;">*</span>/
/<span style="color: #66cc66;">*</span> CVS table output <span style="color: #ff7700;font-weight:bold;">is</span> happening here <span style="color: #66cc66;">*</span>/
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'&quot;{id}&quot;; &quot;{h:03d}|{l:03d} {name}&quot;; &quot;{cat}&quot;; 12;<span style="color: #000099; font-weight: bold;">\</span>
                &quot;{article}&quot;; &quot;{short}&quot;; &quot;{desc}&quot;; &quot;../upload/{article}&quot;'</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>
                <span style="color: #008000;">id</span> = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>entry<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.JPG&quot;</span>, <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;d&quot;</span>,<span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
                h = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>h<span style="color: #66cc66;">*</span><span style="color: #ff4500;">255</span><span style="color: black;">&#41;</span>, l = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>l<span style="color: #66cc66;">*</span><span style="color: #ff4500;">10000000</span><span style="color: black;">&#41;</span>,
                a = arg,
                cat = categories<span style="color: black;">&#91;</span>entry<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'categories'</span><span style="color: black;">&#93;</span>,
                article = entry<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>,
                short = categories<span style="color: black;">&#91;</span>entry<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;short&quot;</span><span style="color: black;">&#93;</span>,
                desc = categories<span style="color: black;">&#91;</span>entry<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;desc&quot;</span><span style="color: black;">&#93;</span>,
                name = categories<span style="color: black;">&#91;</span>entry<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;name&quot;</span><span style="color: black;">&#93;</span>,
                <span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">IOError</span>:
            <span style="color: #ff7700;font-weight:bold;">pass</span></pre></div></div>

<p>In Linux you can call it like this, in your folder containing the catalogue (sub-)folders and product images:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-exec</span> python ~<span style="color: #000000; font-weight: bold;">/</span>Path<span style="color: #000000; font-weight: bold;">/</span>To<span style="color: #000000; font-weight: bold;">/</span>AverageColor.py <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">sort</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;import.csv</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2010/08/04/sort_by_colour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(English) Dracula Graph Library 0.0.3alpha</title>
		<link>http://www.strathausen.eu/2010/06/01/dracula_0-0-3alpha/</link>
		<comments>http://www.strathausen.eu/2010/06/01/dracula_0-0-3alpha/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 14:51:46 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Entwicklung]]></category>
		<category><![CDATA[bellman-ford]]></category>
		<category><![CDATA[binary heap]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[dijkstra]]></category>
		<category><![CDATA[dracula]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[floyd-warshall]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[raphael]]></category>
		<category><![CDATA[raphaeljs]]></category>
		<category><![CDATA[svg]]></category>
		<category><![CDATA[tooltip]]></category>

		<guid isPermaLink="false">http://blog.ameisenbar.de/?p=173</guid>
		<description><![CDATA[Edit: This library moved to it&#8217;s own a web site: graphdracula.net Hello People! Please have a look at the latest alpha version of my graph library. There are some changes, like now you have a simple option to add labels to connections by passing a label property when creating an edge and a simple overlay [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Edit: This library moved to it&#8217;s own a web site: <a href="http://graphdracula.net">graphdracula.net</a></strong></p>
<p>Hello People!</p>
<p>Please have a look at the <a href="http://dracula.ameisenbar.de/dracula_0.0.3alpha.zip">latest alpha version of my graph library</a>. There are some changes, like now you have a simple option to add labels to connections by passing a <em>label</em> property when creating an edge and a simple <em>overlay</em> option for nodes. Note that the file names have also changed, but this shouldn&#8217;t be too hard to adopt to. Some source code refractoring has been done too and the <em>getShape</em> is now called <em>render</em>.</p>
<p>The biggest changes however are some search algorithms I implemented to work with the framework, Dijkstra, Bellman-Ford and Floyd-Warshall along with a priority queue based on a binary heap. I&#8217;m just doing this because I have to learn it, but my plans are to break these algorithms down into steps and have them explained visually to the user.</p>
<p>Here are the issues I&#8217;m working on until removing the alpha badge, some already pointed out by some of you:</p>
<ol>
<li>Have a <em>render</em> function for every node, no matter how it was created.</li>
<li>Provide a convenient way to define the custom <em>render</em> function via json code.</li>
<li>Enhance the <em>overlay</em> property to make it easier to use.</li>
<li>Enhance the <em>label</em> property for better readability and automatic text aligning.</li>
<li>Attach a click handler to the nodes to distinguish between drag and click events.</li>
<li>An option to set a random seed for deterministic layouts.</li>
<li>Enhancing the layout algorithm to also work with mostly linear graphs.</li>
<li>Address the bug with numeric IDs.</li>
<li>Better re-using existing connections.</li>
</ol>
<p>Some of the issues I will address in the future:</p>
<ul>
<li>Hide/show nodes</li>
<li>Set fixed positions for some nodes</li>
<li>Different layout options</li>
<li>An algorithm showroom, e.g. for search algorithms, binary trees, minimal spanning trees, maximum flows, etc. (working on it), like all those educational Java applets from the 90&#8242;s out there&#8230;</li>
<li>Animations (maybe)</li>
<li>A web site (working on it)</li>
<li>Data adaptors</li>
<li>Different connection modes</li>
<li>As this library is growing, and not everyone might need everything, some kind of a really basic dependency list would be nice..</li>
<li>Some measurement method to calculate the quality of some randomly created layouts and then picking the best one</li>
<li>Use <a href="http://en.wikipedia.org/wiki/Currying">currying</a> wherever it makes sense and results in cleaner code. I <strong>love</strong> currying!</li>
</ul>
<p>Here&#8217;s what it looks like in action currently (the tool-tip is just a dummy rounded square):</p>
<p>And the Dijkstra algorithm to search the shortest paths from Berlin to any city in the world:</p>
<p>See you next week!</p>
<p><a href="http://dracula.ameisenbar.de/dracula_0.0.3alpha.zip">Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2010/06/01/dracula_0-0-3alpha/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Raphael SVG Tooltip</title>
		<link>http://www.strathausen.eu/2010/04/25/raphael-svg-tooltip/</link>
		<comments>http://www.strathausen.eu/2010/04/25/raphael-svg-tooltip/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 11:54:43 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Entwicklung]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[raphael]]></category>
		<category><![CDATA[svg]]></category>
		<category><![CDATA[tooltip]]></category>

		<guid isPermaLink="false">http://blog.ameisenbar.de/?p=164</guid>
		<description><![CDATA[Achtung: Ich habe einen kleinen Fehler behoben! Mit dieser Erweiterung können in Raphael Elemente als Tooltips an andere Elemente angehängt werden. Sie erscheinen, sobald man mit der Maus darüber fährt. Raphael.el.tooltip = function &#40;tp&#41; &#123; this.tp = tp; this.tp.ox = 0; this.tp.oy = 0; this.tp.hide&#40;&#41;; this.hover&#40; function&#40;event&#41;&#123; this.mousemove&#40;function&#40;event&#41;&#123; this.tp.translate&#40;event.clientX - this.tp.ox,event.clientY - this.tp.oy&#41;; this.tp.ox = [...]]]></description>
			<content:encoded><![CDATA[<p><b>Achtung: Ich habe einen kleinen Fehler behoben!</b></p>
<p>Mit dieser Erweiterung können in <a href="http://raphaeljs.com">Raphael</a> Elemente als Tooltips an andere Elemente angehängt werden. Sie erscheinen, sobald man mit der Maus darüber fährt.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Raphael.<span style="color: #660066;">el</span>.<span style="color: #660066;">tooltip</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>tp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span> <span style="color: #339933;">=</span> tp<span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">ox</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">oy</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span>
        <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">mousemove</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">translate</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">clientX</span> <span style="color: #339933;">-</span> 
                    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">ox</span><span style="color: #339933;">,</span>event.<span style="color: #660066;">clientY</span> <span style="color: #339933;">-</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">oy</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">ox</span> <span style="color: #339933;">=</span> event.<span style="color: #660066;">clientX</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">oy</span> <span style="color: #339933;">=</span> event.<span style="color: #660066;">clientY</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toFront</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
        <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">tp</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">unmousemove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Verwendet wird das dann einfach so:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> paper <span style="color: #339933;">=</span> Raphael<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">50</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">320</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
paper.<span style="color: #660066;">circle</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">100</span><span style="color: #339933;">,</span><span style="color: #CC0000;">100</span><span style="color: #339933;">,</span><span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">tooltip</span><span style="color: #009900;">&#40;</span>paper.<span style="color: #660066;">rect</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span><span style="color: #CC0000;">30</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Leider funktioniert das nicht mit <code>set</code> und ich habe auch nicht herausbekommen, wie man <code>set</code> um Funktionen erweitern kann. Eine weniger schöne Möglichkeit ist, die Elemente über das Attribut <code>items</code> anzusprechen:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> st <span style="color: #339933;">=</span> paper.<span style="color: #660066;">set</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
st.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>
    paper.<span style="color: #660066;">circle</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    paper.<span style="color: #660066;">circle</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
st.<span style="color: #660066;">items</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">tooltip</span><span style="color: #009900;">&#40;</span>paper.<span style="color: #660066;">rect</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">20</span><span style="color: #339933;">,</span><span style="color: #CC0000;">30</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Viel Spaß damit.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2010/04/25/raphael-svg-tooltip/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Retro WordPress Motiv</title>
		<link>http://www.strathausen.eu/2010/04/11/retro/</link>
		<comments>http://www.strathausen.eu/2010/04/11/retro/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 13:59:39 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Entwicklung]]></category>
		<category><![CDATA[Kreativität]]></category>
		<category><![CDATA[happy]]></category>
		<category><![CDATA[html template]]></category>
		<category><![CDATA[retro]]></category>
		<category><![CDATA[retro stripes]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[vintage]]></category>
		<category><![CDATA[wordpress theme]]></category>

		<guid isPermaLink="false">http://blog.ameisenbar.de/?p=130</guid>
		<description><![CDATA[Das Motiv dieses Blogs gibt es nun als noch unfertige Version zum herunterladen. Es basiert auf dem bekannten WordPress-Motiv Kubricks und wurde stark an meine Bedürfnisse angepasst. Da ich es über dem offiziellem WordPress-Verzeichnis auch anderen frei zur Verfügung zu stellen will, möchte ich es noch erweitern und verallgemeinern. Es ist bereits flexibel, passt sich [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.ameisenbar.de/wp-content/uploads/2010/04/Bildschirmfoto.png" rel="lightbox[130]"><img class="size-medium wp-image-138 alignleft" title="Retrohappy Beta WordPress Theme" src="http://blog.ameisenbar.de/wp-content/uploads/2010/04/Bildschirmfoto-300x193.png" alt="Retrohappy Beta WordPress Theme" width="300" height="193" /></a>Das Motiv dieses Blogs gibt es nun als noch unfertige <a href="http://blog.ameisenbar.de/wp-content/uploads/2010/04/retrohappy.zip">Version zum herunterladen</a>. Es basiert auf dem bekannten <a href="http://wordpress.org/extend/themes/default">WordPress-Motiv <em>Kubricks</em></a> und wurde stark an meine Bedürfnisse angepasst. Da ich es über dem offiziellem WordPress-Verzeichnis auch anderen frei zur Verfügung zu stellen will, möchte ich es noch erweitern und verallgemeinern. Es ist bereits flexibel, passt sich gut verschiedenen Auflösungen an und unterstützt  Deutsch, Englisch. Hebräisch und Rumänisch. Das Archiv enthält die SVG-Quellen, ein WordPress-Motiv-Verzeichnis und eine allgemeine HTML-Version. Viel Spaß damit. Ich freue mich auf Wünsche und Rückmeldungen!</p>
<p style="text-align: center;"><strong><a href="/wp-content/uploads/2010/04/retrohappy.zip">Download Retrohappy Beta WordPress Theme</a></strong></p>
<p>PS: Wenn Dir dieses Motiv sehr gefallen hat, kannst Du Dich über <a title="Dropbox - free online storage" href="https://www.dropbox.com/referrals/NTQwODEwNDE5" target="_blank">diesen Link</a> kostenlos und unverbindlich bei Dropbox anmelden und mir (und Dir) damit 250MB kostenlosen Online-Speicherplatz schenken <img src='http://www.strathausen.eu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>PPS: Der Download-Link funktioniert wieder! <img src='http://www.strathausen.eu/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2010/04/11/retro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eine JavaScript-Bibliothek zum Darstellen von Graphen</title>
		<link>http://www.strathausen.eu/2010/03/02/dracula/</link>
		<comments>http://www.strathausen.eu/2010/03/02/dracula/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 19:10:55 +0000</pubDate>
		<dc:creator>Johann Philipp</dc:creator>
				<category><![CDATA[Entwicklung]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[raphael]]></category>
		<category><![CDATA[raphaeljs]]></category>

		<guid isPermaLink="false">http://wp.ameisenbar.de/?p=91</guid>
		<description><![CDATA[Auf der Suche nach einem einfachen Weg, generische Graphen und Netze im Browser hübsch darzustellen, ohne jedoch auf Plugins wie Java oder Flash angewiesen zu sein, stieß ich auf diesen Code mit dem Namen „Graph JavaScript framework, version 0.0.1“. Es erlaubt das einfache Erstellen eines Graphenmodells, verteilt die Knoten dann schön und zeigt das Modell [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wp.ameisenbar.de/wp-content/uploads/2010/03/dracula-demo.png" rel="lightbox[91]"><img class="size-full wp-image-99 alignleft" title="dracula-demo" src="http://wp.ameisenbar.de/wp-content/uploads/2010/03/dracula-demo.png" alt="layouted graph" width="414" height="316" /></a>Auf der Suche nach einem einfachen Weg, generische Graphen und Netze im Browser hübsch darzustellen, ohne jedoch auf Plugins wie Java oder Flash angewiesen zu sein, stieß ich auf <a title="New Javascript/Canvas Graph library" href="http://snipplr.com/view/1950/graph-javascript-framework-version-001/" target="_blank">diesen Code</a> mit dem Namen „<a href="http://ajaxian.com/archives/new-javascriptcanvas-graph-library" target="_blank">Graph JavaScript framework, version 0.0.1</a>“. Es erlaubt das einfache Erstellen eines Graphenmodells, verteilt die Knoten dann schön und zeigt das Modell im Browser an. Leider war der Code so etwas von 2006 und verlangte zudem nach PrototypeJS.<br />
Außerdem war seither nichts mehr damit geschehen.</p>
<p>Also nahm ich ein <a title="Raphael JS" href="http://raphaeljs.com/graffle.html" target="_blank">Raphael-JS-Beispiel</a> zum verbinden geometrischer Formen und kombinierte es mit dem eben gefundenen Code. Der Layout-Algorithmus erzielte ganz ordentliche Ergebnisse. Nun kann man sogar Spaß haben und die Knoten mit der Maus umherziehen.</p>
<p><span id="more-91"></span></p>
<p>Hier ist ein Beispiel zur Veranschaulichung der Einfachheit der Benutzung (es unterscheidet sich im Grunde gar nicht viel von dem ursprünglichen Beispiel, enthält aber eine Reihe an Verbesserungen):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> redraw<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> height <span style="color: #339933;">=</span> <span style="color: #CC0000;">300</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> width <span style="color: #339933;">=</span> <span style="color: #CC0000;">400</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009966; font-style: italic;">/* only do all this when document has finished loading (needed for RaphaelJS) */</span>
window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Graph<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009966; font-style: italic;">/* add simple nodes */</span>
    g.<span style="color: #660066;">addNode</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;strawberry&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    g.<span style="color: #660066;">addNode</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cherry&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009966; font-style: italic;">/* add a node with a customized label */</span>
    g.<span style="color: #660066;">addNode</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;id34&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> label <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Tomato&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">/* add a node with a customized shape
       (the Raphael graph drawing implementation can draw this shape, please
       consult the RaphaelJS reference for details http://raphaeljs.com/) */</span>
    g.<span style="color: #660066;">addNode</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;id35&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
        label <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Meat&quot;</span> <span style="color: #339933;">,</span>
        <span style="color: #009966; font-style: italic;">/* filling the shape with a color makes it easier to be dragged */</span>
        getShape <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>r<span style="color: #339933;">,</span>x<span style="color: #339933;">,</span>y<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">return</span> r.<span style="color: #660066;">rect</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">-</span><span style="color: #CC0000;">30</span><span style="color: #339933;">,</span> y<span style="color: #339933;">-</span><span style="color: #CC0000;">13</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">62</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">33</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;fill&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;#f00&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;stroke-width&quot;</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009966; font-style: italic;">/* connect nodes with edges */</span>
    g.<span style="color: #660066;">addEdge</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;strawberry&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;cherry&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    g.<span style="color: #660066;">addEdge</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cherry&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;apple&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    g.<span style="color: #660066;">addEdge</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;id34&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;cherry&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009966; font-style: italic;">/* customize the colors of that edge */</span>
    g.<span style="color: #660066;">addEdge</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;id35&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;apple&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> color <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;#38a&quot;</span> <span style="color: #339933;">,</span> colorbg <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;#bdf&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009966; font-style: italic;">/* add an unknown node implicitly by adding an edge */</span>
    g.<span style="color: #660066;">addEdge</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;strawberry&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;apple&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009966; font-style: italic;">/* layout the graph using the Spring layout implementation */</span>
    <span style="color: #003366; font-weight: bold;">var</span> layouter <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Graph.<span style="color: #660066;">Layout</span>.<span style="color: #660066;">Spring</span><span style="color: #009900;">&#40;</span>g<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    layouter.<span style="color: #660066;">layout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009966; font-style: italic;">/* draw the graph using the RaphaelJS draw implementation */</span>
    <span style="color: #003366; font-weight: bold;">var</span> renderer <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Graph.<span style="color: #660066;">Renderer</span>.<span style="color: #660066;">Raphael</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'canvas'</span><span style="color: #339933;">,</span> g<span style="color: #339933;">,</span> width<span style="color: #339933;">,</span> height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    renderer.<span style="color: #660066;">draw</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    redraw <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        layouter.<span style="color: #660066;">layout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        renderer.<span style="color: #660066;">draw</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Das Ergebnis sieht dann folgendermaßen aus:</p>
<p><iframe src ="http://dracula.ameisenbar.de/index.html" width="100%" height="360" style="border:1px solid #888; background-color:white;"></iframe></p>
<p>Probier es aus unter <a href="http://dracula.ameisenbar.de/index.html">dracula.ameisenbar.de</a>, <a href="https://launchpad.net/dracula">hol Dir den Code via launchpad</a> oder <a href="http://dracula.ameisenbar.de/dracula.zip">lade das zip-Archiv herunter</a>. Es sind noch einige Optimierungen am Algorithmus notwendig, sowie die Programmstruktur zu ordnen. Vieles im Code habe ich bereits kommentiert und es ist eine Beispiel-HTML-Seite im Archiv, welche die Anwendungsmöglichkeiten demonstriert. Viel Spaß!</p>
<p>Für Kommentare bin ich sehr dankbar!</p>
<p><b><big>Update: Es gibt eine <a href="http://blog.ameisenbar.de/2010/06/01/dracula_0-0-3alpha/">neue Version zum Probieren!</a></big></b></p>
]]></content:encoded>
			<wfw:commentRss>http://www.strathausen.eu/2010/03/02/dracula/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

