<?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> &#187; Blog</title>
	<atom:link href="http://www.kim-herzig.de/category/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kim-herzig.de</link>
	<description>Kim Herzig &#124; Software Engineering Chair &#124; Saarland University</description>
	<lastBuildDate>Sat, 05 May 2012 18:14:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Fixing Google GData Library (1+)</title>
		<link>http://www.kim-herzig.de/2012/04/01/fixing-google-gdata-library-1/</link>
		<comments>http://www.kim-herzig.de/2012/04/01/fixing-google-gdata-library-1/#comments</comments>
		<pubDate>Sun, 01 Apr 2012 22:53:03 +0000</pubDate>
		<dc:creator>kim</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.kim-herzig.de/?p=795</guid>
		<description><![CDATA[Google has many products and projects. The problem is that for many projects, the current version is deprecated and the new one not ready yet. For GData, Google&#8217;s library to access core API infrastructure such as Google&#8217;s project hosting services is not getting maintained anymore. For me this is a major drawback since APIs are [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Google has many products and projects. The problem is that for many projects, the current version is deprecated and the new one not ready yet. For GData, Google&#8217;s library to access core API infrastructure such as Google&#8217;s project hosting services is not getting maintained anymore. For me this is a major drawback since APIs are the better way to access software project repositories than parsing HTML. </p>
<p>Currently we are working on a mining framework called &#8220;mozkito&#8221; that will combine all our mining techniques including bug tracker parsing and processing. Parsing bug reports is easy when you have working APIs at hand but tedious when you have to parse the human target front end&#8212;basically you have to parse HTML. Now, parsing public Google bug trackers from <a href="code.google.com" target="_blank"><i>code.google.com</i></a> seems to be easy since you can use the <a href="http://code.google.com/p/support/wiki/IssueTrackerAPIJava" target="_blank">Google&#8217;s Project Hosting JAVA API</a> to access the content of each issue tracker programmatically. So far in theory. In practice this work well unless you want to combine your mining tool with libraries that depend on a current version of <a href="http://code.google.com/p/guava-libraries/" target="_blank">Google&#8217;s <i>Guava</i> library</a>. </p>
<p>Now, to understand the problem, we have to understand the history of the GUAVA library. GUAVA is a set of libraries developed by Google. Before GUAVA was released, the single libraries now contained in GUAVA were released separately. So far so good. The basic problem concerning Google&#8217;s project hosting library (we will use the acronym CODE LIB for the remainder of this text) is that CODE LIB depends the former and now deprecated <a href="http://code.google.com/p/google-collections/" target="_blank">Google collections library</a> (short GCOLLECTIONS) instead of it&#8217;s replacement library GUAVA. If your own project (like mine) depends (direct or inherited) on GUAVA then you will run into the problem, that GUAVA and GCOLLECTIONS need to be put on the same CLASSPATH. Although GUAVA should be fully backward compatible with GCOLLECTIONS it turns out that this is simply not the case. The GCOLLECTIONS class <i>ImmutableSet</i> is not compatible with it&#8217;s corresponding class in GUAVA missing a method definition required for CODE LIB.</p>
<p>Since Google does not maintain multiple of their central API libraries anymore, this issue is unresolved since quite some time. The issue reports covering this issue are old but still unresolved. Well, let&#8217;s do the job for Google then. We won&#8217;t get the Google salary for this but at least we can continue parsing their deprecated and unmaintained services.</p>
<p>For those of you who do not care about the solution but simply need a version that does the trick: here you find the <a href="https://nexus.own-hero.net/service/local/artifact/maven/redirect?r=external&#038;g=com.google.guava&#038;a=guava&#038;v=11.0.2-mozkito&#038;e=jar" target="_blank">GUAVA.MOZKITO</a> version and here the modified <a href="https://nexus.own-hero.net/service/local/artifact/maven/redirect?r=external&#038;g=com.google.gdata&#038;a=gdata-core-1.0&#038;v=1.41.5.guava&#038;e=jar" target="_blank">GDATA-CORE.GUAVA</a> and <a href="https://nexus.own-hero.net/service/local/artifact/maven/redirect?r=external&#038;g=com.google.gdata&#038;a=gdata-projecthosting-2.1&#038;v=1.41.5.guava&#038;e=jar" target="_blank">GDATA-PROJECTHOSTING.GUAVA</a> library. All modified libraries come with no warranty nor guarantees and are as they are. Maven users can use our maven nexus instance <a href="https://nexus.own-hero.net/" target="_blank">https://nexus.own-hero.net/</a> as repository and adding the following dependencies to their <i>pom.xml</i>:</p>
<div class="codecolorer-container xml blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.google.gdata<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>gdata-core-1.0<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.41.5.guava<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.google.gdata<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>gdata-projecthosting-2.1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.41.5.guava<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.google.guava<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>guava<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>11.0.2-mozkito<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<p>Those of you who want to see the solution on detail just have to read the remainder. The solution has two major step: first we have to bug fix the <i>ImmutableSet</i> class GUAVA before using the revised version of GUAVA to build a new version of GDATA (containing CODE LIB). </p>
<h3>Fixing GUAVA</h3>
<p>Now first, clone the current version of GDATA from Google using <a href="http://git-scm.com/" target="_blank">git</a>:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">git clone</span> https:<span style="color: #000000; font-weight: bold;">//</span>code.google.com<span style="color: #000000; font-weight: bold;">/</span>p<span style="color: #000000; font-weight: bold;">/</span>guava-libraries<span style="color: #000000; font-weight: bold;">/</span></div></td></tr></tbody></table></div>
<p>Then, we have to path the class <i>ImmutableSet</i>. This class contains a number of unusual classes defining the same method over and over again just using a different number of arguments all having the same type before defining the method with a variable set of arguments.</p>
<p>The code looks like this (stripped JavaDoc):</p>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> <span style="color: #000000; font-weight: bold;">extends</span> ImmutableCollection<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> <span style="color: #000000; font-weight: bold;">implements</span> Set<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span> EmptyImmutableSet.<span style="color: #006633;">INSTANCE</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span>E element<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> SingletonImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span>E e1, E e2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> construct<span style="color: #009900;">&#40;</span>e1, e2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span>E e1, E e2, E e3<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> construct<span style="color: #009900;">&#40;</span>e1, e2, e3<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span>E e1, E e2, E e3, E e4<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> construct<span style="color: #009900;">&#40;</span>e1, e2, e3, e4<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span>E e1, E e2, E e3, E e4, E e5<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> construct<span style="color: #009900;">&#40;</span>e1, e2, e3, e4, e5<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span>E e1, E e2, E e3, E e4, E e5, E e6,<br />
&nbsp; &nbsp; &nbsp; E... <span style="color: #006633;">others</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> paramCount <span style="color: #339933;">=</span> <span style="color: #cc66cc;">6</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> elements <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a><span style="color: #009900;">&#91;</span>paramCount <span style="color: #339933;">+</span> others.<span style="color: #006633;">length</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; elements<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> e1<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; elements<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> e2<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; elements<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> e3<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; elements<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> e4<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; elements<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> e5<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; elements<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> e6<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> paramCount<span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> elements.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; elements<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> others<span style="color: #009900;">&#91;</span>i <span style="color: #339933;">-</span> paramCount<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> construct<span style="color: #009900;">&#40;</span>elements<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> construct<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a>... <span style="color: #006633;">elements</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; ....<br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; ....<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The reason for methods like on line 19</p>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span>E e1, E e2, E e3, E e4<span style="color: #009900;">&#41;</span></div></td></tr></tbody></table></div>
<p>when having a method like on line 43:</p>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> construct<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aobject+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Object</span></a>... <span style="color: #006633;">elements</span><span style="color: #009900;">&#41;</span></div></td></tr></tbody></table></div>
<p>is due to type safety. Let&#8217;s make things simple and remove all the existing <i>of()</i> methods and add a method whose signature stems from <i>google-collections</i>:</p>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> ImmutableSet<span style="color: #339933;">&lt;</span>E<span style="color: #339933;">&gt;</span> of<span style="color: #009900;">&#40;</span>E... <span style="color: #006633;">elements</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">return</span> construct<span style="color: #009900;">&#40;</span>elements<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The patch we applied is available here: <a href="http://www.kim-herzig.de/wp-content/uploads/2012/04/ImmutableSet.diff_.zip" targer="_blank">http://www.kim-herzig.de/wp-content/uploads/2012/04/ImmutableSet.diff_.zip</a>. This should do the trick. Next, we have to compile the modified GUAVA. Which again can be complicated. On our machine, we had to compile GUAVA using JDK1.7 because the maven build system caused an JDK1.6 compiler to fail silently resulting in a compiled GUAVA that contains not all required and necessary class files. So switch to JDK1.7 and then run</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mvn clean mvn clean package source:jar javadoc:jar</div></td></tr></tbody></table></div>
<p>In <i>guava/target/</i> you find the newly compiled GUAVA library. We strongly recommend to rename this version of GUAVA to indicate that this is your self-modified version of GUAVA. For the remainder of this text we call the library jar file: <i>guava-11.0.2-mozkito.jar</i>.</p>
<h3>Fixing GDATA</h3>
<p>The second phase of this Google code fixing session is more easy. Basically, we have to rebuild the GDATA library replacing it&#8217;s dependency on GCOLLECTIONS with our newly backed <i>guava-11.0.2-mozkito.jar</i>. </p>
<p>First, <a href="http://code.google.com/p/guava-libraries/" target="_blank">download the latest version of GDATA (currently 1.46.0)</a> and unzip the downloaded file. Unzipping GDATA yields a set of directories and files similar to this:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kim<span style="color: #000000; font-weight: bold;">@</span>grid1 <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>gdata<span style="color: #000000; font-weight: bold;">/</span>java $ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-llah</span> <br />
total 52K<br />
drwxr-xr-x <span style="color: #000000;">11</span> kim staff 4.0K Mar <span style="color: #000000;">28</span> <span style="color: #000000;">18</span>:<span style="color: #000000;">11</span> .<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-xr-x &nbsp;<span style="color: #000000;">3</span> kim staff 4.0K Mar &nbsp;<span style="color: #000000;">9</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">38</span> ..<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-x--- &nbsp;<span style="color: #000000;">2</span> kim staff 4.0K Mar <span style="color: #000000;">28</span> <span style="color: #000000;">18</span>:02 build-src<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #660033;">-rw-------</span> &nbsp;<span style="color: #000000;">1</span> kim staff 3.7K Sep &nbsp;<span style="color: #000000;">9</span> &nbsp;<span style="color: #000000;">2011</span> build-src.xml<br />
drwxr-xr-x <span style="color: #000000;">25</span> kim staff 4.0K Mar <span style="color: #000000;">28</span> <span style="color: #000000;">18</span>:<span style="color: #000000;">12</span> classes<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-x--- &nbsp;<span style="color: #000000;">3</span> kim staff 4.0K Mar <span style="color: #000000;">28</span> <span style="color: #000000;">18</span>:01 deps<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-x--- &nbsp;<span style="color: #000000;">4</span> kim staff 4.0K Sep &nbsp;<span style="color: #000000;">9</span> &nbsp;<span style="color: #000000;">2011</span> doc<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-xr-x &nbsp;<span style="color: #000000;">4</span> kim staff 4.0K Mar &nbsp;<span style="color: #000000;">9</span> <span style="color: #000000;">17</span>:<span style="color: #000000;">49</span> genfiles<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-x--- &nbsp;<span style="color: #000000;">2</span> kim staff 4.0K Mar <span style="color: #000000;">28</span> <span style="color: #000000;">18</span>:<span style="color: #000000;">12</span> lib<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-x--- &nbsp;<span style="color: #000000;">2</span> kim staff 4.0K Sep &nbsp;<span style="color: #000000;">6</span> &nbsp;<span style="color: #000000;">2011</span> manifest<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-x--- &nbsp;<span style="color: #000000;">3</span> kim staff 4.0K Sep &nbsp;<span style="color: #000000;">9</span> &nbsp;<span style="color: #000000;">2011</span> src<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #660033;">-rw-------</span> &nbsp;<span style="color: #000000;">1</span> kim staff 1.3K Sep &nbsp;<span style="color: #000000;">9</span> &nbsp;<span style="color: #000000;">2011</span> version.properties</div></td></tr></tbody></table></div>
<p>To replace the dependency of GCOLLECTIONS with our own GUAVA version we have to place the <i>guava-11.0.2-mozkito.jar</i> file into the <i>deps</i> folder. To make things rock solid, we deleted the GCOLLECTIONS jar file from the <i>deps</i> directory.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kim<span style="color: #000000; font-weight: bold;">@</span>grid1 <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>gdata<span style="color: #000000; font-weight: bold;">/</span>java $ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-llah</span> deps<span style="color: #000000; font-weight: bold;">/</span><br />
total 2.9M<br />
drwxr-x--- &nbsp;<span style="color: #000000;">3</span> kim staff 4.0K Mar <span style="color: #000000;">28</span> <span style="color: #000000;">18</span>:01 .<span style="color: #000000; font-weight: bold;">/</span><br />
drwxr-xr-x <span style="color: #000000;">11</span> kim staff 4.0K Mar <span style="color: #000000;">28</span> <span style="color: #000000;">18</span>:<span style="color: #000000;">11</span> ..<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #660033;">-rw-r--r--</span> &nbsp;<span style="color: #000000;">1</span> kim staff 1.6M Mar &nbsp;<span style="color: #000000;">9</span> <span style="color: #000000;">18</span>:01 guava-11.0.2-mozkito.jar<br />
<span style="color: #660033;">-rw-------</span> &nbsp;<span style="color: #000000;">1</span> kim staff &nbsp;33K Sep &nbsp;<span style="color: #000000;">6</span> &nbsp;<span style="color: #000000;">2011</span> jsr305.jar<br />
drwxr-xr-x &nbsp;<span style="color: #000000;">3</span> kim staff 4.0K Feb <span style="color: #000000;">22</span> 09:01 META-INF<span style="color: #000000; font-weight: bold;">/</span></div></td></tr></tbody></table></div>
<p>Next, we have to tell the build system to use OUR own GUAVA instead of GCOLLECTIONS. Open the file <i>build-src/build.properties</i> and replace the line <i>google-collect.jar=deps/google-collect-1.0-rc1.jar</i> on line 13 referring to our own GUAVA version:</p>
<div class="codecolorer-container properties blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br /></div></td><td><div class="properties codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;"># Points to a external library dependancies</span><br />
<span style="color: #808080; font-style: italic;"># EDIT-THIS: If rebuilding the authsub or gbase/recipe sample point to,</span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;servlet jar in Sun's Servlet API library.</span><br />
<span style="color: #000080; font-weight:bold;">servlet.jar</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">/tmp/gdata_dep/servlet-api-2.4.jar</span><br />
<span style="color: #808080; font-style: italic;"># EDIT-THIS: Point to mail.jar lib in Sun's Java Mail API.</span><br />
<span style="color: #000080; font-weight:bold;">mail.jar</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">/tmp/gdata_dep/mail.jar</span><br />
<span style="color: #808080; font-style: italic;"># EDIT-THIS: If using version older than JDK 1.6, </span><br />
<span style="color: #808080; font-style: italic;"># &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Point to activation.jar in Sun's activation framework library.</span><br />
<span style="color: #000080; font-weight:bold;">activation.jar</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">/tmp/gdata_dep/activation.jar</span><br />
<br />
<span style="color: #808080; font-style: italic;"># EDIT-THIS: Point to google-collect lib</span><br />
<span style="color: #808080; font-style: italic;">#google-collect.jar=deps/google-collect-1.0-rc1.jar</span><br />
<span style="color: #000080; font-weight:bold;">google-guava.jar</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">deps/guava-11.0.2.jar</span><br />
<span style="color: #000080; font-weight:bold;">google-jsr305.jar</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">deps/jsr305.jar</span><br />
<br />
<span style="color: #808080; font-style: italic;"># Include debugging information in built library files. Possible values &quot;on&quot; or &quot;off&quot;</span><br />
<span style="color: #000080; font-weight:bold;">javac.debug</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">true</span><br />
<span style="color: #000080; font-weight:bold;">javac.debuglevel</span><span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">lines,vars,source</span></div></td></tr></tbody></table></div>
<p>This should be it. Compile you own version of GDATA using the following commands (requires <a href="http://ant.apache.org/" target="_blank">Apache ANT</a>.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ant clean build <span style="color: #660033;">-f</span> build-src.xml <span style="color: #660033;">-lib</span> deps</div></td></tr></tbody></table></div>
<p>Done. Now, you have your own fixed version of GUAVA and GDATA and can do you own job. <img src='http://www.kim-herzig.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.kim-herzig.de/2012/04/01/fixing-google-gdata-library-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stacked Bar Plots with GGPlot2</title>
		<link>http://www.kim-herzig.de/2012/03/14/stacked-bar-plots-with-ggplot2/</link>
		<comments>http://www.kim-herzig.de/2012/03/14/stacked-bar-plots-with-ggplot2/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 17:54:48 +0000</pubDate>
		<dc:creator>kim</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[ggplot2]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://www.kim-herzig.de/?p=745</guid>
		<description><![CDATA[When plotting contribution shares, pie charts seem to be logic. But pie charts look ugly and do not add much more information than presenting the data in a table. But there is an alterative: stacker bar charts. In R you can use the ggplot2 package to plot them easily. Below, you find the very same [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>When plotting contribution shares, pie charts seem to be logic. But pie charts look ugly and do not add much more information than presenting the data in a table. But there is an alterative: stacker bar charts. In <a href="http://cran.r-project.org/">R</a> you can use the <a href="http://had.co.nz/ggplot2/">ggplot2</a> package to plot them easily. Below, you find the very same data plotted using two different layout. Left the stacked bar chart. Right you see the stacked bar chart using polar coordinates.</p>
<p><a href="http://www.kim-herzig.de/wp-content/uploads/2012/03/ggplot1.png"><img src="http://www.kim-herzig.de/wp-content/uploads/2012/03/ggplot1.png" width="250px"/></a><a href="http://www.kim-herzig.de/wp-content/uploads/2012/03/ggplot2.png"><img src="http://www.kim-herzig.de/wp-content/uploads/2012/03/ggplot2.png" width="250px"/></a></p>
<p>To reproduce both charts, copy and paste the following code to your R-Shell.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">library<span style="color: #7a0874; font-weight: bold;">&#40;</span>RColorBrewer<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
library<span style="color: #7a0874; font-weight: bold;">&#40;</span>ggplot2<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
project <span style="color: #000000; font-weight: bold;">&lt;</span>- c<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'ArgoUML'</span>,<span style="color: #ff0000;">'ArgoUML'</span>,<span style="color: #ff0000;">'ArgoUML'</span>,<span style="color: #ff0000;">'ArgoUML'</span>,<span style="color: #ff0000;">'ArgoUML'</span>,<span style="color: #ff0000;">'GWT'</span>,<span style="color: #ff0000;">'GWT'</span>,<span style="color: #ff0000;">'GWT'</span>,<span style="color: #ff0000;">'GWT'</span>,<span style="color: #ff0000;">'GWT'</span>,<span style="color: #ff0000;">'Jaxen'</span>,<span style="color: #ff0000;">'Jaxen'</span>,<span style="color: #ff0000;">'Jaxen'</span>,<span style="color: #ff0000;">'Jaxen'</span>,<span style="color: #ff0000;">'Jaxen'</span>,<span style="color: #ff0000;">'JRuby'</span>,<span style="color: #ff0000;">'JRuby'</span>,<span style="color: #ff0000;">'JRuby'</span>,<span style="color: #ff0000;">'JRuby'</span>,<span style="color: #ff0000;">'JRuby'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <br />
<br />
component <span style="color: #000000; font-weight: bold;">&lt;</span>- c<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'FileDistance'</span>,<span style="color: #ff0000;">'PackageDistance'</span>,<span style="color: #ff0000;">'DataDependency'</span>,<span style="color: #ff0000;">'CallGraphDistance'</span>,<span style="color: #ff0000;">'ChangeCouplings'</span>,<span style="color: #ff0000;">'FileDistance'</span>,<span style="color: #ff0000;">'PackageDistance'</span>,<span style="color: #ff0000;">'DataDependency'</span>,<span style="color: #ff0000;">'CallGraphDistance'</span>,<span style="color: #ff0000;">'ChangeCouplings'</span>,<span style="color: #ff0000;">'FileDistance'</span>,<span style="color: #ff0000;">'PackageDistance'</span>,<span style="color: #ff0000;">'DataDependency'</span>,<span style="color: #ff0000;">'CallGraphDistance'</span>,<span style="color: #ff0000;">'ChangeCouplings'</span>,<span style="color: #ff0000;">'FileDistance'</span>,<span style="color: #ff0000;">'PackageDistance'</span>,<span style="color: #ff0000;">'DataDependency'</span>,<span style="color: #ff0000;">'CallGraphDistance'</span>,<span style="color: #ff0000;">'ChangeCouplings'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
numbers <span style="color: #000000; font-weight: bold;">&lt;</span>- c<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">16</span>,<span style="color: #000000;">22</span>,<span style="color: #000000;">46</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">6</span>,<span style="color: #000000;">46</span>,<span style="color: #000000;">22</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">12</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">20</span>,<span style="color: #000000;">20</span>,<span style="color: #000000;">20</span>,<span style="color: #000000;">20</span>,<span style="color: #000000;">20</span>,<span style="color: #000000;">0</span>,<span style="color: #000000;">36</span>,<span style="color: #000000;">33</span>,<span style="color: #000000;">20</span>,<span style="color: #000000;">11</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
<span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #000000; font-weight: bold;">&lt;</span>- data.frame<span style="color: #7a0874; font-weight: bold;">&#40;</span>project,component,numbers<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
<span style="color: #666666; font-style: italic;">#plot the stacked bar plot</span><br />
ggplot<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">df</span>, aes<span style="color: #7a0874; font-weight: bold;">&#40;</span>x = project<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> + geom_bar<span style="color: #7a0874; font-weight: bold;">&#40;</span>aes<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">weight</span>=numbers, fill = component<span style="color: #7a0874; font-weight: bold;">&#41;</span>, position = <span style="color: #ff0000;">'fill'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> + scale_y_continuous<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span>, <span style="color: #007800;">breaks</span>=NA<span style="color: #7a0874; font-weight: bold;">&#41;</span> + scale_fill_manual<span style="color: #7a0874; font-weight: bold;">&#40;</span>values = <span style="color: #c20cb9; font-weight: bold;">rev</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>brewer.pal<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">6</span>, <span style="color: #ff0000;">&quot;Purples&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<br />
<span style="color: #666666; font-style: italic;">#plot the stacked bar plot with polar coordinates</span><br />
ggplot<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">df</span>, aes<span style="color: #7a0874; font-weight: bold;">&#40;</span>x = project<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> + geom_bar<span style="color: #7a0874; font-weight: bold;">&#40;</span>aes<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">weight</span>=numbers, fill = component<span style="color: #7a0874; font-weight: bold;">&#41;</span>, position = <span style="color: #ff0000;">'fill'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> + scale_y_continuous<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span>, <span style="color: #007800;">breaks</span>=NA<span style="color: #7a0874; font-weight: bold;">&#41;</span> + scale_fill_manual<span style="color: #7a0874; font-weight: bold;">&#40;</span>values = <span style="color: #c20cb9; font-weight: bold;">rev</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>brewer.pal<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">6</span>, <span style="color: #ff0000;">&quot;Purples&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> + coord_polar<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></div></td></tr></tbody></table></div>
<p>More in the coolest plotting framework ever on <a href="http://had.co.nz/ggplot2/">http://had.co.nz/ggplot2/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kim-herzig.de/2012/03/14/stacked-bar-plots-with-ggplot2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spell checking LaTeX Documents</title>
		<link>http://www.kim-herzig.de/2011/01/29/spell-checking-latex-documents/</link>
		<comments>http://www.kim-herzig.de/2011/01/29/spell-checking-latex-documents/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 11:17:29 +0000</pubDate>
		<dc:creator>kim</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.kim-herzig.de/?p=667</guid>
		<description><![CDATA[LaTeX is great and there is no better environment to write professional documents. But spell-checking text within LaTeX is difficult and all projects trying to solve this issue failed at various levels. One of the tools to check for spelling and grammar errors is Microsoft Word. To use MS Word to spell and grammar check [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>LaTeX is great and there is no better environment to write professional documents. But spell-checking text within LaTeX is difficult and all projects trying to solve this issue failed at various levels. One of the tools to check for spelling and grammar errors is <a href="http://office.microsoft.com/en-us/word" target="_blank">Microsoft Word</a>. To use MS Word to spell and grammar check LaTeX documents, one has to convert the LaTeX documents to a format readable by MS Word: <a href="http://en.wikipedia.org/wiki/Rich_Text_Format" target="_blank"><i>Rich Text Format</i> (RTF)</a>.  The <a href="http://www.tug.org/utilities/texconv/latex2rtf.html" target="_blank">latex2rtf</a> project at Sourceforge is transforming LaTeX document to RTF documents. Opening the RTF document using Word allows you to spell and grammar check your document. </p>
<p>There are some limitations to latex2rtf. It cannot handle LaTeX environments like</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">\usepackage{boxenminipage}</div></td></tr></tbody></table></div>
<p>. For more advanced LaTeX documents I normally stick to Acrobat Professional converting the compiled PDF documents into RTF or MS Word format directly. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.kim-herzig.de/2011/01/29/spell-checking-latex-documents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.kim-herzig.de @ 2012-05-20 06:07:22 -->
