<?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>Geschreibsel</title>
	<atom:link href="http://fsteeg.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://fsteeg.com</link>
	<description>Fabian Steeg&#039;s Scribblings on Coding, Eclipse, NLP &#38; Stuff</description>
	<lastBuildDate>Wed, 25 Jan 2012 15:33:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='fsteeg.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Geschreibsel</title>
		<link>http://fsteeg.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://fsteeg.com/osd.xml" title="Geschreibsel" />
	<atom:link rel='hub' href='http://fsteeg.com/?pushpress=hub'/>
		<item>
		<title>Cloudio: SWT-based tag cloud visualization for Zest</title>
		<link>http://fsteeg.com/2011/09/07/cloudio-swt-based-tag-cloud-visualization-for-zest/</link>
		<comments>http://fsteeg.com/2011/09/07/cloudio-swt-based-tag-cloud-visualization-for-zest/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 15:35:48 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[zest]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://fsteeg.com/?p=1426</guid>
		<description><![CDATA[Thanks to a contribution by Stephan Schwiebert, the Eclipse GEF Zest toolkit now contains an SWT-based tag cloud visualization component. Using SWT widgets and JFace viewers, you can create tag clouds like this one: The tag clouds are highly customizable. To demonstrate the possibilities, Cloudio contains a sample RCP application. It can load a text [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1426&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Thanks to a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=349969">contribution</a> by <a href="https://twitter.com/#!/sschwieb">Stephan Schwiebert</a>, the Eclipse GEF <a href="http://www.eclipse.org/gef/zest/">Zest</a> toolkit now contains an SWT-based tag cloud visualization component. Using SWT widgets and JFace viewers, you can create tag clouds like this one:</p>
<p><img class="alignnone" title="cloud-img-shot.png" src="http://dl.dropbox.com/u/7546431/cloud-img-shot.png" alt="" width="400" /></p>
<p>The tag clouds are highly customizable. To demonstrate the possibilities, Cloudio contains a sample RCP application. It can load a text file, provides access to the visualization parameters, and supports image export:</p>
<p><img class="alignnone" title="cloud-app.png" src="http://dl.dropbox.com/u/7546431/cloud-app.png" alt="" width="400" /></p>
<p>Cloudio is part of the <a href="http://git.eclipse.org/c/gef/org.eclipse.zest.git">Zest Git repository</a>. Its help content (like the other Zest documentation) is generated from the Eclipse <a href="http://wiki.eclipse.org/Zest/Cloudio">wiki</a>. Builds and p2 repos are available from the <a href="https://hudson.eclipse.org/hudson/job/gef-zest-nightly/">nightly</a> and <a href="https://hudson.eclipse.org/hudson/job/gef-zest-integration/">integration</a> CI jobs. Integration builds can also be installed from the <a href="http://marketplace.eclipse.org/content/zest">marketplace</a>. You can get in touch in the <a href="http://www.eclipse.org/forums/eclipse.tools.gef">GEF forum</a> and report bugs on <a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=GEF&amp;component=Zest">Bugzilla</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/1426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/1426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/1426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/1426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/1426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/1426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/1426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/1426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/1426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/1426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/1426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/1426/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/1426/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/1426/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1426&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2011/09/07/cloudio-swt-based-tag-cloud-visualization-for-zest/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://dl.dropbox.com/u/7546431/cloud-img-shot.png" medium="image">
			<media:title type="html">cloud-img-shot.png</media:title>
		</media:content>

		<media:content url="http://dl.dropbox.com/u/7546431/cloud-app.png" medium="image">
			<media:title type="html">cloud-app.png</media:title>
		</media:content>
	</item>
		<item>
		<title>Run MWE2 workflows for Xtext 2.0 in a Tycho build</title>
		<link>http://fsteeg.com/2011/07/15/run-mwe2-workflows-for-xtext-2-0-in-a-tycho-build/</link>
		<comments>http://fsteeg.com/2011/07/15/run-mwe2-workflows-for-xtext-2-0-in-a-tycho-build/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 20:05:35 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[dsl]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://fsteeg.com/?p=1413</guid>
		<description><![CDATA[I&#8217;ve been doing some work on the Zest build to make the MWE workflow (which generates a bunch of files from an Xtext grammar) part of the Tycho build. I guess I just couldn&#8217;t stand committing tons of changes after some very small tweaks to the grammar I did earlier today. To hook the workflow [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1413&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing some work on the Zest build to make the MWE workflow (which generates a bunch of files from an <a href="http://www.eclipse.org/Xtext/">Xtext</a> grammar) part of the <a href="http://www.eclipse.org/tycho/">Tycho</a> build. I guess I just couldn&#8217;t stand committing tons of changes after some very small tweaks to the grammar I did earlier today.</p>
<p>To hook the workflow into the Tycho build, I was basically able to use the info in the very good and detailed <a href="http://kthoms.wordpress.com/2010/08/18/building-xtext-projects-with-maven-tycho/">tutorial by Karsten Thoms</a>. To make it work for our specific project setup and for the latest Xtext version I still had to tweak some minor things, so I thought I&#8217;ll do a quick writeup of what I have actually done to make it work. This assumes you already have an Xtext project and you&#8217;re already building with Tycho in general. If not, check out the tutorial mentioned above.</p>
<p>To add the MWE workflow to the Tycho build, all I had to do was add a plugin repository in the <a href="http://git.eclipse.org/c/gef/org.eclipse.zest.git/tree/pom.xml">parent pom</a>:</p>
<p><pre class="brush: xml; auto-links: false;">
&lt;pluginRepositories&gt;
  &lt;pluginRepository&gt;
    &lt;id&gt;fornax-snapshots&lt;/id&gt;
    &lt;url&gt;http://www.fornax-platform.org/archiva/repository/snapshots/&lt;/url&gt;
    &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
  &lt;/pluginRepository&gt;
&lt;/pluginRepositories&gt;
</pre></p>
<p>Add a plugin pointing to the MWE workflow file in the Xtext <a href="http://git.eclipse.org/c/gef/org.eclipse.zest.git/tree/org.eclipse.zest.dot.core/pom.xml">grammar project pom</a>:</p>
<p><pre class="brush: xml; auto-links: false;">
&lt;build&gt;
  &lt;plugins&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.fornax.toolsupport&lt;/groupId&gt;
        &lt;artifactId&gt;fornax-oaw-m2-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.3.0-SNAPSHOT&lt;/version&gt;
        &lt;configuration&gt;
          &lt;workflowEngine&gt;mwe2&lt;/workflowEngine&gt;
          &lt;workflowDescriptor&gt;src/parser/GenerateLang.mwe2&lt;/workflowDescriptor&gt;
        &lt;/configuration&gt;
        &lt;executions&gt;
          &lt;execution&gt;
          &lt;phase&gt;generate-sources&lt;/phase&gt;
          &lt;goals&gt;&lt;goal&gt;run-workflow&lt;/goal&gt;&lt;/goals&gt;
        &lt;/execution&gt;
      &lt;/executions&gt;
    &lt;/plugin&gt;
  &lt;/plugins&gt;
&lt;/build&gt;
</pre></p>
<p>And define the Xtext grammar project source folder as a resource directory:</p>
<p><pre class="brush: xml; auto-links: false;">
&lt;build&gt;
  &lt;resources&gt;
    &lt;resource&gt;&lt;directory&gt;src&lt;/directory&gt;&lt;/resource&gt;
  &lt;/resources&gt;
&lt;/build&gt;
</pre></p>
<p>When running <em>mvn clean install</em>, the MWE workflow now runs as part of the grammar project build.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/1413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/1413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/1413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/1413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/1413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/1413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/1413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/1413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/1413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/1413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/1413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/1413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/1413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/1413/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1413&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2011/07/15/run-mwe2-workflows-for-xtext-2-0-in-a-tycho-build/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting up Contracts for Java in Eclipse</title>
		<link>http://fsteeg.com/2011/02/07/setting-up-contracts-for-java-in-eclipse/</link>
		<comments>http://fsteeg.com/2011/02/07/setting-up-contracts-for-java-in-eclipse/#comments</comments>
		<pubDate>Sun, 06 Feb 2011 23:12:07 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://fsteeg.com/?p=1352</guid>
		<description><![CDATA[On Friday, Contracts for Java was announced on the Google Open Source Blog. Learning about this at the beginning of the weekend was perfect timing for me: I had time to check it out, and while setting it up was some work, I was hooked right away. Now something like Contracts for Java is only [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1352&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On Friday, <a href="http://code.google.com/p/cofoja/">Contracts for Java</a> was announced on the <a href="http://google-opensource.blogspot.com/2011/02/contracts-for-java.html">Google Open Source Blog</a>. Learning about this at the beginning of the weekend was perfect timing for me: I had time to check it out, and while setting it up was some work, <a href="http://twitter.com/#!/fsteeg/status/33977183697371136">I was hooked right away</a>.</p>
<p>Now something like Contracts for Java is only really useful if it is well integrated into the tools you use everyday &#8211; which in my case is Eclipse. Eclipse allows many levels of integration, and I quickly had it working by running <em>javac</em> as an <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-97_standalone_ets.htm">external tool</a> &#8211; which is OK, but not ideal, since it requires running the tool manually after every change to the annotations, and doesn&#8217;t give in-place error messages. I quickly found out Eclipse has support for custom <a href="http://www.eclipse.org/jdt/apt/main.html">annotation processing</a>. I had to fiddle a little until I got that configured properly with Contracts for Java so I thought I do a quick write-up so other people can try this cool new tool in Eclipse.</p>
<p>Contracts for Java doesn&#8217;t provide any binary downloads yet, so my first step was to build a Jar. To use it, create a Java project, and add <a href="http://dl.dropbox.com/u/7546431/cofoja-current.jar">cofoja-latest.jar</a> and <a href="http://dl.dropbox.com/u/7546431/asm-all-3.3.1.jar">asm-all-3.3.1.jar</a> to the build path. Then add some code that uses contract annotations (copy and paste the code below into the src folder of the project):</p>
<p><pre class="brush: java;">
import com.google.java.contract.Ensures;
import com.google.java.contract.Requires;

public class Contracts {
	public static void main(String[] args) {
		System.out.println(new Numbers().add(-10, 5));
	}
}

class Numbers {
	@Requires({ &quot;c &gt; 0&quot;, &quot;b &gt; 0&quot; })
	@Ensures({ &quot;result &gt; a&quot;, &quot;result &gt; b&quot; })
	int add(int a, int b) {
		return a - b;
	}
}
</pre></p>
<p>Next, configure the annotation processing in the project properties &gt; <em>Java Compiler</em> &gt; <em>Annotation Processing</em>. To make Contracts for Java work with the Eclipse Java compiler, currently some specific properties have to be set up: set the <em>com.google.java.contract.classpath</em> property to the location of your cofoja-latest.jar  and the <em>com.google.java.contract.classoutput</em> property to the location of your project&#8217;s <em>src</em> or separate <em>bin</em> folder (both relative to the project root, using the %PROJECT.DIR% variable):</p>
<p style="text-align:center;"><a href="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-options.png"><img class="size-full wp-image-1396 aligncenter" title="cofoja-setup-options" src="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-options.png?w=600&#038;h=284" alt="" width="600" height="284" /></a></p>
<p>If your project uses multiple Jars they currently have to be given with absolute paths as the <em>com.google.java.contract.classpath</em> value, separated with &#8216;:&#8217; on Unix or &#8216;;&#8217; on Windows. Next, make sure you have set up your workspace to refresh automatically in <em>Preferences</em> &gt; <em>General</em> &gt; <em>Workspace</em> to make Eclipse see the resources generated by the annotation processor. Then, add the cofoja-latest.jar to the project properties &gt; <em>Java Compiler</em> &gt; <em>Annotation Processing</em> &gt; <em>Factory Path</em>:</p>
<p style="text-align:center;"><a href="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-2.png"><img class="size-full wp-image-1363 aligncenter" title="cofoja-setup-2" src="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-2.png?w=600&#038;h=323" alt="" width="600" height="323" /></a></p>
<p>Now issues in the annotation values are reported in the editor, like variables that cannot be found, e.g. for our code above:</p>
<p style="text-align:center;"><a href="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-31.png"><img class="size-full wp-image-1368 aligncenter" title="cofoja-setup-3" src="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-31.png?w=600" alt=""   /></a></p>
<p>To have the contracts checked at runtime, add <em>-javaagent:cofoja-current.jar</em> to the VM arguments of your run configuration:</p>
<p style="text-align:center;"><a href="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-41.png"><img class="size-full wp-image-1374 aligncenter" title="cofoja-setup-4" src="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-41.png?w=600" alt=""   /></a></p>
<p>Now when running, we are made aware of the violated precondition in our code:</p>
<p style="text-align:center;"><a href="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-51.png"><img class="size-full wp-image-1377 aligncenter" title="cofoja-setup-5" src="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-51.png?w=600" alt=""   /></a></p>
<p>After we fix the call violating the precondition to <em>new Numbers().add(10, 5);</em> we now see our implementation of <em>add</em> does not fulfill the postcondition:</p>
<p style="text-align:center;"><a href="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-6.png"><img class="size-full wp-image-1378 aligncenter" title="cofoja-setup-6" src="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-6.png?w=600" alt=""   /></a></p>
<p>After fixing our implementation to <em>return a + b;</em> the code now runs without errors. For further information on using Contracts for Java check out the <a href="http://code.google.com/p/cofoja/w/list">project wiki</a>. General information on design by contract can be found <a href="http://en.wikipedia.org/wiki/Design_by_contract#Bibliography">elsewhere</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/1352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/1352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/1352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/1352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/1352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/1352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/1352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/1352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/1352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/1352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/1352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/1352/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/1352/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/1352/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1352&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2011/02/07/setting-up-contracts-for-java-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>73</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-options.png" medium="image">
			<media:title type="html">cofoja-setup-options</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-2.png" medium="image">
			<media:title type="html">cofoja-setup-2</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-31.png" medium="image">
			<media:title type="html">cofoja-setup-3</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-41.png" medium="image">
			<media:title type="html">cofoja-setup-4</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-51.png" medium="image">
			<media:title type="html">cofoja-setup-5</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2011/02/cofoja-setup-6.png" medium="image">
			<media:title type="html">cofoja-setup-6</media:title>
		</media:content>
	</item>
		<item>
		<title>Scala, object persistence, and the original NoSQL: XML</title>
		<link>http://fsteeg.com/2010/08/30/scala-object-persistence-and-the-original-nosql-xml/</link>
		<comments>http://fsteeg.com/2010/08/30/scala-object-persistence-and-the-original-nosql-xml/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 01:30:31 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://fsteeg.wordpress.com/?p=1251</guid>
		<description><![CDATA[In our digitization wiki project based on Eclipse 4 and Scala it was time to find a persistence solution. As a quick overview of what it&#8217;s about, our app will basically allow a user to edit a digitized book page, showing the original scan as an image, with the selected word highlighted. It currently looks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1251&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In our <a href="http://fsteeg.wordpress.com/2010/04/18/an-eclipse-rcp-digitization-wiki-with-e4-and-scala/">digitization wiki</a> <a href="http://github.com/spinfo/drc">project</a> based on <a href="http://www.eclipse.org/eclipse4/">Eclipse 4</a> and <a href="http://www.scala-lang.org/">Scala</a> it was time to find a persistence solution. As a quick overview of what it&#8217;s about, our app will basically allow a user to edit a digitized book page, showing the original scan as an image, with the selected word highlighted. It currently looks like this:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/08/drc-b1-m4.png"><img class="alignnone size-full wp-image-1252" title="drc-b1-m4" src="http://fsteeg.files.wordpress.com/2010/08/drc-b1-m4.png?w=600" alt="A digitization wiki using Scala and Eclipse 4"  /></a></p>
<p>For the initial prototype implementation, we used XML files in zips to store the page content, combined with <a href="https://truezip.dev.java.net/">TrueZIP</a>, a library which allows access to files in zips the way it should be: like files in a folder. So we could basically create and use the zip entries like this:</p>
<p><pre class="brush: scala;">
val zipEntry = new File(&quot;PPN345572629_0004.zip/0001.xml&quot;)
</pre></p>
<p>The XML is created using <a href="http://www.codecommit.com/blog/scala/working-with-scalas-xml-support">Scala&#8217;s XML support</a>, e.g. the top class in our domain model (Page) is serialized by specifying the root element and calling <em>toXml</em> on each containing element (the words), like this:</p>
<p><pre class="brush: scala;">
def toXml:Elem = &lt;page&gt; { words.map(_.toXml) } &lt;/page&gt;
</pre></p>
<p>The XML is deserialized with the reverse action, by passing the deserialized word elements contained in the root element to the Page factory method:</p>
<p><pre class="brush: scala;">
def fromXml(page:Elem) = Page( for(word &lt;- (page \ &quot;word&quot;)) 
  yield Word.fromXml(word) )
</pre></p>
<p>So that was basically our prototypical persistence mechanism. Of course, to actually collaboratively correct our digitized texts, we needed a central DB instance on some server. Or maybe not exactly: having <a href="http://chaosradio.ccc.de/cre125.html">heard good things about CouchDB</a> (in german), it was the first option I looked into. The distributed nature of CouchDB sounded very interesting and seemed appropriate for our project &#8211; not for performance reasons, but to provide offline or decentralized editing as an option.</p>
<p>So I looked into <a href="http://couchdb.apache.org/">CouchDB</a> with <a href="http://github.com/debasishg/scouchdb">scouchdb</a>, a Scala API to access it (<a href="http://twitter.com/fsteeg/statuses/20551941141">and a very welcoming project</a>). After input from my colleague, I became aware that we&#8217;d lose quite a bit of installation ease if we pick a non-Java DB, so CouchDB was not really a client side option for offline storage, and therefore the strongest reason for us to consider it no longer there.</p>
<p>Next I considered an embedded relational Java DB with some ORM or ORM-like access. A JPA solution like EclipseLink or Hibernate seemed overkill and not ideal for Scala. Instead I took a closer look at <a href="http://github.com/szeiger/scala-query">ScalaQuery</a>, which uses Scala&#8217;s <em>for expressions</em> for DB queries, which seems like the thing you want if you happen to use a language that basically has a query language built-in.</p>
<p>For instance, in ScalaQuery, we could write a query to get all pairs of pages and words where the page contains the word and the original form of the word is <em>Bonifaci</em> like this:</p>
<p><pre class="brush: scala;">
val bonifaci = for (page &lt;- Pages; word &lt;- Words;
  if page.id === word.pageId &amp;&amp; word.original === &quot;Bonifaci&quot;)
  yield (page, word)
</pre></p>
<p>To allow this kind of queries, we need to define tables named <em>Pages</em> and <em>Words</em>. Defining the tables with ScalaQuery is quite elegant, e.g. our main table for pages could be defined like this:</p>
<p><pre class="brush: scala;">
object Pages extends Table[(String, java.sql.Blob)](&quot;pages&quot;) {
  def id = column[String](&quot;id&quot;, O PrimaryKey)
  def image = column[java.sql.Blob](&quot;image&quot;)
  def * = id ~ image
}
</pre></p>
<p>However, this leads to either a duplication of our domain objects (have a table object as above and the original class) or a complete rewrite (use table objects like above as the domain objects), which both seemed wrong.</p>
<p>Also, thinking about alternatives to our XML representation, I came to realize that we would want some form of XML export anyway to ensure long-term access to our data, which is in the public domain and a cultural asset. Of course it would be possible to implement this as some form of export, but if possible it would be just perfect if we could use a single persistence mechanism.</p>
<p>I did remember there are some XML DBs around, but initially abandoned that idea since XML is only half of what we store (the other thing being the images used to correct the text, see screenshot above). But after being unhappy with these other solutions, I took a closer look at <a href="http://exist.sourceforge.net/">eXist-db</a>, an XML DB licensed under the LGPL which by default runs on <a href="http://eclipse.org/jetty/">Jetty</a>.</p>
<p>And I learned that eXist actually supports both XML and binary data, which was just what we needed. With eXist, we also get XQuery support and various interfaces to the data. In our case, this is less of an immediate concern, given Scala&#8217;s XML support and <em>for expressions</em> are a bit like built-in XQuery capabilities. For instance, a query on XML that is equivalent to the ScalaQuery from above could look like this:</p>
<p><pre class="brush: scala;">
val bonifaci = for (page &lt;- xml\&quot;page&quot;; word &lt;- page\&quot;word&quot;;
  if (word\&quot;@original&quot;).text == &quot;Bonifaci&quot;) yield (page, word)
</pre></p>
<p>This is not only about as concise as the query above, but also allows to express the hierarchical nature of our data in the query (&#8216;each word in the page&#8217;), instead of having to map the relational representation (&#8216;all words with a certain page ID&#8217;). </p>
<p>As we already deserialize the XML to page objects, what we actually do is query on these. For switching the serialization from entries in a zip file to the eXist DB and allow these queries, the only conceptual change was to store the XML and image files in the DB instead of using a File object, which allowed a really smooth transition.</p>
<p>And with Scala&#8217;s rich semantics and XML support, our DB wrapper in Scala can be very <a href="http://lamp.epfl.ch/~odersky/blogs/isscalacomplex.html">simple</a> and precise about what it offers in its API, namely XML documents for a collection ID (if found in the DB):</p>
<p><pre class="brush: scala;">
val xmls:Option[List[Elem]] = Db.xml(collection)
</pre></p>
<p>Or binary data:</p>
<p><pre class="brush: scala;">
val imgs:Option[List[Array[Byte]]] = Db.bin(collection)
</pre></p>
<p>The elements provided by the DB in this way can be passed to the original deserialization method of Page:</p>
<p><pre class="brush: scala;">
val pages:List[Page] = for(page &lt;- Db.xml(collection))
  yield Page.fromXml(page)
</pre></p>
<p>Given this, we can now use a plain Scala <em>for expression</em> on the deserialized objects to query our data like this:</p>
<p><pre class="brush: scala;">
val bonifaci = for (page &lt;- pages; word &lt;- page.words;
  if word.original == &quot;Bonifaci&quot;) yield (page, word)
</pre></p>
<p>At this point we have replaced the file storage with the DB, but are still creating the XML manually, using Scala&#8217;s XML literals. To avoid any duplication (each class parameter or field is represented again in the serialization logic), and basically eliminate all direct XML manipulation, we could use an XML binding library like <a href="http://scalaxb.org/">scalaxb</a>, <a href="https://jaxb.dev.java.net/">JAXB-RI</a> or <a href="http://eclipse.org/eclipselink/moxy.php">MOXy</a>.</p>
<p>On the other hand, the type safety of the Scala XML serialization code makes the duplication feel much less dangerous than traditional, string-based XML serialization (which can break easily unnoticed by the compiler). And being about as concise as some JAXB annotations and marshalling code would be, the disadvantages seem almost entirely theoretical, but we&#8217;ll see &#8211; swapping the serialization logic should be as easy as swapping the storage implementation was.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/1251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/1251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/1251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/1251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/1251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/1251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/1251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/1251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/1251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/1251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/1251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/1251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/1251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/1251/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1251&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2010/08/30/scala-object-persistence-and-the-original-nosql-xml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/08/drc-b1-m4.png" medium="image">
			<media:title type="html">drc-b1-m4</media:title>
		</media:content>
	</item>
		<item>
		<title>DOT for Zest on Eclipse 4</title>
		<link>http://fsteeg.com/2010/07/27/dot-for-zest-on-eclipse-4/</link>
		<comments>http://fsteeg.com/2010/07/27/dot-for-zest-on-eclipse-4/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 02:05:17 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[soc]]></category>
		<category><![CDATA[zest]]></category>
		<category><![CDATA[graphviz]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://fsteeg.wordpress.com/?p=1156</guid>
		<description><![CDATA[I recently checked out the latest RC of the Eclipse 4.0 SDK and was excited to see that I could basically install any Helios software without issues. So I thought why not do some work on dot4zest using Eclipse 4. I was amazed to see that Eclipse 4.0 (labeled Early Adopter Release) is already completely usable [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1156&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently checked out the latest RC of the <a href="http://download.eclipse.org/e4/sdk/drops/S-4.0RC3-201007251756/">Eclipse 4.0 SDK</a> and <a href="http://twitter.com/fsteeg/status/19274741068">was excited to see</a> that I could basically install any Helios software without issues. So I thought why not do some work on <a href="http://wiki.eclipse.org/Graphviz_DOT_as_a_DSL_for_Zest">dot4zest</a> using Eclipse 4.</p>
<p>I was amazed to see that Eclipse 4.0 (labeled <em>Early Adopter Release</em>) is already completely usable for me (even if it doesn&#8217;t yet offer all the things I&#8217;m used to in the current version &#8211; perspective customization and custom key bindings are things I hit). And I really like that fresh look &#8211; a whole new Eclipse, after all these years!</p>
<p>So here is a quick tour of some new dot4zest features, running on Eclipse 4.</p>
<p>A new feature in the DOT to Zest interpreter (which now uses the <a href="http://www.eclipse.org/Xtext/">Xtext</a> switch API generated for the DOT grammar) is support for ad-hoc DOT edge definitions, without having to declare the nodes before using them in an edge, e.g.</p>
<p><pre class="brush: plain;">
digraph { node[label=&quot;Node&quot;] 1-&gt;2; 2-&gt;3; 2-&gt;4 }
</pre></p>
<p><a href="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-14-55.png"><img class="alignnone size-full wp-image-1179" title="dot4zest-e4-1" src="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-14-55.png?w=600" alt=""   /></a></p>
<p>Also new is support for the <em>rankdir=LR</em> attribute in the DOT input, e.g.</p>
<p><pre class="brush: plain;">
digraph { rankdir=LR; 1-&gt;2; 2-&gt;3; 2-&gt;4 }
</pre></p>
<p><a href="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-23-02.png"><img class="alignnone size-full wp-image-1182" title="dot4zest-e4-2" src="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-23-02.png?w=600" alt=""   /></a></p>
<p>The <em>rankdir=LR</em> setting is supported in Zest to DOT export, too: if a Zest graph using the horizontal layout is exported to DOT and rendered with Graphviz, the direction will be correct for the result, e.g. if we hit the export button in the view above, this is opened:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-26-27.png"><img class="alignnone size-medium wp-image-1184" title="dot4zest-export-1" src="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-26-27.png?w=240&#038;h=158" alt="" width="240" height="158" /></a></p>
<p>If the DOT input contains features that are not yet supported in the Zest representation created by dot4zest, the import will now handle the input better and try to display the parts it can make sense of, e.g. DOT with subgraphs can be rendered with Zest, but subgraphs are ignored:</p>
<p><pre class="brush: plain;">
digraph { subgraph cluster_1 {1-&gt;2} subgraph cluster_2 {1-&gt;3} }
</pre></p>
<p><a href="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-37-48.png"><img class="alignnone size-full wp-image-1187" title="dot4zest-e4-3" src="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-37-48.png?w=600" alt=""   /></a></p>
<p>The Graphviz image export can be customized (see toggle above) to use the original DOT input instead of a DOT representation generated from the Zest graph, e.g. with the view and the input above, the export will render the subgraphs from the original DOT input:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-37-581.png"><img class="alignnone size-medium wp-image-1189" title="dot4zest-export-2" src="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-37-581.png?w=240&#038;h=238" alt="" width="240" height="238" /></a></p>
<p>Finally, the graph view now contains a toggle button (enabled in all screenshots above) to switch between different modes: listen to changes made to DOT graphs in workspace files and visualize them with Zest automatically (useful for programs outputting DOT or for live preview during DOT editing), or visualize only files loaded explicitly.</p>
<p>The <a href="http://wiki.eclipse.org/Graphviz_DOT_as_a_DSL_for_Zest">dot4zest</a> code is part of <a href="http://www.eclipse.org/gef/zest/">Zest</a> (a <a href="http://www.eclipse.org/gef/">GEF</a> component) and available from the <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.gef/plugins/?root=Tools_Project">Tools repository</a>. It is not available from an eclipse.org update site yet, but can be easily installed (for Eclipse 3.6 and 4.0) from the <a href="http://marketplace.eclipse.org/content/graphviz-dot-zest-dot4zest">marketplace</a> (Help &gt; Eclipse Marketplace).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/1156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/1156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/1156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/1156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/1156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/1156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/1156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/1156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/1156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/1156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/1156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/1156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/1156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/1156/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1156&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2010/07/27/dot-for-zest-on-eclipse-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-14-55.png" medium="image">
			<media:title type="html">dot4zest-e4-1</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-23-02.png" medium="image">
			<media:title type="html">dot4zest-e4-2</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-26-27.png?w=300" medium="image">
			<media:title type="html">dot4zest-export-1</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-37-48.png" medium="image">
			<media:title type="html">dot4zest-e4-3</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/07/screen-shot-2010-07-27-at-00-37-581.png?w=300" medium="image">
			<media:title type="html">dot4zest-export-2</media:title>
		</media:content>
	</item>
		<item>
		<title>An Eclipse RCP digitization wiki with e4 and Scala</title>
		<link>http://fsteeg.com/2010/04/18/an-eclipse-rcp-digitization-wiki-with-e4-and-scala/</link>
		<comments>http://fsteeg.com/2010/04/18/an-eclipse-rcp-digitization-wiki-with-e4-and-scala/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 19:39:17 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://fsteeg.wordpress.com/?p=1085</guid>
		<description><![CDATA[We have reached the first milestone of a new project I have been working on since November: an Eclipse RCP wiki application (implemented using e4 and Scala) to collaboratively improve the digitization of the Romansch Chrestomathy, a collection of Romansch texts. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1085&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We have reached the first milestone of a new project I have been working on since November. The goal of the <a href="http://www.spinfo.phil-fak.uni-koeln.de/forschung-drc.html">project</a> (which is funded by the <a href="http://en.wikipedia.org/wiki/Deutsche_Forschungsgemeinschaft">DFG</a>) is to create a wiki for collaboratively improving the digitization of the <em>Romansch Chrestomathy</em>, a collection of <a href="http://en.wikipedia.org/wiki/Romansh_language">Romansch</a> texts.</p>
<p>I think the domain of this project is very interesting, as it not only aims at improving access to cultural assets, but also takes the community wiki approach, which leads to a situation that is probably not the most common case in academic software development: users are part of the plan.</p>
<p>But perhaps even more, I&#8217;m excited about the technical parts of the project, as we use both <a href="http://www.scala-lang.org/">Scala</a> for the core, non-UI components and <a href="http://wiki.eclipse.org/E4">e4</a> for the UI.</p>
<p>Our first milestone for the initial beta (which we plan to release in summer) provides a basic local, single-user implementation of our system. It features basic search and page selection, editing and persistence, word-based edit history and highlighting of the currently selected word in the original scan.</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/04/screenshot-drc-b1-m1.png"><img class="alignnone size-full wp-image-1086" title="screenshot-drc-b1-m1" src="http://fsteeg.files.wordpress.com/2010/04/screenshot-drc-b1-m1.png?w=600" alt="Screenshot"  /></a></p>
<p>As expected, combining two cutting edge technologies (Scala 2.8 and e4) does cause some inconveniences (e.g. I currently can&#8217;t develop the Scala and the e4 code in the same Eclipse instance, as the Scala IDE for Eclipse does not yet support Helios and e4 won&#8217;t run on Galileo).</p>
<p>But once I had a proper Ant build system in place (compile Scala sources, deploy as Jars into the e4 workspace, etc.), I was amazed about the concise code base we were able to build both for the backend and the UI with this approach.</p>
<p>To give some examples of what I liked about developing using Scala and e4 I&#8217;ve picked out a few lines from both sides of the current (not very large) code base.</p>
<p>On the Scala side, I really liked having features like <a href="http://www.codecommit.com/blog/scala/case-classes-are-cool">case classes</a>, <a href="http://www.scala-lang.org/node/131">XML support</a>, and <a href="http://www.codecommit.com/blog/scala/quick-explanation-of-scalas-syntax">concise anonymous functions</a>.</p>
<p>For instance, the XML serialization method of a <code>Page</code> defines that the full structure of the XML is to be filled with the XML representation of each <code>Word</code> of the <code>Page</code>:</p>
<p><pre class="brush: scala;">
def toXml = &lt;page&gt; { words.toList.map(_.toXml) } &lt;/page&gt;
</pre></p>
<p>We also needed a method to get a simple text representation of the <code>Page</code>, made only of the most recent form of each <code>Word</code>:</p>
<p><pre class="brush: scala;">
def toText = (&quot;&quot; /: words) (_ + &quot; &quot; + _.history.top.form)
</pre></p>
<p>And to implement a simple full text search for collecting pages in which the edit history of a <code>Word</code> contains the given term, I checked each <code>Page</code> like this:</p>
<p><pre class="brush: scala;">
page.words.exists(_.history.exists(_.form contains term))
</pre></p>
<p>On the e4 side, the whole development experience feels much more lightweight and modern than developing with Eclipse 3 thanks to e4 features like the <del datetime="2010-07-22T17:24:48+00:00"><a href="http://wiki.eclipse.org/E4/UI/Toolkit_Model">Toolkit</a></del> <a href="http://wiki.eclipse.org/E4/UI/Modeled_UI">Workbench Model</a>, <a href="http://wiki.eclipse.org/E4/Contexts">dependency injection</a> and <a href="http://wiki.eclipse.org/E4/CSS/SWT_Mapping">CSS styling</a>.</p>
<p>For instance, the view at the bottom of the application (showing the original scan) needs to listen to the selection of the <code>Page</code> in the top view (showing pages matching the search term). To listen to the selection of pages, the view defines a method with the following signature:</p>
<p><pre class="brush: java;">
@Inject public void setSelection(@Optional @Named(SELECTION) Page page)
</pre></p>
<p>At the same time, the bottom view also needs to react to the selection of a word in the central edit view, in order to highlight the particular section in the page. Again, we define that we want to get called if a word is selected somewhere (which is represented by a <code>Text</code> widget here):</p>
<p><pre class="brush: java;">
@Inject public void setSelection(@Optional @Named(SELECTION) Text word)
</pre></p>
<p>And I think it&#8217;s really awesome to be able to specify font style and size (and even gradients) for the <code>Text</code> widgets used in the edit view with CSS:</p>
<p><pre class="brush: css;">
Text { font: Times 14px; background-color: #e8e8e8 #cccccc 60%; }
</pre></p>
<p>With the information on how the views are put together in the TM and the CSS file containing the styling information, the remaining UI code feels much lighter than before: there are basically just a few view classes and handlers, communicating loosely via DI and the TM.</p>
<p>So for me, combining Scala and e4 is a great new way to write a Java desktop app! And hopefully more&#8230; Our plans for the beta include multi-user support and web deployment with <a href="http://wiki.eclipse.org/RAP">RAP</a> &#8211; some challenges for sure, but with the great start I had into e4 development, I&#8217;m very confident it will work out!</p>
<p>We have been working on this in public from the start (after all, it&#8217;s publicly funded), so you can take a closer look at the code or check out this very early state of the application <a href="http://www.github.com/fsteeg/drc">on GitHub</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/1085/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/1085/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/1085/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/1085/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/1085/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/1085/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/1085/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/1085/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/1085/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/1085/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/1085/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/1085/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/1085/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/1085/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=1085&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2010/04/18/an-eclipse-rcp-digitization-wiki-with-e4-and-scala/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/04/screenshot-drc-b1-m1.png" medium="image">
			<media:title type="html">screenshot-drc-b1-m1</media:title>
		</media:content>
	</item>
		<item>
		<title>Google Summer of Code 2010 at Eclipse</title>
		<link>http://fsteeg.com/2010/03/19/google-summer-of-code-2010-at-eclipse/</link>
		<comments>http://fsteeg.com/2010/03/19/google-summer-of-code-2010-at-eclipse/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 23:27:05 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[soc]]></category>

		<guid isPermaLink="false">http://fsteeg.wordpress.com/?p=911</guid>
		<description><![CDATA[The Google Summer of Code 2010 is on and once again, Eclipse has been accepted as a mentoring organization. If you want to contribute to Eclipse, build a great project, and get more involved with the Eclipse community - all as a summer job paid by Google - then check out the ideas page and apply. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=911&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://socghop.appspot.com/">Google Summer of Code</a> 2010 is on and <a href="http://wiki.eclipse.org/Google_Summer_of_Code">once again</a>, Eclipse has been accepted as a <a href="http://socghop.appspot.com/gsoc/org/show/google/gsoc2010/eclipse">mentoring organization</a>. If you want to contribute to Eclipse, build a great project, and get more involved with the Eclipse community &#8211; all as a summer job paid by Google &#8211; then check out the <a href="http://wiki.eclipse.org/Google_Summer_of_Code_2010_Ideas">ideas page</a> and <a href="http://socghop.appspot.com/document/show/gsoc_program/google/gsoc2010/faqs#student_apply">apply</a>.</p>
<p>I was a SOC student at Eclipse last year and it has been an awesome experience! After completing my project, I wanted to create and spread some SOC swag and had stickers printed from the official Eclipse SOC logo. Since it was the first time I did this, after sending multiple different sizes of the logo, the sticker shop gave up on me and just sent me the double amount I had ordered, but uncut.</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/03/soc-stickers.jpg"><img class="alignnone size-full wp-image-1038" title="Hand-cut Eclipse Summer of Code stickers" src="http://fsteeg.files.wordpress.com/2010/03/soc-stickers.jpg?w=600" alt="Hand-cut Eclipse Summer of Code stickers"   /></a></p>
<p>So even after flooding both Ian Bull (my SOC mentor) and Gen Nishimura (the <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=184913">original logo</a> creator) with real-world postal sticker spam, I still have plenty left! So if you&#8217;d like your own Eclipse Summer of Code stickers, hand-cut by a genuine Eclipse SOC student, just mail me your address, and I&#8217;ll be happy to ship you some.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/911/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/911/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/911/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/911/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/911/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/911/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/911/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/911/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/911/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/911/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/911/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/911/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/911/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/911/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=911&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2010/03/19/google-summer-of-code-2010-at-eclipse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/03/soc-stickers.jpg" medium="image">
			<media:title type="html">Hand-cut Eclipse Summer of Code stickers</media:title>
		</media:content>
	</item>
		<item>
		<title>Generating documentation from a wiki with Ant and Mylyn WikiText</title>
		<link>http://fsteeg.com/2010/03/14/generating-documentation-from-a-wiki-with-ant-and-mylyn-wikitext/</link>
		<comments>http://fsteeg.com/2010/03/14/generating-documentation-from-a-wiki-with-ant-and-mylyn-wikitext/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 17:10:06 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[soc]]></category>
		<category><![CDATA[authoring]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[zest]]></category>

		<guid isPermaLink="false">http://fsteeg.wordpress.com/?p=925</guid>
		<description><![CDATA[I was planning to update the dot4zest documentation when I saw the recent posts by David Green and Chris Aniszczyk on generating Eclipse help right from the wiki. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=925&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was planning to update the <a href="http://wiki.eclipse.org/Graphviz_DOT_as_a_DSL_for_Zest">dot4zest</a> documentation when I saw the recent posts by <a href="http://greensopinion.blogspot.com/2010/03/crowdsourcing-documentation-made-easy.html">David Green</a> and <a href="http://aniszczyk.org/2010/03/13/crowdsourcing-documentation-at-eclipse/">Chris Aniszczyk</a> on generating Eclipse help right from the wiki.</p>
<p>Outdated and duplicated documentation is one of the topics I keep encountering in basically every project I work on. Given that I was already generating the dot4zest help with WikiText (but from a file, not straight from the wiki) I decided to give it a try.</p>
<p>Following the instructions in the <a href="http://wiki.eclipse.org/DocumentationGuidelines/CrowdSourcingExample">crowdsourcing example</a>, I first got the WikiText <a href="http://www.eclipse.org/downloads/download.php?file=/tools/mylyn/update/weekly/mylyn-wikitext-standalone-latest.zip">standalone Jars</a> and set up a small Ant script:</p>
<p><pre class="brush: xml; collapse: true; light: false; toolbar: true;">
&lt;project name=&quot;dot4zest&quot; default=&quot;doc&quot; basedir=&quot;.&quot;&gt;
 wikitext.tasks.classpath&quot;&gt;
    &lt;fileset dir=&quot;Graphviz_DOT_as_a_DSL_for_Zest&quot;&gt;
        mylyn.wikitext.*core*.jar&quot;/&gt;
    &lt;/fileset&gt;
 &lt;/path&gt;
 &lt;taskdef classpathref=&quot;wikitext.tasks.classpath&quot; resource=
  &quot;org/eclipse/mylyn/internal/wikitext/mediawiki/core/tasks/tasks.properties&quot;/&gt;
 &lt;taskdef classpathref=&quot;wikitext.tasks.classpath&quot; resource=
  &quot;org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties&quot;/&gt;
 &lt;target name=&quot;doc&quot;&gt;
     &lt;!-- Set up the base wiki location to pull content from: --&gt;
     &lt;mediawiki-to-eclipse-help wikiBaseUrl=&quot;http://wiki.eclipse.org&quot;
        validate=&quot;true&quot;
        failonvalidationerror=&quot;true&quot;
        prependImagePrefix=&quot;images&quot;
        formatoutput=&quot;true&quot;
        defaultAbsoluteLinkTarget=&quot;doc_external&quot;
        dest=&quot;${basedir}&quot;
        title=&quot;Graphviz DOT as a DSL for Zest&quot;
        generateUnifiedToc=&quot;false&quot;&gt;
     	&lt;!-- Set up which wiki page to pull from: --&gt;
        &lt;path name=&quot;Graphviz_DOT_as_a_DSL_for_Zest&quot;
                title=&quot;Graphviz DOT as a DSL for Zest&quot;
                generateToc=&quot;true&quot;/&gt;
     &lt;/mediawiki-to-eclipse-help&gt;
 &lt;/target&gt;
&lt;/project&gt;
</pre></p>
<p>Running the Ant file (<em>ant</em> in a console or double-click after dragging it onto the Ant view in Eclipse) pulls the content <a href="http://wiki.eclipse.org/Graphviz_DOT_as_a_DSL_for_Zest">from the wiki location</a> specified in the script and generates the Eclipse help:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/03/dot4zest-eclipse-help-toc.png"><img class="alignnone size-full wp-image-952" title="dot4zest-eclipse-help-toc" src="http://fsteeg.files.wordpress.com/2010/03/dot4zest-eclipse-help-toc.png?w=600" alt="Generated Eclipse Help TOC"   /></a></p>
<p>Next, I updated the help TOC extension in the plugin.xml:</p>
<p><pre class="brush: xml; light: true;">
&lt;extension point=&quot;org.eclipse.help.toc&quot;&gt;
      &lt;toc file=&quot;Graphviz-DOT-as-a-DSL-for-Zest-toc.xml&quot; primary=&quot;true&quot;/&gt;
&lt;/extension&gt;
</pre></p>
<p>Then I added the generated help resources to the binary build in the <em>build</em> tab of the manifest editor to have them included in the deployed bundle:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/03/dot4zest-eclipse-help-build.png"><img class="alignnone size-full wp-image-956" title="dot4zest-eclipse-help-build" src="http://fsteeg.files.wordpress.com/2010/03/dot4zest-eclipse-help-build.png?w=600" alt="Including the generated help resources in the binary build"   /></a></p>
<p>With this, the wiki page content is included in the Eclipse online help of the bundle (Help &gt; Help Contents).</p>
<p>Being based on <a href="http://wiki.eclipse.org/Mylyn/WikiText">Mylyn WikiText</a> &#8211; which supports many wiki markup formats (textile, confluence, mediawiki, trac and twiki) as well as output to other formats than Eclipse help (e.g. DocBook and DITA) &#8211; I imagine this approach could be used in many project documentation setups.</p>
<p>I really like this WikiText feature both for technical and collaborative reasons: it reduces duplication (<em>DRY for docs!</em>) and eases collaboration on documentation. Instead of being part of the code repository, the help content is made available to a wider range of editors than the people committing code &#8211; which I believe is useful for projects of any size.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/925/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/925/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/925/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/925/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/925/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/925/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/925/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/925/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/925/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/925/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/925/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/925/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/925/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/925/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=925&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2010/03/14/generating-documentation-from-a-wiki-with-ant-and-mylyn-wikitext/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/03/dot4zest-eclipse-help-toc.png" medium="image">
			<media:title type="html">dot4zest-eclipse-help-toc</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/03/dot4zest-eclipse-help-build.png" medium="image">
			<media:title type="html">dot4zest-eclipse-help-build</media:title>
		</media:content>
	</item>
		<item>
		<title>Diagrams in wiki markup with Mylyn WikiText, DOT, and Zest</title>
		<link>http://fsteeg.com/2010/02/07/diagrams-in-wiki-markup-with-mylyn-wikitext-dot-and-zest/</link>
		<comments>http://fsteeg.com/2010/02/07/diagrams-in-wiki-markup-with-mylyn-wikitext-dot-and-zest/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 21:05:01 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[graphviz]]></category>
		<category><![CDATA[soc]]></category>
		<category><![CDATA[zest]]></category>

		<guid isPermaLink="false">http://fsteeg.wordpress.com/?p=828</guid>
		<description><![CDATA[I&#8217;m continuing on my ancient quest for Graphviz DOT support in Eclipse: after implementing initial support for rendering DOT with Zest in Eclipse through dot4zest and some early tinkering with dynamically drawing DOT embedded in wiki markup with Zest, I have now started to approach the next step: integrating the Graphviz export into the Mylyn [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=828&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m continuing on my <a href="http://wp.me/pwKJk-1L">ancient quest</a> for Graphviz DOT support in Eclipse: after implementing initial support for rendering DOT with Zest in Eclipse through <a href="http://wp.me/pwKJk-6M">dot4zest</a> and some <a href="http://wp.me/pwKJk-8P">early tinkering</a> with dynamically drawing DOT embedded in wiki markup with Zest, I have now started to approach the next step: integrating the Graphviz export into the Mylyn WikiText editor.</p>
<p>Say we are editing embedded <a href="http://en.wikipedia.org/wiki/DOT_language">DOT</a> in wiki markup with the Mylyn <a href="http://wiki.eclipse.org/Mylyn/WikiText">WikiText</a> editor and have an open dot4zest Zest graph view, which displays a <a href="http://www.eclipse.org/gef/zest/">Zest</a> representation of the DOT graph (powered by the EMF <a href="http://code.google.com/p/emfmodelvisualizer/">model visualizer</a> and <a href="http://www.eclipse.org/Xtext/">Xtext</a> &#8211; <a href="http://www.eclipse.org/org/foundation/eclipseawards/project.php">vote Xtext!</a>):</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-1.png"><img class="alignnone size-full wp-image-831" title="dot4zest-wikitext-1" src="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-1.png?w=600" alt="Mylyn Wikitext editor and Zest Graph View"   /></a></p>
<p>Now upon saving, dot4zest asks if we want to add a reference to the Graphviz image export to our wiki markup file (requires a local <a href="http://www.graphviz.org/">Graphviz</a> installation, for which we are prompted the first time the export happens):</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-2.png"><img class="alignnone size-full wp-image-832" title="dot4zest-wikitext-2" src="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-2.png?w=600" alt="Dialog"   /></a></p>
<p>If we say yes, dot4zest puts a reference to the exported image file into our plain text wiki markup file. This adds an image representation of the Zest graph displayed in the view to output generated from the plain text &#8211; like HTML export or the preview tab of the Mylyn WikiText editor:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-3.png"><img class="alignnone size-full wp-image-833" title="dot4zest-wikitext-3" src="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-3.png?w=600" alt="WikiText editor including exported image"   /></a></p>
<p>Being sort of <a href="http://wiki.eclipse.org/Gef/Incubator/Proposal">pre-incubation</a>, this is all still fairly restricted and experimental, e.g. it currently supports only a single graph per file and only Textile markup. I&#8217;ve added these latest changes to the update site, so if you want to check it out update your existing dot4zest installation or install it from the update site at <code>http://quui.de/updates</code> (category <em>Zest</em> -&gt; feature <em>dot4zest</em>).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/828/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/828/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/828/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/828/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/828/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/828/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/828/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/828/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/828/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/828/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/828/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/828/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/828/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/828/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=828&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2010/02/07/diagrams-in-wiki-markup-with-mylyn-wikitext-dot-and-zest/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-1.png" medium="image">
			<media:title type="html">dot4zest-wikitext-1</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-2.png" medium="image">
			<media:title type="html">dot4zest-wikitext-2</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/02/dot4zest-wikitext-3.png" medium="image">
			<media:title type="html">dot4zest-wikitext-3</media:title>
		</media:content>
	</item>
		<item>
		<title>Arduino, Eclipse, and the joy of extending your IDE into the physical world</title>
		<link>http://fsteeg.com/2010/01/25/arduino-eclipse-and-the-joy-of-extending-your-ide-into-the-physical-world/</link>
		<comments>http://fsteeg.com/2010/01/25/arduino-eclipse-and-the-joy-of-extending-your-ide-into-the-physical-world/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 21:20:12 +0000</pubDate>
		<dc:creator>Fabian Steeg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tinkering]]></category>

		<guid isPermaLink="false">http://fsteeg.wordpress.com/?p=619</guid>
		<description><![CDATA[Ever since I read about using Java and Lava to monitor project build status in Mike Clark&#8217;s Pragmatic Project Automation, I was thrilled by the idea of extending your IDE into the physical world. When I recently listened to an episode of the Chaosradio Express podcast about tinkering in the 21st century (in german) and learned about [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=619&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ever since I read about using <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=67492">Java and Lava</a> to monitor project build status in Mike Clark&#8217;s <em>Pragmatic Project Automation</em>, I was thrilled by the idea of extending your IDE into the physical world. When I recently listened to an episode of the <em>Chaosradio Express</em> podcast about <a href="http://chaosradio.ccc.de/cre138.html">tinkering in the 21st century</a> (in german) and learned about <a href="http://www.arduino.cc/">Arduino</a>, I thought this could be simple enough for me to get started with electronics and so I ordered a <a href="http://fritzing.org/shop/starter-kit/">Fritzing Starter Kit</a> and a book on <a href="http://www.amazon.com/Getting-Started-Arduino-Make-Projects/dp/0596155514">Getting Started with Arduino</a>.</p>
<p>With red, yellow and green LEDs included in the set, I had the idea of building something like a coder&#8217;s traffic light. The Eclipse problems view seemed like a good place to start as it contains content for red (errors), yellow (warnings) and green (empty view) state. Also, it is very configurable about what&#8217;s showing (through <em>Mylyn</em> or <em>Configure Contents</em>) and could thus be used flexibly with a very simple approach.</p>
<p>So this is the basic idea: If we are completely off while coding, and we&#8217;re writing something like <code>List&lt;&gt;</code>, we get the stop signal from Eclipse:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/01/red2.png"><img class="alignleft size-full wp-image-643" title="red" src="http://fsteeg.files.wordpress.com/2010/01/red2.png?w=600" alt="Red traffic light"   /></a><a href="http://fsteeg.files.wordpress.com/2010/01/empal-screen-error.png"><img class="size-medium wp-image-706 alignnone" title="empal-screen-error" src="http://fsteeg.files.wordpress.com/2010/01/empal-screen-error.png?w=300&#038;h=194" alt="Eclipse JDT with error in problems view" width="300" height="194" /></a></p>
<p>Now we try to do a little better, removing these confusing pointy brackets and write just <code>List</code>, which is better, but not quite right yet, and Eclipse tells us so:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/01/yellow.png"><img class="alignleft size-full wp-image-643" title="yellow" src="http://fsteeg.files.wordpress.com/2010/01/yellow.png?w=600" alt="Yellow traffic light"   /></a><a href="http://fsteeg.files.wordpress.com/2010/01/empal-screen-warning.png"><img class="size-medium wp-image-706 alignnone" title="empal-screen-warning" src="http://fsteeg.files.wordpress.com/2010/01/empal-screen-warning.png?w=300&#038;h=194" alt="Eclipse JDT with warning in the problems view" width="300" height="194" /></a></p>
<p>Now we remember it should be a <code>List&lt;Node&gt;</code>, and with an empty problems view we are good to go:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/01/green2.png"><img class="alignleft size-full wp-image-643" title="green" src="http://fsteeg.files.wordpress.com/2010/01/green2.png?w=600" alt="Green traffic light"   /></a><a href="http://fsteeg.files.wordpress.com/2010/01/empal-screen-empty.png"><img class="size-medium wp-image-706 alignnone" title="empal-screen-empty" src="http://fsteeg.files.wordpress.com/2010/01/empal-screen-empty.png?w=300&#038;h=194" alt="Eclipse JDT with empty problems view" width="300" height="194" /></a></p>
<p>In addition to the basic functionality of red, green and yellow lights, it would be cool if these lights would not be blindingly bright all the time, but rather adjust their brightness according to ambient light when coding in dim settings. Also, we want to turn the device on and off and have a separate light indicating if it&#8217;s on or off.</p>
<p>The first step to make the thing real is to build the hardware prototype using an Arduino, a solderless breadboard, LEDs, some wires and resistors, two buttons and a light sensor (image created with <a href="http://fritzing.org/">Fritzing</a>):</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/01/empal-plan1.png"><img class="alignnone size-medium wp-image-627" title="empal-plan" src="http://fsteeg.files.wordpress.com/2010/01/empal-plan1.png?w=243&#038;h=300" alt="empal-plan" width="243" height="300" /></a></p>
<p>Now that we have the hardware set up, let&#8217;s write the code for the Arduino. This is the code we upload to the Arduino hardware from the Arduino IDE. First we define shortcuts for the pins used, set the pin modes, and open a serial connection from the Arduino to the computer:</p>
<p><pre class="brush: cpp;">
void setup() {
  pinMode(BLUE, OUTPUT);   // #define BLUE 3
  pinMode(GREEN, OUTPUT);  // #define GREEN 9
  pinMode(YELLOW, OUTPUT); // #define YELLOW 10
  pinMode(RED, OUTPUT);    // #define RED 11
  pinMode(ON, INPUT);      // #define ON 8
  pinMode(OFF, INPUT);     // #define OFF 7
  Serial.begin(9600);
}
</pre></p>
<p>We can now define the top-level logic of what the board should do: if the device is on, turn the lights on, else turn them off:</p>
<p><pre class="brush: cpp;">
boolean on = false;
void loop() {
  if(digitalRead(ON) == HIGH) on = true;
  if(digitalRead(OFF) == HIGH) on = false;
  if(on) turnOnLights(); else turnOffLights();
}
</pre></p>
<p>I used two separate buttons for turning the device on and off to avoid dealing with de-bouncing issues and get a usable solution with very little code (plus I really like the separate on and off buttons on my amplifier&#8217;s remote so I thought it might make sense). Turning off is simple:</p>
<p><pre class="brush: cpp;">
void turnOffLights() {
  digitalWrite(GREEN, LOW);
  digitalWrite(RED, LOW);
  digitalWrite(YELLOW, LOW);
  digitalWrite(BLUE, LOW);
}
</pre></p>
<p>If the device is on, we first reset all lights and dim the power light depending on ambient light. Then we read from the serial connection to the computer, and depending on what we are reading, we set the traffic lights to green (0), yellow (1) or red (2):</p>
<p><pre class="brush: cpp;">
void turnOnLights() {
  turnOffLights(); dim(BLUE, 5, 25);
  switch(Serial.read()) {
    case 0 : dim(GREEN, 25, 255); break;
    case 1 : dim(YELLOW, 25, 255); break;
    case 2 : dim(RED, 25, 255); break;
    default: turnOffLights();
  }
  Serial.flush(); delay(1000);
}
</pre></p>
<p>For the traffic lights, we adjust the brightness according to what we read from the light sensor, mapping the light sensor&#8217;s input values (0-1023) to values for the traffic lights (25-255). For the power light we map to values between 5 and 25 only, to make it lower than the traffic lights. For the mapping, we use Arduino&#8217;s map function:</p>
<p><pre class="brush: cpp;">
void dim(int output, int mini, int maxi) {
  analogWrite(output, map(analogRead(0), 0, 1023, mini, maxi));
}
</pre></p>
<p>So now we have programmed our Arduino to light the traffic lights according to the input it gets via the serial USB port connection. To make this show the thing we want (the status of the problems view in Eclipse), we now have to turn to the Eclipse side of things. To communicate via the serial connection, we set up a Plug-in project in Eclipse with the <a href="http://rxtx.qbang.org/wiki/index.php/Main_Page">RXTX</a> library and add the lib folder as <a href="http://www.eclipsezone.com/eclipse/forums/t49342.html">a native library</a> for the RXTXcomm.jar:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/01/empal-native-lib.png"><img class="alignnone size-full wp-image-743" style="border:1px solid lightgray;" title="empal-native-lib" src="http://fsteeg.files.wordpress.com/2010/01/empal-native-lib.png?w=600" alt="Native library setup"   /></a></p>
<p>I had to rename the native library to <code>RXTXcomm.jnilib</code> to make this work. Also, RXTX only works with Java 5, so on my Mac I had to get Java 5 from Leopard to make this work on Snow Leopard. As Java 5 from Leopard is 32 bit, I had to use a 32 bit version of Eclipse, too. I also had to create a writable directory <code>/var/lock</code>. With the library set up, we can now connect to the Arduino from within the Java code in our Eclipse bundle. We first set up the connection, specifying the <code>cu.usbserial</code> port that is set up in the Arduino IDE:</p>
<p><pre class="brush: java;">
String portId = &quot;/dev/cu.usbserial-A9007WtK&quot;; // from Arduino IDE
CommPortIdentifier id = CommPortIdentifier.getPortIdentifier(portId);
SerialPort port = (SerialPort) id.open(&quot;Eclipse-Arduino&quot;, 1000);
final OutputStream output = port.getOutputStream()
</pre></p>
<p>Then, we declare a <code>Runnable</code> that gets the status from the problems view and sends the current state through the serial USB connection to the Arduino (note that this is not particularly clean as it uses internal API and relies on the specific format of the description string, but it&#8217;s short and illustrates how to interface with the Arduino hardware from an Eclipse bundle):</p>
<p><pre class="brush: java;">
final Runnable sendStatus = new Runnable() {
  public void run() {
    String viewId = &quot;org.eclipse.ui.views.ProblemView&quot;;
    IViewPart view = getSite().getPage().findView(viewId);
    if (view == null) return;
    ProblemsView problemsView = ((ProblemsView) view);
    String desc = problemsView.getContentDescription();
    try {
      int err = 2, warn = 1, ok = 0;
      output.write(
                desc.contains(&quot;0 items&quot;) ? ok
              : desc.contains(&quot;0 errors&quot;) ? warn
              : desc.trim().length() &gt; 0 ? err : -1);
    } catch (IOException e) { e.printStackTrace(); }
  }
};
</pre></p>
<p>Then, we run the <code>Runnable</code> asynchronously in a background thread:</p>
<p><pre class="brush: java;">
new Thread(new Runnable() {
  public void run() {
    while (true) {
      parent.getDisplay().asyncExec(sendStatus);
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) { e.printStackTrace(); }
    }
  }
}).start();
</pre></p>
<p>So with the prototype built on the breadboard we have the basic device working, and can get a heads up from Eclipse even when we&#8217;re staring at the keyboard during coding:</p>
<p><a href="http://fsteeg.files.wordpress.com/2010/01/empal-picture.jpg"><img class="alignnone size-full wp-image-733" title="empal-picture" src="http://fsteeg.files.wordpress.com/2010/01/empal-picture.jpg?w=600" alt="Picture of the prototype"   /></a></p>
<p>And it doesn&#8217;t have to stop here: how about moving those lights <em>into</em> the keyboard, or building a Lego case for it, or even creating a real <a href="http://fritzing.org/shop/fab/">circuit board</a> and <a href="http://www.makerbot.com/">custom case</a> for the device. And on the software side, we could make it configurable for different Eclipse views (like the JUnit view) or connect it to continuous integration. Tinkering on hardware and software tooling with Arduino and Eclipse &#8211; oh joy!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fsteeg.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fsteeg.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fsteeg.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fsteeg.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/fsteeg.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/fsteeg.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/fsteeg.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/fsteeg.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fsteeg.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fsteeg.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fsteeg.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fsteeg.wordpress.com/619/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fsteeg.wordpress.com/619/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fsteeg.wordpress.com/619/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fsteeg.com&amp;blog=7806130&amp;post=619&amp;subd=fsteeg&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://fsteeg.com/2010/01/25/arduino-eclipse-and-the-joy-of-extending-your-ide-into-the-physical-world/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/528394f867632bcca8497088cd71a6d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">fsteeg</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/red2.png" medium="image">
			<media:title type="html">red</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/empal-screen-error.png?w=300" medium="image">
			<media:title type="html">empal-screen-error</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/yellow.png" medium="image">
			<media:title type="html">yellow</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/empal-screen-warning.png?w=300" medium="image">
			<media:title type="html">empal-screen-warning</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/green2.png" medium="image">
			<media:title type="html">green</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/empal-screen-empty.png?w=300" medium="image">
			<media:title type="html">empal-screen-empty</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/empal-plan1.png?w=243" medium="image">
			<media:title type="html">empal-plan</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/empal-native-lib.png" medium="image">
			<media:title type="html">empal-native-lib</media:title>
		</media:content>

		<media:content url="http://fsteeg.files.wordpress.com/2010/01/empal-picture.jpg" medium="image">
			<media:title type="html">empal-picture</media:title>
		</media:content>
	</item>
	</channel>
</rss>
