<?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>Blog.Project13.pl &#187; java</title>
	<atom:link href="http://www.blog.project13.pl/index.php/category/java-coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.project13.pl</link>
	<description>The Blog of a Coder</description>
	<lastBuildDate>Sun, 05 Feb 2012 02:28:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>[release] Kanbanery for IntelliJ (and Android!)</title>
		<link>http://www.blog.project13.pl/index.php/project13/1372/release-kanbanery-for-intellij-and-android/</link>
		<comments>http://www.blog.project13.pl/index.php/project13/1372/release-kanbanery-for-intellij-and-android/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 01:08:56 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Project13]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[intellij]]></category>
		<category><![CDATA[kanban]]></category>
		<category><![CDATA[kanbanery]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1372</guid>
		<description><![CDATA[After not even one day of hacking, I&#8217;m releasing my first IntelliJ IDEA plugin. It enables &#8220;Tasks&#8221; (that default plugin in IntelliJ) to see tasks on the Kanbanery.com board. Thanks to this you&#8217;re able to commit always &#8220;refering to&#8221; some specific task. Using GitHub and Kanbanery such commits are linked back to the task on [...]]]></description>
			<content:encoded><![CDATA[<p>After not even one day of hacking, I&#8217;m releasing my first <strong>IntelliJ IDEA</strong> plugin. It enables &#8220;<strong>Tasks</strong>&#8221; (that default plugin in IntelliJ) to see tasks on the <strong><a href="http://www kanbanery.com" onclick="urchinTracker('/outgoing/www_kanbanery.com?referer=');">Kanbanery.com</a></strong> board.</p>
<p style="text-align: center;"><img class="aligncenter" title="Kanbanery and Intellij" src="https://github.com/ktoso/kanbanery-for-intellij/raw/master/doc/commit_github_task_id_kanbanery.png" alt="" width="546" height="265" /></p>
<p>Thanks to this you&#8217;re able to commit always &#8220;refering to&#8221; some specific task. Using <strong>GitHub</strong> and Kanbanery such commits are linked back to the task on the board, which makes code reviews very pleasant :-)</p>
<p style="text-align: center;"><img class="aligncenter" src="https://github.com/ktoso/kanbanery-for-intellij/raw/master/doc/switch_task_q_gives_a_nice_info.png" alt="" width="556" height="209" /></p>
<p style="text-align: left;">As we&#8217;re using Kanbanery in our team, I&#8217;ll hopefully have some time and ideas to make this plugin even more useful over time :-) So in case you&#8217;re interested just download the plugin from your IntelliJ or head to <a href="https://github.com/ktoso/kanbanery-for-intellij" onclick="urchinTracker('/outgoing/github.com/ktoso/kanbanery-for-intellij?referer=');">github to look at the source code</a> or <a href="plugins.intellij.net/plugin/edit/?pid=6363">vote for this plugin on it&#8217;s site</a>.</p>
<p style="text-align: center;"><img class="aligncenter" src="https://g0.gstatic.com/android/market/pl.project13.kanbanery/f-1024-0" alt="" width="517" height="252" /></p>
<p style="text-align: left;">Oh&#8230; Seems like I forgot to announce that I&#8217;ve also released a <strong><a title="Kanbanery for Android" href="https://market.android.com/details?id=pl.project13.kanbanery" target="_blank" onclick="urchinTracker('/outgoing/market.android.com/details?id=pl.project13.kanbanery&amp;referer=');">Android client for Kanbanery</a></strong> :-) Yup, that&#8217;s true, so got ahead and check it out if you&#8217;d like to. This one still needs some polishing, but the idea is to keep it in one codebase but develop for both, tablets and normal phones, so some things are a little bit tricky :-) I love to use it on my XOOM, but I&#8217;ll work hard to make the phone versions as awesome as the tablet one.</p>
<p style="text-align: center;"><img class="aligncenter" src="https://ssl.gstatic.com/android/market/pl.project13.kanbanery/ss-1280-7-0" alt="" width="523" height="327" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/project13/1372/release-kanbanery-for-intellij-and-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[JDK7] java.util.Objects &#8211; forgotten feature?</title>
		<link>http://www.blog.project13.pl/index.php/coding/1284/jdk7-java-lang-objects-forgotten-feature/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1284/jdk7-java-lang-objects-forgotten-feature/#comments</comments>
		<pubDate>Tue, 19 Apr 2011 09:08:51 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jdk7]]></category>
		<category><![CDATA[lang]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1284</guid>
		<description><![CDATA[This time just a quick post about something I&#8217;d really want to share with you all, and that&#8217;s been kind of forgotten during the release of JDK7 &#8211; java.util.Objects! Be sure to check out it&#8217;s javadoc to see what this small helper class can do for you :-) We&#8217;ll focus on two of it&#8217;s methods. [...]]]></description>
			<content:encoded><![CDATA[<p>This time just a quick post about something I&#8217;d really want to share with you all, and that&#8217;s been kind of forgotten during the release of JDK7 &#8211; <strong>java.util.Objects</strong>! Be sure to check out <a href="http://download.java.net/jdk7/docs/api/java/util/Objects.html" onclick="urchinTracker('/outgoing/download.java.net/jdk7/docs/api/java/util/Objects.html?referer=');">it&#8217;s <strong>javadoc</strong></a> to see what this small helper class can do for you :-) We&#8217;ll focus on two of it&#8217;s methods.</p>
<p>Now, we all remember how painful it it to write good equals and hashCode methods, yet we really should implement them to make our collections work the way they should work (HashAnythings, Lists, Sets). So we sometimes use <strong>Apache Commons</strong> to implement these, or just leave the coding to <strong>IntelliJ</strong> or <strong>NetBeans</strong>. The problem with the second, code generating, solution is that it&#8217;s a hell of a mess. Don&#8217;t believe me&#8230;? Just a quick reminder then&#8230;</p>
<div class="geshi no java">
<div class="head">class Test {</div>
<ol>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">private</span> <span class="kw3">String</span> &nbsp;name<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">private</span> <span class="kw3">String</span> &nbsp;surname<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">private</span> <span class="kw3">Integer</span> age<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw4">boolean</span> equals<span class="br0">&#40;</span><span class="kw3">Object</span> o<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw2">this</span> == o<span class="br0">&#41;</span> <span class="kw2">return</span> <span class="kw2">true</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>o == <span class="kw2">null</span> || getClass<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">!</span>= o.<span class="me1">getClass</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw2">return</span> <span class="kw2">false</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Test test = <span class="br0">&#40;</span>Test<span class="br0">&#41;</span> o<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>age <span class="sy0">!</span>= <span class="kw2">null</span> <span class="sy0">?</span> <span class="sy0">!</span>age.<span class="me1">equals</span><span class="br0">&#40;</span>test.<span class="me1">age</span><span class="br0">&#41;</span> : test.<span class="me1">age</span> <span class="sy0">!</span>= <span class="kw2">null</span><span class="br0">&#41;</span> <span class="kw2">return</span> <span class="kw2">false</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>name <span class="sy0">!</span>= <span class="kw2">null</span> <span class="sy0">?</span> <span class="sy0">!</span>name.<span class="me1">equals</span><span class="br0">&#40;</span>test.<span class="me1">name</span><span class="br0">&#41;</span> : test.<span class="me1">name</span> <span class="sy0">!</span>= <span class="kw2">null</span><span class="br0">&#41;</span> <span class="kw2">return</span> <span class="kw2">false</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>surname <span class="sy0">!</span>= <span class="kw2">null</span> <span class="sy0">?</span> <span class="sy0">!</span>surname.<span class="me1">equals</span><span class="br0">&#40;</span>test.<span class="me1">surname</span><span class="br0">&#41;</span> : test.<span class="me1">surname</span> <span class="sy0">!</span>= <span class="kw2">null</span><span class="br0">&#41;</span> <span class="kw2">return</span> <span class="kw2">false</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">return</span> <span class="kw2">true</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw4">int</span> hashCode<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">int</span> result = name <span class="sy0">!</span>= <span class="kw2">null</span> <span class="sy0">?</span> name.<span class="me1">hashCode</span><span class="br0">&#40;</span><span class="br0">&#41;</span> : <span class="nu0">0</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; result = <span class="nu0">31</span> <span class="sy0">*</span> result + <span class="br0">&#40;</span>surname <span class="sy0">!</span>= <span class="kw2">null</span> <span class="sy0">?</span> surname.<span class="me1">hashCode</span><span class="br0">&#40;</span><span class="br0">&#41;</span> : <span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; result = <span class="nu0">31</span> <span class="sy0">*</span> result + <span class="br0">&#40;</span>age <span class="sy0">!</span>= <span class="kw2">null</span> <span class="sy0">?</span> age.<span class="me1">hashCode</span><span class="br0">&#40;</span><span class="br0">&#41;</span> : <span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">return</span> result<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Now that we&#8217;ve remembered how painful it looks, let&#8217;s dive into JDK7:  The full code would look like this (this time equals is also accepting subclasses of Test, the above example didn&#8217;t):</p>
<div class="geshi no java">
<div class="head">package pl.project13;</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.Objects;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;* Date: 4/19/11</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;* @author Konrad Malawski</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> Test <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">private</span> <span class="kw3">String</span> &nbsp;name<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">private</span> <span class="kw3">String</span> &nbsp;surname<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">private</span> <span class="kw3">Integer</span> age<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> Test<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> Test<span class="br0">&#40;</span><span class="kw3">String</span> name, <span class="kw3">String</span> surname, <span class="kw3">Integer</span> age<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">name</span> = name<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">surname</span> = surname<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">age</span> = age<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> Test<span class="br0">&#40;</span><span class="kw3">String</span> name, <span class="kw3">String</span> surname<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">name</span> = name<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">surname</span> = surname<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw4">boolean</span> equals<span class="br0">&#40;</span><span class="kw3">Object</span> o<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw2">this</span> == o<span class="br0">&#41;</span> <span class="kw2">return</span> <span class="kw2">true</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="br0">&#40;</span>o <span class="kw2">instanceof</span> Test<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw2">return</span> <span class="kw2">false</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; &nbsp;if (o == null || getClass() != o.getClass()) return false;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Test that = <span class="br0">&#40;</span>Test<span class="br0">&#41;</span> o<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">boolean</span> result = <span class="kw2">true</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; result = result <span class="sy0">&amp;&amp;</span> Objects.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">this</span>.<span class="me1">name</span>, that.<span class="me1">name</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; result = result <span class="sy0">&amp;&amp;</span> Objects.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">this</span>.<span class="me1">surname</span>, that.<span class="me1">surname</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; result = result <span class="sy0">&amp;&amp;</span> Objects.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">this</span>.<span class="me1">age</span>, that.<span class="me1">age</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">return</span> result<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw4">int</span> hashCode<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">return</span> Objects.<span class="me1">hash</span><span class="br0">&#40;</span>name, surname, age<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Note the<strong> Objects.hash() </strong>method, wich is really a lifesaver and also the <strong>Objects.equals()</strong> method which makes our code NullPointerException safe, which the previous version had to tackle by using <strong>?:</strong>&#8230; And it read&#8217;s much nicer, Of course, you could skip the result variable, but I decided to do it like this for the sake of easy reading.</p>
<p>And here is it&#8217;s test:</p>
<div class="geshi no java">
<div class="head">package pl.project13;</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.HashSet;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.Set;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.TreeSet;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import static junit.framework.Assert.assertEquals;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import static junit.framework.Assert.assertFalse;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import static junit.framework.Assert.assertTrue;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;* Date: 4/19/11</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;* @author Konrad Malawski</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> TestTest <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; @org.<span class="me1">junit</span>.<span class="me1">Test</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw4">void</span> testEquals<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw2">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Test test = <span class="kw2">new</span> Test<span class="br0">&#40;</span><span class="st0">&quot;Konrad&quot;</span>, <span class="st0">&quot;Malawski&quot;</span>, <span class="nu0">21</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// true</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertTrue<span class="br0">&#40;</span>test.<span class="me1">equals</span><span class="br0">&#40;</span>test<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertTrue<span class="br0">&#40;</span>test.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">new</span> Test<span class="br0">&#40;</span><span class="st0">&quot;Konrad&quot;</span>, <span class="st0">&quot;Malawski&quot;</span>, <span class="nu0">21</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// false</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertFalse<span class="br0">&#40;</span>test.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">new</span> Test<span class="br0">&#40;</span><span class="st0">&quot;Wacław&quot;</span>, <span class="st0">&quot;Malawski&quot;</span>, <span class="nu0">1825</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertFalse<span class="br0">&#40;</span>test.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">new</span> Test<span class="br0">&#40;</span><span class="st0">&quot;Wacław&quot;</span>, <span class="st0">&quot;Malawski&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertFalse<span class="br0">&#40;</span>test.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">new</span> Test<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertFalse<span class="br0">&#40;</span>test.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">new</span> <span class="kw3">Object</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertFalse<span class="br0">&#40;</span>test.<span class="me1">equals</span><span class="br0">&#40;</span><span class="kw2">null</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; @org.<span class="me1">junit</span>.<span class="me1">Test</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw4">void</span> testHashCodeOnCollections<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw2">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Test test = <span class="kw2">new</span> Test<span class="br0">&#40;</span><span class="st0">&quot;Konrad&quot;</span>, <span class="st0">&quot;Malawski&quot;</span>, <span class="nu0">21</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">int</span> sizeBefore<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">int</span> sizeAfter<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">Set</span> treeSet = <span class="kw2">new</span> HashSet<span class="sy0">&amp;</span>lt<span class="sy0">;&amp;</span>gt<span class="sy0">;</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; treeSet.<span class="me1">add</span><span class="br0">&#40;</span>test<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; sizeBefore = treeSet.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; treeSet.<span class="me1">add</span><span class="br0">&#40;</span>test<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; sizeAfter = treeSet.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertEquals<span class="br0">&#40;</span>sizeBefore, sizeAfter<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; @org.<span class="me1">junit</span>.<span class="me1">Test</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw4">void</span> testHashCodeOnCollectionsOtherObject<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw2">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Test test = <span class="kw2">new</span> Test<span class="br0">&#40;</span><span class="st0">&quot;Konrad&quot;</span>, <span class="st0">&quot;Malawski&quot;</span>, <span class="nu0">21</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; Test test2 = <span class="kw2">new</span> Test<span class="br0">&#40;</span><span class="st0">&quot;Konrad&quot;</span>, <span class="st0">&quot;Malawski&quot;</span>, <span class="nu0">21</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">int</span> sizeBefore<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">int</span> sizeAfter<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">Set</span> treeSet = <span class="kw2">new</span> HashSet<span class="sy0">&amp;</span>lt<span class="sy0">;&amp;</span>gt<span class="sy0">;</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; treeSet.<span class="me1">add</span><span class="br0">&#40;</span>test<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; sizeBefore = treeSet.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; treeSet.<span class="me1">add</span><span class="br0">&#40;</span>test2<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; sizeAfter = treeSet.<span class="me1">size</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertEquals<span class="br0">&#40;</span>sizeBefore, sizeAfter<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Now that was nice wasn&#8217;t it? :-) <strong>Objects </strong>probably isn&#8217;t &#8220;the&#8221; killer feature that JDK7 has, but it&#8217;s a really nice addition, so let&#8217;s get to using it :-) The other utility methods in this class are:</p>
<ul>
<li><strong>static &lt;T&gt; int	compare(T a, T b, Comparator &lt; ? super T&gt; c)</strong><br />
Returns 0 if the arguments are identical and c.compare(a, b) otherwise.</li>
<li><strong>static boolean	deepEquals(Object a, Object b)</strong><br />
Returns true if the arguments are deeply equal to each other and false otherwise.</li>
<li><strong>static boolean	equals(Object a, Object b)</strong><br />
Returns true if the arguments are equal to each other and false otherwise.</li>
<li><strong>static int	hash(Object&#8230; values)</strong><br />
Generates a hash code for a sequence of input values.</li>
<li><strong>static int	hashCode(Object o)</strong><br />
Returns the hash code of a non-null argument and 0 for a null argument.</li>
<li><strong>static &lt;T&gt; T	requireNonNull(T obj)</strong><br />
Checks that the specified object reference is not null.</li>
<li><strong>static &lt;T&gt; T	requireNonNull(T obj, String message)</strong><br />
Checks that the specified object reference is not null and throws a customized NullPointerException if it is.</li>
<li><strong>static String	toString(Object o)</strong><br />
Returns the result of calling toString for a non-null argument and &#8220;null&#8221; for a null argument.</li>
<li><strong>static String	toString(Object o, String nullDefault)</strong><br />
Returns the result of calling toString on the first argument if the first argument is not null and returns the second argument otherwise.</li>
</ul>
<p>Hooray for small litle improvements :-) This class officialy get&#8217;s Duke&#8217;s thumbs up image:</p>
<p style="text-align: center;"><img class="aligncenter" title="Java-duke" src="http://www.blog.project13.pl/wp-content/uploads/2011/04/Java-duke.jpg" alt="" width="200" height="235" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1284/jdk7-java-lang-objects-forgotten-feature/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[review] Devmeeting &#8211; Javascript Game Development</title>
		<link>http://www.blog.project13.pl/index.php/fun/1181/review-devmeeting-javascript-game-development/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/1181/review-devmeeting-javascript-game-development/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 23:21:12 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[freedom]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[clientside]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[meeting]]></category>
		<category><![CDATA[node.js]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[serverside]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1181</guid>
		<description><![CDATA[Yesterday and today I&#8217;ve been hacking some JavaScript during a free training organized by http://releasingforce.com/ although they&#8217;re not really braging that it&#8217;s them who do these meetings, more precisely: http://www.devmeetings.pl/ :-) As I&#8217;m coding quite a lot GWT and JS has also become quite powerfull in the last years I enlisted the training to learn [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday and today I&#8217;ve been hacking some JavaScript during a free training organized by <a href="http://releasingforce.com/" onclick="urchinTracker('/outgoing/releasingforce.com/?referer=');">http://releasingforce.com/</a> although they&#8217;re not really braging that it&#8217;s them who do these meetings, more precisely: <a href="http://www.devmeetings.pl/" onclick="urchinTracker('/outgoing/www.devmeetings.pl/?referer=');">http://www.<strong>devmeetings</strong>.pl/</a> :-)</p>
<p>As I&#8217;m coding quite a lot GWT and JS has also become quite powerfull in the last years I enlisted the training to learn more about JS optimalization and add some more tricks to my toolbox. Also some real life use scenarios would be very welcome. Turns out Tanadu (a polish &#8220;heroes-like&#8221; browser game) was implemented 100% in plain JS. Which is quite shocking and as we later agreed on developing such code can really be a pain in the neck. &#8220;Use GWT&#8221; would be my anwser to such an use case I guess &#8211; you wouldn&#8217;t loose the refactoring tooling Java gives you and could still fallback to JSNI if really needed. <strong>Did the &#8220;training&#8221; meet my expectations? Yup. Want more details? Read on&#8230; :-)</strong></p>
<p>It was really fun and I&#8217;ve even (and unexpectedly) met a friend of mine with whom (and one other developer) we&#8217;ve paired up and were coding a JS Mortal Kombat in JavaScript for those two days. We&#8217;ve learnt how to use CSS3 *-animation, *- transition and other cool new features (well, most of them &#8220;webkit only&#8221; but very cool nevertheless). Then we&#8217;ve coded a little and went on to dinner ate Jeff&#8217;s where I&#8217;ve lead the group to :-) Sadly dinner took a little too much time and we had less time to code than Poznań during their meeting a few weeks ago.</p>
<p>By the way&#8230; MVC in JavaScript is quite weird (<em>hey, most of the teams ended up with GodObjects anyways! ;-)</em>), as is any acting &#8220;hey, let&#8217;s just say we can have classess and inherit them blabla&#8230;&#8221;. We&#8217;ve seen quite a few examples on how to <strong>emulate OOP</strong> <strong>in JavaScript</strong> which was both: really weird and interesting at the same time. In the end, the thought &#8220;if you have no type system, in the end you develop your own&#8221; seems really true here. I believe this was said by someone from twitter about their Ruby code, which had a hell lot of assertions in it just to be sure &#8220;abc is really of type AbcType&#8221;. That&#8217;s why I&#8217;m more for Scalas apparoach than Groovy&#8217;s or Javascript/Ruby/Php, but I&#8217;m not that advanced in Scala yet to judge it as &#8220;super perfect&#8221;&#8230; ;-)</p>
<div id="attachment_1188" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.blog.project13.pl/wp-content/uploads/2011/02/mk1.png"><img class="size-medium wp-image-1188" title="mk1" src="http://www.blog.project13.pl/wp-content/uploads/2011/02/mk1-300x167.png" alt="" width="300" height="167" /></a><p class="wp-caption-text">MK in Javascript using Node.js</p></div>
<p>On the next day we implemented the serverside stuff, using <strong>node.js</strong> and <strong>socket.io</strong> for the clientside wich worked really well I have to addmit. Although I&#8217;m still wondering how I&#8217;d handle auth/security to be _really_ secure using such server instances (&#8220;nodes&#8221; ;-))&#8230; Finally our game had a very nice and developed state machine for all basic mortal kombat moves (including high/low punch etc, how much such state is blocking and which sprite to use for it, jumping etc.). As this state manipulation took most of our time, our server didn&#8217;t support an infinite number of players as some other implementations did but as a trade off they didn&#8217;t have any combo/move logic in their games :-) Of course the game was playable (well, &#8220;almost playable&#8221; &#8211; both players think they&#8217;re &#8220;on the left&#8221;, but we&#8217;d fix that very quick if needed&#8230; ;-)). A quick finishing talk touched some performance tweaks &#8211; quite some we should have used in mSejf etc &#8211; so I feel a little smarter than before :-) Sadly we didn&#8217;t talk too much about TDD using JavaScript which may be really a good idea (ugh this loose typing can make you mad sometimes&#8230; ;-)).</p>
<div id="attachment_1182" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.blog.project13.pl/wp-content/uploads/2011/02/mk2.png"><img class="size-medium wp-image-1182" title="mk2" src="http://www.blog.project13.pl/wp-content/uploads/2011/02/mk2-300x169.png" alt="mortal kombat" width="300" height="169" /></a><p class="wp-caption-text">Our mortal kombat game ;-)</p></div>
<p><strong>What could be definitely improved</strong> is the internet connection (well, &#8220;organization&#8221; as a whole I guess) as we had quite a lot problems with it (choose a hotel which is no noob in terms of IT meetings :-)) and the lead&#8217;s knowlage about git. Since it&#8217;s quite an deep tool, and we&#8217;re not here to focus on it but on JavaScript some quick info about how to use it and more developers who aren&#8217;t using it the first time in their lifes would have been really helpful. But fear not, I&#8217;ve helped out all the teams with learning git and all merges, push/pull flows and other weird problems :-) So it became quite an hybrid training where some of the participants learnt quite a lot about git :-) Some may actually like it in spite of the difficulties we encountered in our very chaotic flow during our hack sessions&#8230; :-) On the other hand, any way of introducing git to new people is a good thing, but I fear some may expierience some discomfort/distrust to a tool they&#8217;ve just &#8220;learnt&#8221; on a &#8220;fly by basis&#8221;, from&#8230; well, me &#8211; another participant. ;-)</p>
<p>From my perspective it was a great and fun meeting and I&#8217;d like to attend more such meetings, sharing the same  formula, or slightly improved. What I loved was of course the hacking and fun of working in a team + teaching people git&#8230; :-) If you&#8217;re hungry for some team coding you may want to checkout one of the upcomming meetings or wait for <strong>SCKRK</strong>s + <strong>PolishJUG</strong>s &#8220;<strong>Code Retreat</strong>&#8221; that we&#8217;ll be announcing really soon&#8230; :-)</p>
<p>PS: I&#8217;ve pushed our game implementation (less than 8h of real coding (rest of the time was talking/presentations/eating etc ;-)) to github, here: <a href="https://github.com/ktoso/mk-javascript" target="_blank" onclick="urchinTracker('/outgoing/github.com/ktoso/mk-javascript?referer=');">https://github.com/ktoso/<strong>mk-javascript</strong></a> so you may want to take a look. Event out of pure curiosity :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/1181/review-devmeeting-javascript-game-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[release] maven-git-commit-id-plugin</title>
		<link>http://www.blog.project13.pl/index.php/fun/1174/release-maven-git-commit-id-plugin/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/1174/release-maven-git-commit-id-plugin/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 15:25:18 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[freedom]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[#maven]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1174</guid>
		<description><![CDATA[Yup, today I&#8217;m releasing yet another piece of cool free software! It solves a problem we&#8217;ve had at our company, the tester tometimes tested stuff that wasn&#8217;t deployed yet, and the developers thought it was deployed and this caused some weird situations sometimes. Using the plugin I&#8217;ve written, we&#8217;re able to expose &#8220;which version is [...]]]></description>
			<content:encoded><![CDATA[<p>Yup, today I&#8217;m releasing yet another piece of cool free software! It solves a problem we&#8217;ve had at our company, the tester tometimes tested stuff that wasn&#8217;t deployed yet, and the developers thought it was deployed and this caused some weird situations sometimes. Using the plugin I&#8217;ve written, we&#8217;re able to expose &#8220;which version is this?&#8221; using repository information from<strong> git </strong>in our webapps. Yes there are maven plugins that do this, but none of them supported git &#8211; so I wrote my own and hope you guys will find it as useful as we do!</p>
<p><strong>UPDATE</strong><br />
The plugin is now available from <strong>Sonatype Nexus</strong>!</p>
<pre>
    <repository>
        <id>sonatype-releases</id>
        <name>Sonatype Releases</name>
        <url>https://oss.sonatype.org/content/repositories/releases/</url>
    </repository>
</pre>
<p><strong>END OF UPDATE</strong></p>
<p>Now I&#8217;ll be a bit lazy and just paste the README I&#8217;ve prepared for <strong><a href="https://github.com/ktoso/maven-git-commit-id-plugin/" target="_blank" onclick="urchinTracker('/outgoing/github.com/ktoso/maven-git-commit-id-plugin/?referer=');">maven-git-commit-id-plugin on github</a></strong>.</p>
<div id="readme">
<div>
<h2>Maven plugin: git-commit-id-plugin</h2>
<p><strong>git-commit-id-plugin</strong> is a plugin quite similar to <a href="https://fisheye.codehaus.org/browse/mojo/tags/buildnumber-maven-plugin-1.0-beta-4" target="_blank" onclick="urchinTracker('/outgoing/fisheye.codehaus.org/browse/mojo/tags/buildnumber-maven-plugin-1.0-beta-4?referer=');">build-number maven plugin</a> for example but as buildnumber only supports svn (which is very sad) and  cvs (which is even more sad, and makes bunnies cry) I had to quickly  develop an git version of such a plugin. For those who don&#8217;t know the  previous plugins, let me explain what this plugin does:</p>
<h3>Sample scenario why this plugin is useful</h3>
<p>If you develop your maven project inside an git repository (which you  hopefully already are docing) you may want to know exactly what changeset is currently deployed online. Why is this useful? Well,  the tester won&#8217;t come to you screaming &#8220;heeey that bug ain&#8217;t fixed&#8221; of  course you&#8217;d reply &#8220;but I fixed it this morning!&#8221; and after some  searching you notice &#8220;oh&#8230; it&#8217;ll be online after the next deployment,  sorry tester&#8230; :-(&#8220;.</p>
<p>This scenario keeps repeating sometimes, thus you can state which  commit fixes/closes the bug, note this in JIRA etc and then the tester  will know if it&#8217;s already online (by the commit date for example).</p>
<h2>Usage</h2>
<h3>Getting the plugin</h3>
<p>I&#8217;ll be trying to get this plugin out to sonatype for others to use if more simply, for now it&#8217;s quickest to just:</p>
<pre><code>  git clone git://github.com/ktoso/maven-git-commit-id-plugin.git maven-git-commit-id-plugin
  cd maven-git-commit-id-plugin
  mvn install
</code></pre>
<p>and you&#8217;re ready to use it ;-) I&#8217;m also thinking about making this  github repo a maven repository, which would make the above step not  needed &#8211; but first let&#8217;s wait if sonatype let me in with this project,  k? ;-)</p>
<h3>Using the plugin</h3>
<p>It&#8217;s really simple to setup this plugin, here&#8217;s a sample pom that you may base your <strong>pom.xml</strong> on:</p>
<pre><code>   &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
       &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

       &lt;groupId&gt;pl.project13.maven&lt;/groupId&gt;
       &lt;artifactId&gt;my-git-plugin-sample-app&lt;/artifactId&gt;
       &lt;packaging&gt;war&lt;/packaging&gt;
       &lt;version&gt;0.1&lt;/version&gt;
       &lt;name&gt;my-git-plugin-sample-app&lt;/name&gt;
       &lt;url&gt;http://www.blog.project13.pl&lt;/url&gt;

       &lt;parent/&gt;

       &lt;dependencies /&gt;

       &lt;build&gt;
           &lt;!-- GIT COMMIT ID PLUGIN CONFIGURATION --&gt;
           &lt;resources&gt;
               &lt;resource&gt;
                   &lt;directory&gt;src/main/resources&lt;/directory&gt;
                   &lt;filtering&gt;true&lt;/filtering&gt;
                   &lt;includes&gt;
                       &lt;include&gt;**/*.properties&lt;/include&gt;
                       &lt;include&gt;**/*.xml&lt;/include&gt;
                   &lt;/includes&gt;
               &lt;/resource&gt;
           &lt;/resources&gt;

           &lt;plugins&gt;
               &lt;plugin&gt;
                   &lt;groupId&gt;pl.project13.maven&lt;/groupId&gt;
                   &lt;artifactId&gt;git-commit-id-plugin&lt;/artifactId&gt;
                   &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
                   &lt;executions&gt;
                       &lt;execution&gt;
                           &lt;goals&gt;
                               &lt;goal&gt;revision&lt;/goal&gt;
                           &lt;/goals&gt;
                       &lt;/execution&gt;
                   &lt;/executions&gt;
                   &lt;configuration&gt;
                       &lt;prefix&gt;git&lt;/prefix&gt; &lt;!-- that's the default value --&gt;
                       &lt;dateFormat&gt;dd.MM.yyyy '@' HH:mm:ss z&lt;/dateFormat&gt; &lt;!-- that's the default value --&gt;
                       &lt;verbose&gt;true&lt;/verbose&gt; &lt;!-- false is default for this --&gt;
                       &lt;dotGitDirectory&gt;${project.basedir}/../.git&lt;/dotGitDirectory&gt; &lt;!-- required, you have to specify this path --&gt;
                   &lt;/configuration&gt;
               &lt;/plugin&gt;
               &lt;!-- END OF GIT COMMIT ID PLUGIN CONFIGURATION --&gt;

               &lt;!-- other plugins --&gt;
           &lt;/plugins&gt;
       &lt;/build&gt;
   &lt;/project&gt;
</code></pre>
<p>Based on the above part of a working POM you should be able to figure out the rest, I mean you are a maven user after all&#8230; ;-) Note that the resources filtering is important for this plugin to work, don&#8217;t omit it!</p>
<p>Now you just have to include such a properties file in your project under <code>/src/main/resources</code> (and call it <strong>git.properties</strong> for example) and maven will put the appropriate properties in the placeholders:</p>
<pre><code> git.branch=${git.branch}

 git.build.user.name=${git.build.user.name}
 git.build.user.email=${git.build.user.email}
 git.build.time=${git.build.time}

 git.commit.id=${git.commit.id}
 git.commit.user.name=${git.commit.user.name}
 git.commit.user.email=${git.commit.user.email}
 git.commit.message.full=${git.commit.message.full}
 git.commit.message.short=${git.commit.message.short}
 git.commit.time=${git.commit.time}
</code></pre>
<p>The <code>git</code> prefix may be configured in the plugin declaration above.</p>
<h3>Maven resource filtering + Spring = GitRepositoryState Bean</h3>
<p>You&#8217;ll most probably want to wire these plugins somehow to get easy  access to them during runtime. We&#8217;ll use spring as an example of doing  this. Start out with with adding the above steps to your project, next paste  this <strong>git-bean.xml</strong> into the <code>/src/main/resources/</code> directory (or any other, just adjust the paths later on):</p>
<pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;

    &lt;bean name="gitRepositoryInformation"&gt;
        &lt;property name="branch" value="${git.branch}"/&gt;
        &lt;property name="commitId" value="${git.commit.id}"/&gt;
        &lt;property name="commitTime" value="${git.commit.time}"/&gt;
        &lt;property name="buildUserName" value="${git.build.user.name}"/&gt;
        &lt;property name="buildUserEmail" value="${git.build.user.email}"/&gt;
        &lt;property name="commitMessageFull" value="${git.commit.message.full}"/&gt;
        &lt;property name="commitMessageShort" value="${git.commit.message.short}"/&gt;
        &lt;property name="commitUserName" value="${git.commit.user.name}"/&gt;
        &lt;property name="commitUserEmail" value="${git.commit.user.email}"/&gt;
    &lt;/bean&gt;

&lt;/beans&gt;
</code></pre>
<p>And here&#8217;s the source of the bean we&#8217;re binding here:</p>
<pre><code>package pl.project13.maven.example.git;

import org.codehaus.jackson.annotate.JsonWriteNullProperties;

/**
 * A spring controlled bean that will be injected
 * with properties about the repository state at build time.
 * This information is supplied by my plugin - &lt;b&gt;pl.project13.maven.git-commit-id-plugin&lt;/b&gt;
 *
 * @author Konrad Malawski
 */
@JsonWriteNullProperties(true)
public class GitRepositoryState {
  String branch;                  // =${git.branch}
  String commitId;                // =${git.commit.id}
  String buildUserName;           // =${git.build.user.name}
  String buildUserEmail;          // =${git.build.user.email}
  String buildTime;               // =${git.build.time}
  String commitUserName;          // =${git.commit.user.name}
  String commitUserEmail;         // =${git.commit.user.email}
  String commitMessageFull;       // =${git.commit.message.full}
  String commitMessageShort;      // =${git.commit.message.short}
  String commitTime;              // =${git.commit.time}

  public GitRepositoryState() {
  }

  /* Generate setters and getters here */
}
</code></pre>
<p>The source for it is also on the repo of this plugin. Of course, <em>feel free to drop out the jackson annotation</em> if you won&#8217;t be using it.</p>
<p>The last configuration related thing we need to do is to load up this bean in your appContext, so open up your <strong>applicationContext.xml</strong> or whatever you call it in your project and add these lines in the  section:</p>
<pre><code>&lt;context:property-placeholder location="classpath:*.properties" /&gt;
&lt;import resource="classpath:/git-bean.xml"/&gt;
</code></pre>
<p>Of course, you may adjust the paths and file locations as you please, no problems here&#8230; :-) <em>Now you&#8217;re ready to use your GitRepositoryState Bean!</em> Let&#8217;s create an sample <strong>Spring MVC Controller</strong> to test it out:</p>
<pre><code> @Controller
 @RequestMapping("/git")
 public class GitService extends BaseWebService {

     @Autowired
     GitRepositoryState gitRepoState;

     @RequestMapping("/status")
     public ModelAndView checkGitRevision() throws WebServiceAuthenticationException {
       ServerResponse&lt;GitRepositoryState&gt; response = new ServerResponse&lt;GitRepositoryState&gt;(gitRepoState);
       return createMAV(response);
     }
 }
</code></pre>
<p>Don&#8217;t mind the createMAV and responses stuff, it&#8217;s just example code.  And feel free to use constructor injection, it&#8217;s actually a better idea  ;-)</p>
<p>In the end <em>this is what this service would return</em>:</p>
<pre><code> {
     "branch" : "testing-maven-git-plugin",
     "commitTime" : "06.01.1970 @ 16:16:26 CET",
     "commitId" : "787e39f61f99110e74deed68ab9093088d64b969",
     "commitUserName" : "Konrad Malawski",
     "commitUserEmail" : "konrad.malawski@java.pl",
     "commitMessageFull" : "releasing my fun plugin :-)
                            + fixed some typos
                            + cleaned up directory structure
                            + added license etc",
     "commitMessageShort" : "releasing my fun plugin :-)",
     "buildTime" : "06.01.1970 @ 16:17:53 CET",
     "buildUserName" : "Konrad Malawski",
     "buildUserEmail" : "konrad.malawski@java.pl"
 }
</code></pre>
<p>That&#8217;s all folks! <strong>Happy hacking!</strong></p>
<h2>Configuration details</h2>
<p>Just a short recap of the available parameters&#8230;</p>
<p>Required parameters:</p>
<ul>
<li> <strong>dotGitDirectory</strong> &#8211; (required) the location of your .git  folder. Try to use ${project.basedir} as root for this, and navigate  using ../ to higher up folder to easily use this plugin in multi module  enviroments etc. An example would be: <code>${project.basedir}/../.git</code></li>
</ul>
<p>Optional parameters:</p>
<ul>
<li> <strong>prefix</strong> &#8211; (default: git) is the &#8220;namespace&#8221; for all exposed properties</li>
<li> <strong>dateFormat</strong> &#8211; (default: dd.MM.yyyy &#8216;@&#8217; HH:mm:ss z) is a  normal SimpleDateFormat String and will be used to represent  git.build.time and git.commit.time</li>
<li> <strong>verbose</strong> &#8211; (default: false) if true the plugin will print a summary of all collected properties when it&#8217;s done</li>
</ul>
<h2>License</h2>
<p>I&#8217;m releasing this plugin under the <strong>GNU Lesser General Public License 3.0</strong>. You&#8217;re free to use it as you wish, the license text is attached in the LICENSE file. You may contact me if you want this to be released on a different license, just send me an email konrad.malawski@java.pl :-)</p>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/1174/release-maven-git-commit-id-plugin/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>[PL] Trzeźwe spojrzenie na: CoFoJa (Design By Contract form Google)</title>
		<link>http://www.blog.project13.pl/index.php/coding/1168/pl-trzezwe-spojrzenie-na-cofoja-design-by-contract-form-google/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1168/pl-trzezwe-spojrzenie-na-cofoja-design-by-contract-form-google/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 22:18:51 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[codnig]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[jee]]></category>
		<category><![CDATA[libs]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1168</guid>
		<description><![CDATA[Design By Contract Dzisiejszy wpis będzie o znanej i generalnie dość znanej i mającej wiele zalet metodyce Design By Contract. Temat &#8220;wypłynął&#8221; ponownie dla wielu javovców tym razem dzięki wydaniu biblioteki  CoFoJa (o którym właśnie będzie ten post) przez dwóch pracowników Google przy ścisłej współpracy z autorem pierwowzoru tego projektu. Dlaczego jednak nietypowy tytuł posta [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Design By Contract</strong></p>
<p>Dzisiejszy wpis będzie o znanej i generalnie dość znanej i mającej wiele zalet metodyce <strong>Design By Contract</strong>. Temat &#8220;wypłynął&#8221; ponownie dla wielu javovców tym razem dzięki wydaniu biblioteki  <strong>CoFoJa</strong> (o którym właśnie będzie ten post) przez dwóch pracowników <strong>Google</strong> przy ścisłej współpracy z <a href="http://www.linkedin.com/pub/dir/Johannes/Rieken" onclick="urchinTracker('/outgoing/www.linkedin.com/pub/dir/Johannes/Rieken?referer=');">autorem pierwowzoru tego projektu</a>. Dlaczego jednak nietypowy tytuł posta &#8211; &#8220;trzeźwe spojrzenie&#8221;? Ponieważ w odróżnieniu od niektórych nie oceniam technologii na podstawie &#8220;wow factor&#8221; a realnej używalności. Gotowi mini review tego toola? No to lecimy&#8230; :-)</p>
<p><strong>Contracts For Java</strong></p>
<p>Na początek warto rzucić okiem na <a href="http://google-opensource.blogspot.com/2011/02/contracts-for-java.html" onclick="urchinTracker('/outgoing/google-opensource.blogspot.com/2011/02/contracts-for-java.html?referer=');">googlowy blog</a> gdzie ogłoszono premierę tego narzędzia oraz oczywiście samą <a href="http://code.google.com/p/cofoja/" onclick="urchinTracker('/outgoing/code.google.com/p/cofoja/?referer=');">stronę domową projektu </a><acronym title="Contracts For Java"><a href="http://code.google.com/p/cofoja/" onclick="urchinTracker('/outgoing/code.google.com/p/cofoja/?referer=');"><strong>CoFoJa</strong></a></acronym>. Oczywiście na samym przekierowaniu nie poprzestanę więc zaczniemy od mini definicji od strony użytkownika metodyki design by contract. Jak możemy przeczytać chociażby <strong>w pragmatycznym programiście </strong>metodyka ta ma dość spory potencjał i ciekawe możliwości &#8211; generalnie chodzi o określanie &#8220;kontraktów&#8221; na naszych metodach. Zakładanie kontraktów ma pewną wyższość nad pisanie testów jednostkowych ponieważ możemy kontrakt założyć na interfejsie a wszystkie implementujące go klasy będą z nim związane</p>
<p>Kontrakt może na przykład zapewnić:</p>
<ul>
<li>wykonanie danej metody tylko i wyłącznie wtedy gdy przekazane jej argumenty spełniają pewne kryteria (w kontekście CoFoJa byłoby to <strong>@Requires</strong>)</li>
<li>zagwarantowanie spełnienia pewnych warunków po opuszczeniu metody (w kontekście CoFoJa byłoby to <strong>@Ensures</strong> ewentualnie <strong>@ThrowEnsures</strong> jeśli chcemy mieć kontrakt na rzucenie wyjątku)</li>
<li>zagwarantowanie ogólnych warunków na konkretnej np. klasie (<strong>@Invariant</strong>)</li>
</ul>
<p>Ok, skoro znamy podstawowe building blocks (zaczerpnięte skądżeby inąd niż z <a href="http://en.wikipedia.org/wiki/Eiffel_%28programming_language%29" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Eiffel_28programming_language_29?referer=');">Eiffla</a> oczywiście) zobaczmy jakieś przykładowe poadnotowane nimi API:</p>
<p><script src="https://gist.github.com/817547.js?file=gistfile1.java"></script> <strong>A teraz praktycznie</strong></p>
<p>Najlepiej jest chwilkę się w niego wgryźć, powinien być stosunkowo zrozumiały. Nie chcemy nigdy mieć ujemnej ilości bananów &#8211; spowodowałoby to złamanie kontraktu. Podobne przykładowe kontrakty wejściowe/wyjściowe widzimy na metodach oraz jeden mały tip: metoda <strong>old()</strong> jest dostarczana automagicznie i oznacza &#8220;starą wartość tego wywołania&#8221; czyli przed wykonaniem metody na którą zakładamy ten kontrakt. Poza tym mamy tutaj do czynienia w sumie z zwyczajnym kodem Java który niestety jest wewnątrz stringa&#8230; Świadomy programista zapewne już ma zapaloną lampkę alarmową, że to będzie nie refaktorowalne i bez sensu&#8230; Na pocieszenie dodam iż kod Java zawarty w tych stringach faktycznie jest &#8220;kompilowany&#8221;i jak coś popsujemy składniowo, kontrakty się nie skompilują i dostaniemy normalne informacje jakby to się nam nie kompilował normalny &#8220;nasz kod&#8221;. Co do wygody refaktoringu&#8230; Na szczęscie korzystam z porządnego IDE (<strong>IntelliJ IDEA</strong>) i takie &#8220;problemy&#8221; mnie nie dotyczą ;-). Wybrałem inject języka <strong>Groovy</strong> do tych stringów aby parser składniowy nie dziwił się pojawienia się metody old() &#8220;z nikąd&#8221;:<a href="http://xlab.pl/wp-content/uploads/2011/02/intellij.png" onclick="urchinTracker('/outgoing/xlab.pl/wp-content/uploads/2011/02/intellij.png?referer=');"><img class="aligncenter size-full wp-image-1752" title="intellij" src="http://xlab.pl/wp-content/uploads/2011/02/intellij.png" alt="" width="600" /></a> <strong>Problem</strong> z &#8220;nie podpowiadaniem metod&#8221; jak i &#8220;nie da się refaktorować&#8221; jak widać został od razu <strong>wyeliminowany</strong> :-) <em><strong>Hooray for JetBrains.</strong></em> Poszukajmy jednak kolejnego problemu z tym API&#8230; Tak jest, <strong>@ThrowEnsures </strong>jest trochę brzydki a nie koniecznie musi być cały w stringu. Jak działa obecnie? Przekazujemy mu listę stringów gdzie parami występują &#8220;wyjątek&#8221; + &#8220;warunek kiedy ma zostać rzucony&#8221;. Chętniej zobaczył bym to w formie podobnej do poniższej (tylko szybki szkic taki), a wy?</p>
<p><script src="https://gist.github.com/817695.js?file=gistfile1.java"></script></p>
<p>Ok czas na uruchomienie kodu z &#8220;włączonymi kontraktami&#8221;&#8230; I&#8230; niestety nie okazało się to takie trywialne na obecnym etapie projektu. Niestety trzeba sobie ręcznie poustawiać processowanie adnotacji (norma, tutaj się niewiele zmieni) jednak trochę problemów nastarcza mi obecnie widoczność klas/pól dla CoFoJa w intellij. Classpath (dla procesora) zdaje się być ustawiony poprawny oraz jego klasa jak i inne opcje też jednak nie dochodzi do poprawnego przeparsowania wszystkich reguł. No cóż, może jutro się uda &#8211; tymczasem odsyłam do <a href="http://fsteeg.com/2011/02/07/setting-up-contracts-for-java-in-eclipse/" onclick="urchinTracker('/outgoing/fsteeg.com/2011/02/07/setting-up-contracts-for-java-in-eclipse/?referer=');">poradnika dla użytkowników Eclipse</a> gdzie to członek społeczności sprawnie poradził sobie z tym problemem :-)</p>
<p><strong>Trzeźwe spojrzenie: &#8220;Czy obecnie warto?</strong>&#8221;</p>
<p>Pozostaje pytanie&#8230; Czy warto się zainteresować CoFoJa jak i samym DBC? Pytanie jest chyba równie ogólne jak &#8220;czy warto meta-programować?&#8221; także wprost odpowiedzi nie udzielę. Miejmy jednak na uwadze że jak na razie używanie CoFoJa nie jest zbyt wygodne a adnotacje można by jeszcze trochę poszlifować. Trzeba by jeszcze rzucić okiem jak stoimy z integracją tego z Maven &#8211; aby normalnie testując bądź klikając sobie po projekcie te kontrakty mogły się przydawać. Sama idea jest ciekawa i jakby integracja z narzędziami była wygodniejsza &#8211; a może od razu pluginy do IDE &#8211; można by się nad tym porządniej zastanawiać. <strong>Jak na razie projekcik odkładamy ten projekt spokojnie na półkę &#8220;worth watching&#8221; i liczymy na rychłe wydanie 2.0.</strong> :-)</p>
<p>PS: Jeżeli interesują Cię takie jak i inne ciekawe metodyki i sposoby tworzenia <strong>pięknego</strong>, czystego<strong> kodu, </strong>zapraszam serdecznie na co 2 tygodniowe spotkania <em><a href="http://sckrk.com" onclick="urchinTracker('/outgoing/sckrk.com?referer=');">SCKRK </a></em>gdzie obecnie dyskutujemy w formie &#8220;reading club&#8221; nad <strong>D</strong>omain <strong>D</strong>riven <strong>D</strong>esign :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1168/pl-trzezwe-spojrzenie-na-cofoja-design-by-contract-form-google/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>git-hacking: pre-commit hook and custom command</title>
		<link>http://www.blog.project13.pl/index.php/fun/1076/git-hacking-pre-commit-hook-and-custom-command/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/1076/git-hacking-pre-commit-hook-and-custom-command/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 02:07:39 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[freedom]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[terminal heroes]]></category>
		<category><![CDATA[#eclipse]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[intellij]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[SCM]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[xsolve]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1076</guid>
		<description><![CDATA[As my team is using a kinda weird source eclipse code formatter setup, that other IDEs can&#8217;t emulate in 100% I sometimes found myself committing in a file with only a few changed spaces. Of course, I could use &#8220;external-formatter&#8221; plugins etc but that&#8217;s no good. Running eclipse&#8217;s formatter each time I want to format [...]]]></description>
			<content:encoded><![CDATA[<p>As my team is using a kinda weird source eclipse code formatter setup, that other IDEs can&#8217;t emulate in 100% I sometimes found myself committing in a file with only a few changed spaces. Of course, I could use &#8220;external-formatter&#8221; plugins etc but that&#8217;s no good. Running eclipse&#8217;s formatter each time I want to format my source (_very_ often) proved to be too slow and really getting on my nerves.</p>
<p>So&#8230; Since I&#8217;ve started using <strong>git</strong>-svn at work, I do have an possibility to make things better now! The answer lies in client-side-<strong>hooks</strong> and <strong>git aliases</strong> (&#8220;custom commands&#8221;). First let&#8217;s write this as an simple bash script, that we&#8217;ll locate in the <strong>.git/hooks/</strong> folder:<br />
<script src="https://gist.github.com/708972.js?file=gistfile1.sh"></script> It&#8217;s a fairly simple script, so I wont bore you explaining it in detail &#8211; if in doubt, feel free to ask. We only need to place this script as &#8220;<strong>.git/hooks/pre-commit</strong>&#8221; and make it executable and git will take care of the rest for us. Oh and in case you&#8217;re wondering where that <strong>org.eclipse.jdt.core.prefs</strong> came from. It&#8217;s created by eclipse into the .settings folder when you check some option to &#8220;use formatter per project&#8221; &#8211; that&#8217;s the only time I had to fire up and click around in eclipse to get it&#8217;s formatter running &#8220;headless&#8221;. Ok, let&#8217;s check if it works&#8230; <script src="https://gist.github.com/708982.js?file=gistfile1.java"></script><br />
<script src="https://gist.github.com/708976.js?file=gistfile1.sh"></script> <script src="https://gist.github.com/708981.js?file=gistfile1.java"></script><br />
Yup, you can agree or not with the formatting rules &#8211; but what matters is that the whole team decided on it and that we keep it consistent throughout the whole project. This hook will definitely help with this. :-)  Step two for me was changing this into a git command, so that I wouldn&#8217;t launch eclipse each time I just do some quick local commiting. The solution is to drop the hook idea (although it&#8217;s quite nice) and create an custom git command. We do this by doing an alias like that:</p>
<pre>git config --global alias.eclipse-formatter '!~/git-hook-eclipse-formatter'</pre>
<p>The <strong>!command </strong>alias<strong> </strong>support is with us in git since 1.5.0 and it enables us to launch any program/script as an git command. Great, just what I wanted! Let&#8217;s now see what this command really did:</p>
<p><script src="https://gist.github.com/708977.js?file=gistfile1.sh"></script><br />
As you can see, adding an alias is as simple as adding it to your<strong> ~/.gitconfig</strong> or, if you want to setup the alias &#8220;per project&#8221;, to <strong>.git/config</strong> &#8211; pretty cool, ay? Also, this command will be included in bash-autocompletition suggestions! :-)</p>
<p>That&#8217;s it for today&#8230; <em>happy hacking!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/1076/git-hacking-pre-commit-hook-and-custom-command/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[review] JavaCamp 5</title>
		<link>http://www.blog.project13.pl/index.php/project13/1089/review-javacamp-5/</link>
		<comments>http://www.blog.project13.pl/index.php/project13/1089/review-javacamp-5/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 02:11:51 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[polish]]></category>
		<category><![CDATA[Project13]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[JavaCamp]]></category>
		<category><![CDATA[JUG]]></category>
		<category><![CDATA[lombok]]></category>
		<category><![CDATA[meeting]]></category>
		<category><![CDATA[polishjug]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1089</guid>
		<description><![CDATA[Yes, it&#8217;s time for another JavaCamp mini-review&#8230; :-) Without further intros, let&#8217;s get down do the presentations: Łukasz Lenart &#8211; “Nie samym kodem programista żyje” Łukasz&#8217;s presentation was not a technical one this time. He talked about how to be/become an effective programmer. A nice tip he noted was to carry a notebook and note [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img title="pjug3" src="http://www.blog.project13.pl/wp-content/uploads/2010/11/pjug3.jpg" alt="" width="126" height="157" /><br />
Yes, it&#8217;s time for another JavaCamp mini-review&#8230; :-) Without further intros, let&#8217;s get down do the presentations:</p>
<h2><a href="http://www.lenart.org.pl/" onclick="urchinTracker('/outgoing/www.lenart.org.pl/?referer=');"><strong>Łukasz Lenart</strong></a> &#8211; “Nie samym kodem programista żyje”</h2>
<p>Łukasz&#8217;s presentation was not a technical one this time. He talked about how to be/become an effective programmer. A nice tip he noted was to carry a notebook and note your ideas in it &#8211; i sometimes try to but did find myself forgetting some &#8220;amazing idea&#8221; due to the lack of discipline in carring such notebook (yeah, an paper-notebook&#8230; :-)) so it&#8217;s definitely something worth reminding. He also talked a little about Kaizen, <a href="http://zenhabits.net/zen-to-done-the-simple-productivity-e-book/" onclick="urchinTracker('/outgoing/zenhabits.net/zen-to-done-the-simple-productivity-e-book/?referer=');"><strong>ZenToDone</strong></a> and the <a href="http://www.pomodorotechnique.com/" onclick="urchinTracker('/outgoing/www.pomodorotechnique.com/?referer=');"><strong>Pomodoro</strong> Technique</a> which all kinda share the same idea but explain it a little bit differently. I also was quite happy to find out that I&#8217;m not the only one that gets slown down in development when actually being in the company &#8211; with lots of stuff happening around me. Admit it &#8211; we all work more productive when there&#8217;s noone bugging us ;-)</p>
<p>The most notable tips where the &#8220;<strong>alone-zone</strong>&#8221; (as explained in <a href="http://37signals.com/rework/" onclick="urchinTracker('/outgoing/37signals.com/rework/?referer=');">REWORK</a> (good book, I recommend it)) which is really great and I love it, but sometimes it&#8217;s hard to enforce &#8211; coding is usualy team work, ain&#8217;t it..? Using <strong>multiple desktops</strong> &#8211; and monitors at best, to seperate your work space from fun space. <strong>Cutting oneself off from the internet</strong> is, while extreme, very effective by the way. I noticed it quite a few times &#8211; there&#8217;s simply nothing distracting you &#8211; same goes for anything that might take your attention. By the way, I&#8217;m not really convinced about Pomodoro &#8211; what if you get into an v. nice flow and then the pomodoro snaps you out of it? I guess it may be more targeted at people working at bigger companies &#8211; not as myself in an small nice team and nowadays, mostly from home.</p>
<p>All in all he warmed up the audience perfectly and let&#8217;s hope some of theese tips help us become better programmers&#8230; :-)</p>
<ul>
<li>//TODO: watch on parleys.com</li>
<li>//TODO: download slides</li>
<li><a href="http://camp.java.pl/dl.php?f=jc5-1-nie-samym-kodem-pl-min.flv" onclick="urchinTracker('/outgoing/camp.java.pl/dl.php?f=jc5-1-nie-samym-kodem-pl-min.flv&amp;referer=');">download video</a></li>
</ul>
<h2><a onclick="alert('hey, youre already on my website... :-)')" href="#"><strong>Konrad Malawski</strong></a> &#8211;  “Git (tak. po prostu.)”</h2>
<p>The PJUG guys asked me to tell a little about git and I happily agreed to do it &#8211; thus, my first &#8220;public presentation&#8221;. Firstly I&#8217;d like to explain why the slides where so &#8220;weird&#8221;. It&#8217;s because I wanted them to be something like an &#8220;break&#8221;, and most of the session was live terminal typing. They were all hand drawn by me and my girlfriend, then scanned and recoloured in GIMP. Took a few evenings to prepare them, but I hope they where quite memorable, fun, and did point out the important aspects of what the next topic would be about &#8211; an 3 headed dragon as symbol for lots of HEADs in an git repo etc&#8230; ;-)</p>
<p><span id="click-git-slides-here">Click to show presentation</span></p>
<div id="git-slides-here" style="text-align: center;"><object id="__sse5689507" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=slides-101106175416-phpapp01&amp;stripped_title=slides-5689507&amp;userName=ktoso" /><param name="name" value="__sse5689507" /><param name="allowfullscreen" value="true" /><embed id="__sse5689507" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=slides-101106175416-phpapp01&amp;stripped_title=slides-5689507&amp;userName=ktoso" name="__sse5689507" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<p><script type="text/javascript">// < ![CDATA[
// < ![CDATA[
// < ![CDATA[
$(document).ready(function(){
   $("#git-slides-here").hide();
   $("#click-git-slides-here").click(function(){
      $("#git-slides-here").slideToggle();
   });
});
// ]]&gt;</script></p>
<p>I&#8217;ve been preparing the flow of all examples before but during the presentation I missed out a few steps and made a <a href="http://www.blog.project13.pl/index.php/fun/1069/gitjavacamp-fix-1-when-does-git-see-an-rename-explicitly/">some stupid mistakes</a> (see my previous git post on this blog ;-). Well, it wasn&#8217;t anything world breaking I guess and I&#8217;d really like to thank the audience for such great support. We strayed a little of the path I&#8217;ve prepared sometimes, but that&#8217;s ok as it was interesting to interact with the audience during an presentation &#8211; not just stand there and &#8220;praise git to zee heavnz&#8221; ;-) Such interaction is something I (personally) really like in presentations, even if they break a little due to this :-)</p>
<p>All in all, we managed to go through all of git&#8217;s basic features and in the end even mentioned <strong>rebase</strong> &#8211; which can be used to change the history of ones commits (there&#8217;s also the very useful <a href="http://book.git-scm.com/3_distributed_workflows.html" onclick="urchinTracker('/outgoing/book.git-scm.com/3_distributed_workflows.html?referer=');">git commit &#8211;amend</a>), <a href="http://sitaramc.github.com/concepts/detached-head.html" onclick="urchinTracker('/outgoing/sitaramc.github.com/concepts/detached-head.html?referer=');"><strong>detached-HEADs</strong></a> and <strong>git-svn</strong>, which I didn&#8217;t use before as I feared a little to make a mess in the company svn-repo (and in all &#8220;my&#8221; projects I&#8217;m using git, so I never felt the need to use git-svn). Some guys sucessfully used it and really recommended it, thus&#8230; here I am, doing git svn dcommits on an daily basis&#8230; :-) I&#8217;m glad to have also learned something from this presentation, not just &#8220;showed what I had to show&#8221; :-) Now just a few links to very good resources about git:</p>
<ul>
<li><a href="http://nvie.com/posts/a-successful-git-branching-model/" onclick="urchinTracker('/outgoing/nvie.com/posts/a-successful-git-branching-model/?referer=');">A Successful Git Branching Model</a></li>
<li><a href="http://excess.org/article/2008/07/ogre-git-tutorial/" onclick="urchinTracker('/outgoing/excess.org/article/2008/07/ogre-git-tutorial/?referer=');">Very good </a><a href="http://excess.org/article/2008/07/ogre-git-tutorial/" onclick="urchinTracker('/outgoing/excess.org/article/2008/07/ogre-git-tutorial/?referer=');">video tutorial on git</a></li>
<li><a href="https://git.wiki.kernel.org/index.php/GitFaq" onclick="urchinTracker('/outgoing/git.wiki.kernel.org/index.php/GitFaq?referer=');">https://git.wiki.kernel.org/index.php/GitFaq</a></li>
<li><a href="http://git-plumbing-preso.heroku.com/" onclick="urchinTracker('/outgoing/git-plumbing-preso.heroku.com/?referer=');">http://git-plumbing-preso.heroku.com</a> &#8211; internals</li>
<li><a href="https://github.com/" onclick="urchinTracker('/outgoing/github.com/?referer=');">https://github.com/</a> &#8211; free opensource project hosting</li>
<li>and of course: <a href="http://git-scm.com/documentation" onclick="urchinTracker('/outgoing/git-scm.com/documentation?referer=');">http://git-scm.com/documentation</a></li>
</ul>
<p>After the presentation I made an small sms-contest where you could win an PJUG tshirt for guessing what github&#8217;s mascot is called like. I hope it was an nice positive accent to finish the session. Next up was the pizza and then 2 more Łukasz&#8217;s&#8230; :-)</p>
<ul>
<li>//TODO: watch on parleys.com</li>
<li><a href="http://camp.java.pl/dl.php?f=jc5-2-git-pl-slides.pdf" onclick="urchinTracker('/outgoing/camp.java.pl/dl.php?f=jc5-2-git-pl-slides.pdf&amp;referer=');">download slides</a></li>
<li><a href="http://camp.java.pl/dl.php?f=jc5-2-git-pl-min.flv" onclick="urchinTracker('/outgoing/camp.java.pl/dl.php?f=jc5-2-git-pl-min.flv&amp;referer=');">download video</a></li>
</ul>
<h2><strong>Łukasz Żmudziński</strong> &#8211; “Project Lombok &#8211; Cause We Hate Boilerplate!”</h2>
<p>Lombok, if you didn&#8217;t see it before is this -&gt; <a href="http://projectlombok.org/" onclick="urchinTracker('/outgoing/projectlombok.org/?referer=');">http://projectlombok.org/</a> It&#8217;s a &#8220;total hack&#8221;, as the author describes it (and he&#8217;s right ;-)) but it allows some funny compile time hacks while writing Plain Old Java Code. Łukasz showed us around all the annotations which Lombok provides and how they work, what code exactly would be generated by them etc. The most &#8220;let&#8217;s you write less code&#8221; annotation would be @Data, which at compile time would cause Lombok (&#8230;here comes the important part:) to write the <strong>source</strong> for all setters, getters and toString hashcodes etc &#8211; so javac in the end, thinks it&#8217;s just compiling plain odl java&#8230; Here&#8217;s a link on how it works: <a href="http://projectlombok.org/features/Data.html" onclick="urchinTracker('/outgoing/projectlombok.org/features/Data.html?referer=');">Data.html</a> The funny part about it is that it&#8217;s an compile time tool &#8211; much similar to <a href="http://www.springsource.org/roo" onclick="urchinTracker('/outgoing/www.springsource.org/roo?referer=');">Spring Roo</a> in that aspect if you ask me -  and what it actually modifies is the AST (AbstractSourceTree) that javac then uses to generate it&#8217;s bytecode&#8230; So no bytecode magic &#8211; just how I&#8217;d call it&#8230; source code injection during compile time? Yeah, weird stuff.</p>
<p>And if you ask me not really something I&#8217;d be using all over the place. Sure it&#8217;d spare me the writing of some getters and setters and some more tricks but in the end, it&#8217;s a problem for not supported IDEs. (How do you explain IDEA that this class really *will have* an setBla() method&#8230;?) While NetBeans and Eclipse do have plugins to enable them to unserstand lomboks annotations. It&#8217;s not really enough &#8211; what about static code analisis tools? They&#8217;d go nuts with code that calls methods which dont exist in the source etc :-) Nevertheless if was a fun topic and it definitely is an quite funny javac hack, but if I&#8217;d be desperate for such features&#8230; I&#8217;d go polyglot coding with groovy or scala etc&#8230; :-)</p>
<ul>
<li>//TODO: watch on parleys.com</li>
<li><a href="http://camp.java.pl/dl.php?f=jc5-3-lombok-pl-slides.pdf" onclick="urchinTracker('/outgoing/camp.java.pl/dl.php?f=jc5-3-lombok-pl-slides.pdf&amp;referer=');">download <strong>slides</strong></a></li>
<li><a href="http://camp.java.pl/dl.php?f=jc5-3-lombok-pl-min.flv" onclick="urchinTracker('/outgoing/camp.java.pl/dl.php?f=jc5-3-lombok-pl-min.flv&amp;referer=');">download <strong>video</strong></a></li>
</ul>
<h2><a href="http://czerpak.eu/blog/page/2/" onclick="urchinTracker('/outgoing/czerpak.eu/blog/page/2/?referer=');"><strong>Łukasz Czerpak</strong></a> &#8211; “Testy jednostkowe i integracyjne w przykładach”</h2>
<p>By now you probably noticed it&#8230; There where almost only Łukasz&#8217;s presenting on this Camp&#8230;! :-) Łukasz Czerpak&#8217;s topic was about, generally speaking, TDD. He focused (as the title suggests, if you can read polish ;-)) on unit and integration tests. The border between them is sometimes a little blury, but the definitions he have were nice and clear &#8211; 1 class = unit, long setup involved = integration. It&#8217;s as easy as that, yet sometimes during discussions with other coders these sometimes get confised. Next he went on to some examples of how TDD is useful and finally to a lot of code examples. As he&#8217;s using EJBs at his day job, this part was mostly covered &#8211; and very interesting (for me, who&#8217;d usually just use spring and be done with it).</p>
<p>The mocking framework he used in his examples was of course our Polish Mockito&#8230; :-) It&#8217;s really great and lot&#8217;s of fun to work with, unlike some other mocking frameworks out there. Although easymock would take the 2nd place if I&#8217;d were to make an ranking. I&#8217;ve also seen a little JMock but it doesn&#8217;t &#8220;feel good&#8221; &#8211; but if youre interested in pure &#8220;what X can do&#8221;, they all do offer the same things, so why bother with some cluttery syntax? :-)</p>
<p>Next, Łukasz showcased using glassfish as an embeded container which definitely is on my &#8220;good to know&#8221; list and then continued on to an very awesome JBoss library: <strong>Arquillian </strong>[<a href="http://jboss.org/arquillian" onclick="urchinTracker('/outgoing/jboss.org/arquillian?referer=');">arquillian homepage</a>] (see? It&#8217;s so cool I even had to mark it bold ;-)) It&#8217;s an lib which enables you to deploy (yes, &#8220;deploy&#8221; &#8211; perfect word choice) EJBs or even whole archives to an testing enviroment &#8211; which would then be started using an embeded container, although as seen on their homepage, they also support remote containers&#8230; interesting! Here&#8217;s another nice usecase of it: <a href="http://ocpsoft.com/seam/cdi-powered-unit-testing-using-arquillian/" onclick="urchinTracker('/outgoing/ocpsoft.com/seam/cdi-powered-unit-testing-using-arquillian/?referer=');">http://ocpsoft.com/seam/cdi-powered-unit-testing-using-arquillian/</a> The presentation was really well prepared and most probably the high</p>
<ul>
<li>//TODO: watch on <strong>parleys.com</strong></li>
<li>//TODO: download <strong>slides</strong></li>
<li><a href="http://camp.java.pl/dl.php?f=jc5-4-tdd-pl-min.flv" onclick="urchinTracker('/outgoing/camp.java.pl/dl.php?f=jc5-4-tdd-pl-min.flv&amp;referer=');">download <strong>video</strong></a></li>
</ul>
<h2>That&#8217;s all folks!</h2>
<p>We&#8217;ll be doing another JavaCamp in the near future (January perhaps&#8230;?). But for theese few weeks now we&#8217;ll be focusing on the upcomming GeeCON 2011 (Cracow) and kickstarting it&#8217;s call for papers <em>(yay, I&#8217;m it&#8217;s author ;p). </em> And if you&#8217;re interested in seeing all recordings on parleys.com and not just as videos &#8211; stay on your toes, because after Devoxx we&#8217;ll upload them there &#8211; I&#8217;ll update my blog then and we&#8217;ll write an quick news about it on java.pl In the mean time, you can go take a look at these and the previous (javacamp #4) recordings on <a href="http://camp.java.pl" onclick="urchinTracker('/outgoing/camp.java.pl?referer=');">camp.java.pl</a> &#8211; which I just quickly set up to allow you guys quick access to the movies&#8230;</p>
<p>Yup, that&#8217;s all I think&#8230; see you on <strong>GeeCON</strong> || JavaCamp <strong>#6</strong>! :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/project13/1089/review-javacamp-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>@RunWith JUnit4 with BOTH SpringJUnit4ClassRunner and Parameterized</title>
		<link>http://www.blog.project13.pl/index.php/coding/1077/runwith-junit4-with-both-springjunit4classrunner-and-parameterized/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1077/runwith-junit4-with-both-springjunit4classrunner-and-parameterized/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 00:05:39 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jee]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[junit4]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1077</guid>
		<description><![CDATA[Ok, now for a quick trick before I get into writing more about git and our last javacamp (movies are still being converted, sorry for the long wait). If you code in Java, you most probably use (you really should use) some dependecy injection mechanisms. They&#8217;re really great and take care about all the setup [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, now for a quick trick before I get into writing more about git and our last javacamp (movies are still being converted, sorry for the long wait).</p>
<p>If you code in Java, you most probably use (you really should use) some dependecy injection mechanisms. They&#8217;re really great and take care about all the setup that need&#8217;s to be done before you can move on to your coding. The same thigh applies to testing, you&#8217;d rather write:</p>
<div class="geshi no java">
<div class="head">//yay</div>
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Autowired</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; MyComponent component<span class="sy0">;</span></div>
</li>
</ol>
</div>
<p>Than use the new operator, or worse, perform some super weird setup to build this object. If you use spring, you&#8217;d write an test like this to make it support Spring&#8217;s DI:</p>
<div class="geshi no java">
<div class="head">//an JUnit test with spring DI</div>
<ol>
<li class="li1">
<div class="de1">@RunWith<span class="br0">&#40;</span>SpringJUnit4ClassRunner.<span class="kw2">class</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">@ContextConfiguration<span class="br0">&#40;</span>locations = <span class="br0">&#123;</span><span class="st0">&quot;classpath:applicationContext.xml&quot;</span><span class="br0">&#125;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> EmailTest <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Autowired</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; MyComponent component<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230; awesome tests</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>That&#8217;s all you need to make your tests properly autowire all components they&#8217;re using. So far so good &#8211; probably nothing new here, and nothing complicated. So let&#8217;s move on to some &#8220;super big data set&#8221; that needs to be tested, over the same flow over and over again. We&#8217;ll use an super conplicated example to showcase what I mean:</p>
<div class="geshi no java">
<div class="head">//inside an test class</div>
<ol>
<li class="li1">
<div class="de1">@Test</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw4">void</span> testIsValidEmail<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw2">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertTrue<span class="br0">&#40;</span><span class="st0">&quot;hey, that&#39;s an good email!&quot;</span>, isValidEmail<span class="br0">&#40;</span>validEmail1<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230; more tests&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; assertTrue<span class="br0">&#40;</span><span class="st0">&quot;hey, that&#39;s an good email!&quot;</span>, isValidEmail<span class="br0">&#40;</span>validEmail2<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230;over and over again&#8230;</span></div>
</li>
</ol>
</div>
<p>Ok, that&#8217;s obviously stupid&#8230; :-) So, how do we deal with repetitive tests, that need some bigger dataset than just this email example (given here because it&#8217;s short and good enough for our example test)&#8230;? We&#8217;d use @RunWith(Parameterized.class), the class would then look something like this:</p>
<div class="geshi no java">
<div class="head">//my test with only params</div>
<ol>
<li class="li1">
<div class="de1">@RunWith<span class="br0">&#40;</span>Parameterized.<span class="kw2">class</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">class</span> EmailTest <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">String</span> validEmail<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/** We&#39;re testing only good emails, for the sake of simplicity of the example */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Parameters</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">static</span> Collection<span class="sy0">&amp;</span>lt<span class="sy0">;</span>Object<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="sy0">&amp;</span>gt<span class="sy0">;</span> data<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw3">Arrays</span>.<span class="me1">asList</span><span class="br0">&#40;</span><span class="kw2">new</span> <span class="kw3">Object</span><span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="st0">&quot;a@a.pl&quot;</span> <span class="coMULTI">/*more params here*/</span><span class="br0">&#125;</span>, <span class="br0">&#123;</span><span class="st0">&quot;exmaple@example.com&quot;</span>, <span class="coMULTI">/* more params here*/</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> EmailTest<span class="br0">&#40;</span><span class="kw3">String</span> validEmail <span class="coMULTI">/* more params would land here*/</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">validEmail</span> = validEmail<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Test</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw4">void</span> testIsValidEmail<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw2">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">boolean</span> wasOk = StringTools.<span class="me1">isEmail</span><span class="br0">&#40;</span>validEmail<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; assertTrue<span class="br0">&#40;</span><span class="st0">&quot;This should have been ok&quot;</span>, wasOk<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230; more stuff</span></div>
</li>
</ol>
</div>
<p>Ok, that&#8217;s a nice way to make your code in the tests smaller yet have an nice overview through all of your tested data. Each array will be inserted in the constructor, and then ran as an seperate test &#8211; with each dataset. Nice, isn&#8217;t it?</p>
<p>Ok, but what if we want to have both Spring&#8217;s DI and an @Parameters &#8220;test data provider&#8221;&#8230;? Can you spot the problem? Yup, JUnit4 can only have ONE @RunWith annotation, and it doesn&#8217;t accept multiple runners. Which totaly makes sense when you think about it, but then there is our special case of DI, which really doesn&#8217;t change the way an test wotks, it just makes setup easier&#8230; All that said, here&#8217;s how to use both spring and parameters in your Junit4 tests:</p>
<div class="geshi no java">
<div class="head">//mytest with DI and params</div>
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @RunWith<span class="br0">&#40;</span>Parameterized.<span class="kw2">class</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @ContextConfiguration<span class="br0">&#40;</span>locations = <span class="br0">&#123;</span><span class="st0">&quot;classpath:applicationContext.xml&quot;</span><span class="br0">&#125;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">class</span> EmailTest <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> TestContextManager testContextManager<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw3">String</span> validEmail<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Before</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw4">void</span> setUpContext<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw2">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//this is where the magic happens, we actually do &quot;by hand&quot; what the spring runner would do for us,</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// read the JavaDoc for the class bellow to know exactly what it does, the method names are quite accurate though</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">testContextManager</span> = <span class="kw2">new</span> TestContextManager<span class="br0">&#40;</span>getClass<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">testContextManager</span>.<span class="me1">prepareTestInstance</span><span class="br0">&#40;</span><span class="kw2">this</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Parameters</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">static</span> Collection<span class="sy0">&lt;</span>object <span class="br0">&#91;</span><span class="br0">&#93;</span><span class="sy0">&gt;</span> data<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> <span class="kw3">Arrays</span>.<span class="me1">asList</span><span class="br0">&#40;</span><span class="kw2">new</span> <span class="kw3">Object</span><span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><span class="st0">&quot;a@a.pl&quot;</span><span class="br0">&#125;</span>,<span class="br0">&#123;</span><span class="st0">&quot;exmaple@example.com&quot;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> EmailTest<span class="br0">&#40;</span><span class="kw3">String</span> validEmail<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">this</span>.<span class="me1">validEmail</span> = validEmail<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Test</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw4">void</span> testIsValidEmail<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="kw2">throws</span> <span class="kw3">Exception</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">boolean</span> email = StringTools.<span class="me1">isEmail</span><span class="br0">&#40;</span>validEmail<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; assertTrue<span class="br0">&#40;</span><span class="st0">&quot;should be OK&quot;</span>, wasOk<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230; more stuff&#8230;&lt;/object&gt;</span></div>
</li>
</ol>
</div>
<p>That&#8217;s it :-) We do what the spring Runner would do for us, instanciate an application context and prepare it &#8211; that&#8217;s when the DI happens. Note that we cant use another runner annotation, but we can as usual specify where to find the appContext.xml&#8217;s.</p>
<p>That&#8217;s all, hope this will prove useful to some of you :-) <strong>Keep your tests clean!</strong></p>
<p>PS: Warning, most of this code was written in wordpress, it may contain minor spelling errors ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1077/runwith-junit4-with-both-springjunit4classrunner-and-parameterized/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Git@JavaCamp: fix-1: When does git &#8220;see&#8221; an rename explicitly?</title>
		<link>http://www.blog.project13.pl/index.php/fun/1069/gitjavacamp-fix-1-when-does-git-see-an-rename-explicitly/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/1069/gitjavacamp-fix-1-when-does-git-see-an-rename-explicitly/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 01:37:56 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git add]]></category>
		<category><![CDATA[git move]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[move]]></category>
		<category><![CDATA[mv]]></category>
		<category><![CDATA[pitfall]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1069</guid>
		<description><![CDATA[Yup, it&#8217;s time for two follow ups to problems we encountered during my life examples. Why didn&#8217;t git see our &#8220;rename&#8221; as rename? Although yes it is true just as I said during the presentation that &#8220;git mv is just an alias&#8221; I&#8217;ve forgotten about that it&#8217;s an little bit bigger alias: git mv oldname [...]]]></description>
			<content:encoded><![CDATA[<p>Yup, it&#8217;s time for two follow ups to problems we encountered during my life examples. Why didn&#8217;t git see our &#8220;rename&#8221; as rename? Although yes it is true just as I said during the presentation that &#8220;git mv is just an alias&#8221; I&#8217;ve forgotten about that it&#8217;s an little bit bigger alias:</p>
<pre><code>
git mv oldname newname
        =
mv oldname newname
git add newname
git rm oldname</code></pre>
<p>Note that last line, git rm oldname is what we fotgot to do in our example, thus git was seeing an just the &#8220;new file&#8221; version of our operation. One line wrong, yet very important :-) Let&#8217;s check if it works this way:</p>
<p><code>[ktoso@homunculus test]$ ls<br />
jeden  typescript<br />
[ktoso@homunculus test]$ git init .<br />
Reinitialized existing Git repository in /home/ktoso/test/.git/<br />
[ktoso@homunculus test]$ cat jeden<br />
drugi pliczek<br />
[ktoso@homunculus test]$ echo 'dwadwa' &gt; dwa<br />
[ktoso@homunculus test]$ cat dwa<br />
dwadwa<br />
[ktoso@homunculus test]$ git add .<br />
[ktoso@homunculus test]$ git commit -m 'dodanie ich'<br />
[master (root-commit) a430782] dodanie ich<br />
2 files changed, 2 insertions(+), 0 deletions(-)<br />
create mode 100644 dwa<br />
create mode 100644 jeden<br />
create mode 100644 typescript<br />
[ktoso@homunculus test]$ git mv<br />
dwa         .git/       jeden       typescript<br />
[ktoso@homunculus test]$ <strong>git mv jeden nowy-jeden</strong><br />
[ktoso@homunculus test]$ git status<br />
# On branch master<br />
# Changes to be committed:<br />
#   (use "git reset HEAD &lt;file&gt;..." to unstage)<br />
#<br />
<strong>#       renamed:    jeden -&gt; nowy-jeden</strong><br />
#<br />
[ktoso@homunculus test]$ mv<br />
dwa         .git/       nowy-jeden  typescript<br />
[ktoso@homunculus test]$ <strong>mv dwa nowe-dwa</strong><br />
[ktoso@homunculus test]$ <strong>git add nowe-dwa</strong><br />
[ktoso@homunculus test]$ <strong>git rm dwa</strong><br />
rm 'dwa'<br />
[ktoso@homunculus test]$ git status<br />
# On branch master<br />
# Changes to be committed:<br />
#   (use "git reset HEAD &lt;file&gt;..." to unstage)<br />
#<br />
#       <strong>renamed:    dwa -&gt; nowe-dwa</strong><br />
#       renamed:    jeden -&gt; nowy-jeden<br />
#<br />
[ktoso@homunculus test]$ echo "problem Solved... :-)"<br />
</code>problem Solved&#8230; :-)</p>
<p>Yup, it actually detects the renames proppery. Even more, it would detect an &#8220;copy&#8221; action (this works even easier):</p>
<p><code>[ktoso@homunculus test]$ <strong>cp nowy-jeden nowy-jeden-jeden</strong><br />
[ktoso@homunculus test]$ <strong>git add .</strong><br />
[ktoso@homunculus test]$ git status<br />
# On branch master<br />
# Changes to be committed:<br />
#   (use "git reset HEAD &lt;file&gt;..." to unstage)<br />
#<br />
#       renamed:    dwa -&gt; nowe-dwa<br />
#       <strong>copied:     jeden -&gt; nowy-jeden</strong><br />
#       renamed:    jeden -&gt; nowy-jeden-jeden<br />
#       modified:   typescript<br />
#</code></p>
<p>I&#8217;m already converting all the presentations to MP4 files and they&#8217;ll be online soon I hope :-) Then I&#8217;ll also write an usual &#8220;review&#8221; as I always do with any confernce/meering. For now just a quick summary: An amazing attandee count, nice presentations and an very very nice crowd :-) Thanks a lot for all the talks, but let&#8217;s wair for my &#8220;review&#8221; with more informations about JC5&#8230; :-) (Oh, yes we&#8217;re allready planing JC6&#8230; ;-))</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/1069/gitjavacamp-fix-1-when-does-git-see-an-rename-explicitly/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>[review] WARSJawa 2010</title>
		<link>http://www.blog.project13.pl/index.php/fun/1047/review-warsjawa-2010/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/1047/review-warsjawa-2010/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 23:11:35 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[#warsaw]]></category>
		<category><![CDATA[#wjug]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[common lisp]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[JUG]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[polishjug]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1047</guid>
		<description><![CDATA[As this years WARSJawa looked very interesting since it&#8217;s been annouced. I immediatly decided to go there &#8211; and tried to convince some friends to go with me. In the end, 2 friends came with me: Andrzej Grzesik (from PolishJUG) and Temporal &#8211; a LISP/Erlang hacker from my university ;-) We had to ride out [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://lh4.ggpht.com/_SgKkTKkfCcw/TMM3seNLuWI/AAAAAAAAAdA/3GH4EAZdjME/s720/DSC_8378.JPG" onclick="urchinTracker('/outgoing/lh4.ggpht.com/_SgKkTKkfCcw/TMM3seNLuWI/AAAAAAAAAdA/3GH4EAZdjME/s720/DSC_8378.JPG?referer=');"><img title="we at warsjawa" src="http://lh4.ggpht.com/_SgKkTKkfCcw/TMM3seNLuWI/AAAAAAAAAdA/3GH4EAZdjME/s720/DSC_8378.JPG" alt="we at warsjawa" width="432" height="287" /></a></p>
<p><img class="alignleft" title="warsjawa" src="http://4.bp.blogspot.com/_wSeV_DMR2uA/TL1cTjEncdI/AAAAAAAAC6Y/b3snhzrSc7M/s200/warsjawa2010-logo.png" alt="warsjawa" width="200" height="178" />As this years WARSJawa looked very interesting since it&#8217;s been annouced. I immediatly decided to go there &#8211; and tried to convince some friends to go with me. In the end, 2 friends came with me: <strong><a href="http://andrzejgrzesik.info/" target="_self" onclick="urchinTracker('/outgoing/andrzejgrzesik.info/?referer=');">Andrzej Grzesik</a></strong> (from PolishJUG) and <strong><a href="http://www.temporal.pr0.pl/devblog" target="_self" onclick="urchinTracker('/outgoing/www.temporal.pr0.pl/devblog?referer=');">Temporal</a></strong> &#8211; a LISP/Erlang hacker from my university ;-) We had to ride out at 5:00 to on time (driving so soon in the night really sux), but <strong>it was definitely worth it! </strong>Now let&#8217;s go on with a quick review as always after any conference:</p>
<h2><strong>Wojciech Erbetowski</strong> z <a href="http://github.com/warszawajug/warsjawa2010/wiki/Wojciech-Erbetowski-i-PlayFramework" onclick="urchinTracker('/outgoing/github.com/warszawajug/warsjawa2010/wiki/Wojciech-Erbetowski-i-PlayFramework?referer=');">PlayFramework</a></h2>
<p>Wojtek started out the conference with an quick prezi.com presentation but then dived deep into the code and showed us an basic demo of the Play framework in action&#8230; I&#8217;m not really getting &#8220;turned on&#8221; by &#8220;yet another framework&#8221; so I wasn&#8217;t all too enthusiastic about it. Some things are really horrible in Play &#8211; all views are generated by static methods for example &#8211; oh God&#8230; Please dont force me to test such an application &#8211; you know, with multiple threads&#8230; ;-)</p>
<p>All in all: &#8220;I won&#8217;t be using this one.&#8221;</p>
<h2>Dariusz [LocK] Łuksza z <a href="http://github.com/warszawajug/warsjawa2010/wiki/Dariusz-Luksza-i-EGit-i-przyjaciele" onclick="urchinTracker('/outgoing/github.com/warszawajug/warsjawa2010/wiki/Dariusz-Luksza-i-EGit-i-przyjaciele?referer=');">EGit i przyjaciele</a></h2>
<p>As Darek has taken part in this years Google Summer of Code in the EGit project, he&#8217;s the perfect person to give a speech about this plugin. Sadly we encountered an bug in EGit during his presentation and it &#8220;broke his flow&#8221; a little &#8211; which I fully understand. Doing live coding/demos is really hard and I&#8217;ve seen a lot of experienced developers/presenters having problems with ther demos. It&#8217;s the so called &#8220;Weird, this did work last night!&#8221; or &#8220;Demo-&#8221; syndrome&#8230; Nothing you can do about it. As LocK&#8217;s presentation was mostly about clicking, I wasn&#8217;t so happy with it as I&#8217;m more of an terminal hero, and like to do all my git commands from the command line. Nevertheless, the EGit plugin seems to have improved quite a lot!</p>
<p>Btw the way&#8230; My friends from the PolishJUG have asked me to present about Git during the next JavaCamp (#5), but my presentation (while also being an live demo (oh please don&#8217;t allow it to fail&#8230; ;-))) will be purely terminal and git command focused. I hope you&#8217;ll like that approach&#8230;</p>
<h2><a href="http://github.com/warszawajug/warsjawa2010/wiki/Marcin-Rzewucki-i-Clojure---podstawowo-i-praktycznie" onclick="urchinTracker('/outgoing/github.com/warszawajug/warsjawa2010/wiki/Marcin-Rzewucki-i-Clojure---podstawowo-i-praktycznie?referer=');"></a><strong>Paweł Lipiński</strong> z &#8220;niespodzianką&#8221; &#8211; w ostatniej chwili za Sławka Sobótkę</h2>
<p>This talk was one of the &#8220;fun&#8221; ones. No hardcore coding action, but lots and lots of fun and comparing everything to Agile. And Software Craftsmanship to a boy that won&#8217;t clean up his room etc etc. A very fun talk, but there&#8217;s not too much to comment on here, so let&#8217;s move on to the meat of this conference:</p>
<h2>Marcin Rzewucki z <a href="http://github.com/warszawajug/warsjawa2010/wiki/Marcin-Rzewucki-i-Clojure---podstawowo-i-praktycznie" onclick="urchinTracker('/outgoing/github.com/warszawajug/warsjawa2010/wiki/Marcin-Rzewucki-i-Clojure---podstawowo-i-praktycznie?referer=');">Clojure &#8211; podstawowo i praktycznie</a></h2>
<p><strong>&#8220;This is the meat.</strong>&#8221; This is the one presentation that convinced Jacek (Temporal) to go with us to this conference. And I really have to say, it&#8217;s also what really tickled my <em>hacker sense</em> looking at the agenda. So, were we let down with just some basic intro..? NO, absolutely no. This presentation was very invofmative, easy to grasp and it turned out to be two presentations in one! The first part by Marcin was an intro to the language and how it functions, along with calling Plain Old Java from it. (Btw, <strong>kudos</strong> to Marcin for speaking so clearly even though he had some health (throat) problems  at that time)</p>
<p>The second part, which was taken over by <a href="http://jan.rychter.com/" onclick="urchinTracker('/outgoing/jan.rychter.com/?referer=');">Jan Rychter</a> was entirely focused on the practical aspect of coding in Clojure in an commertial application. It was VERY, VERY interesting to see how and why one would use an functional (&#8220;very functional&#8221;, not just Scala) language to implement some application.</p>
<p>And don&#8217;t forget to add <a href="http://www.clojureblog.pl/" onclick="urchinTracker('/outgoing/www.clojureblog.pl/?referer=');">Marcin&#8217;s blog &#8211; http://www.clojureblog.pl/</a> to your RSS feeds!<br />
Yet another link for starters: <a href="http://clojure.org/" onclick="urchinTracker('/outgoing/clojure.org/?referer=');">http://clojure.org/</a></p>
<h2>Adam Michalik z <a href="http://github.com/warszawajug/warsjawa2010/wiki/Adam-Michalik-i-Co-w-bajkodzie-piszczy" onclick="urchinTracker('/outgoing/github.com/warszawajug/warsjawa2010/wiki/Adam-Michalik-i-Co-w-bajkodzie-piszczy?referer=');">Co w bajtkodzie piszczy?</a></h2>
<p>You may remember my blog post where I&#8217;ve been <a href="http://www.blog.project13.pl/index.php/coding/593/dont-use-loops-on-strings-for-christs-sake/">decompiling string concatenations inside an for loop</a> just to see how much more dump it produces. Adam&#8217;s presentation was just about that, decompiling and analyzing the ByteCode. It&#8217;s an very fun topic to look into and may lead someone into implementing some language on top of the JVM&#8230; :-)</p>
<p>But Adam didn&#8217;t stop at just analyzing the ByteCode, in the end he actually coded some fun stuff that the ByteCode allows us to do but the javac compiler doesnt &#8211; such as multimethods and calling methods of an interface (<strong>invokeinterface</strong>) on an Object object&#8230; ;-) There were some fun tricks included in his presentation and he seemed really compenent about this matter. &#8220;Bit fat 10 points for the man over here ;-)&#8221;</p>
<h2><strong>Rafał Rusin</strong> z <a href="http://github.com/warszawajug/warsjawa2010/wiki/Rafal-Rusin-i-Tworzenie-zadan-przy-uzyciu-komponentow-Open-Source-" onclick="urchinTracker('/outgoing/github.com/warszawajug/warsjawa2010/wiki/Rafal-Rusin-i-Tworzenie-zadan-przy-uzyciu-komponentow-Open-Source-?referer=');">Tworzenie zadań przy użyciu komponentów Open Source (Apache HISE, Apache Camel)</a></h2>
<p>While being a little accustomed to (&#8220;I know what it is&#8221;) with Apache Camel, and seeing some sense in it. I really can&#8217;t seem to find any particuilar use case for my for Apache HISE. It&#8217;s an WS-Human-Task Spec implementation and aims to&#8230; wel&#8230; And that&#8217;s the problem I had during this presentation, I didn&#8217;t quite grasp why I would use it. The general concept of Human Tasks is quite easy to understand, but why I&#8217;d need Hise for it is not&#8230; One of the reasons I didn&#8217;t grasp it may be that we were dead tired after riding +4hours to Warsaw. Having that said, you may want to take a look at <a href="http://incubator.apache.org/hise/" onclick="urchinTracker('/outgoing/incubator.apache.org/hise/?referer=');">their homesite</a>.</p>
<h2>Summary</h2>
<p>We all really enjoyed everything there in Warsaw, the great people (hooray for networking), food and last but not least the great presentations. During the few presentations we didn&#8217;t enjoy we were hacking some of emacs sources (using emacs of course&#8230; ;-)), and what a suprise &#8211; they&#8217;re mostly LISPs (the plugins). That was also a very interesting thing I took from this conference&#8230; I&#8217;d recommend you go to the next edition ot WarsJawa if you still haven&#8217;t been there&#8230; <strong>It&#8217;s even worth +8hours in a car on one day!</strong> :-)</p>
<p style="text-align: center;"><a href="http://lh4.ggpht.com/_SgKkTKkfCcw/TMM3YiPCSLI/AAAAAAAAAck/xtwqLc6Yk_Y/s720/DSC_8372.JPG" onclick="urchinTracker('/outgoing/lh4.ggpht.com/_SgKkTKkfCcw/TMM3YiPCSLI/AAAAAAAAAck/xtwqLc6Yk_Y/s720/DSC_8372.JPG?referer=');"><img title="we at warsjawa" src="http://lh4.ggpht.com/_SgKkTKkfCcw/TMM3YiPCSLI/AAAAAAAAAck/xtwqLc6Yk_Y/s720/DSC_8372.JPG" alt="warsjawa" width="432" height="287" /></a></p>
<p>Photos and more reviews can be found here:</p>
<ul>
<li><a href="http://picasaweb.google.com/bartek.zdanowski/Warsjawa2010#5531326004503230818" onclick="urchinTracker('/outgoing/picasaweb.google.com/bartek.zdanowski/Warsjawa2010_5531326004503230818?referer=');">http://picasaweb.google.com/bartek.zdanowski/Warsjawa2010#5531326004503230818</a></li>
<li><a href="http://blog.japila.pl/2010/10/warsjawa-2010-za-nami-o-javarsovii-2011.html" onclick="urchinTracker('/outgoing/blog.japila.pl/2010/10/warsjawa-2010-za-nami-o-javarsovii-2011.html?referer=');">http://blog.japila.pl/2010/10/warsjawa-2010-za-nami-o-javarsovii-2011.html</a></li>
<li><a href="http://picasaweb.google.pl/Anna.Mazinska/Warsjawa?authkey=Gv1sRgCNm7mvryj7LcsQE#" onclick="urchinTracker('/outgoing/picasaweb.google.pl/Anna.Mazinska/Warsjawa?authkey=Gv1sRgCNm7mvryj7LcsQE&amp;referer=');">http://picasaweb.google.pl/Anna.Mazinska/Warsjawa?authkey=Gv1sRgCNm7mvryj7LcsQE#</a></li>
</ul>
<p>PS: Yeah sorry for less links to projects and homepages than I usually include, but I&#8217;m kinda very busy right now&#8230; :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/1047/review-warsjawa-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

