<?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</title>
	<atom:link href="http://www.blog.project13.pl/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.project13.pl</link>
	<description>The Blog of a Coder</description>
	<lastBuildDate>Tue, 15 May 2012 00:10:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Scala 2.10: class OhMy extends Dynamic !</title>
		<link>http://www.blog.project13.pl/index.php/coding/1580/scala-2-10-class-ohmy-extends-dynamic/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1580/scala-2-10-class-ohmy-extends-dynamic/#comments</comments>
		<pubDate>Sun, 13 May 2012 23:02:55 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[lang]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[2.10]]></category>
		<category><![CDATA[dynamic]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[type]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1580</guid>
		<description><![CDATA[The first part of the post is a bit like &#8220;someone is wrong on the internet!&#8221; (yeah, a rant), so feel free to skip it and dive into a detailed post about Scala&#8217;s new Dynamic type in part 2 of this post. Part 1: The rant about a wrong example I was meaning to write [...]]]></description>
			<content:encoded><![CDATA[<p>The first part of the post is a bit like &#8220;<a href="http://xkcd.com/386/" onclick="urchinTracker('/outgoing/xkcd.com/386/?referer=');">someone is wrong on the internet!</a>&#8221; (yeah, a rant), so feel free to skip it and dive into a detailed post about Scala&#8217;s new Dynamic type in part 2 of this post.</p>
<h2>Part 1: The rant about a wrong example</h2>
<p>I was meaning to write about upcoming Scala features but got sidetracked by work and <a href="http://www.geecon.org" onclick="urchinTracker('/outgoing/www.geecon.org?referer=');">GeeCON</a> related stuff this week. I&#8217;ve just read <a href="http://scala.net.pl/typ-dynamic-w-jezyku-statycznym/" onclick="urchinTracker('/outgoing/scala.net.pl/typ-dynamic-w-jezyku-statycznym/?referer=');">a post about Dynamic on <strong>scala.net.pl</strong> and&#8230; <strong>It&#8217;s totally wrong!</strong></a> :&lt; C&#8217;mon people &#8211; you&#8217;ve got scala _as_ your domain name, so at least run the examples in a REPL before you post something ;-)</p>
<div class="geshi no scala">
<div class="head">// example form above mentioned site&#8230;</div>
<ol>
<li class="li1">
<div class="de1">val d = new Dynamic {}
</div>
</li>
<li class="li1">
<div class="de1">d.bar = &quot;bar&quot; // THIS IS WRONG</div>
</li>
</ol>
</div>
<p>Ok, so on the REPL &#8211; the first line will compile. Dynamic is in fact a new Trait in Scala 2.10 and you can create new instances of Traits (just as you could in Java with anonymous inner classes) using the <strong>new Trait {}</strong> syntax. Line 2 though, it utterly wrong. It will cause 2 compile time errors, namely:</p>
<div class="geshi no bash">
<div class="head"># fails will follow</div>
<ol>
<li class="li1">
<div class="de1">scala<span class="sy0">&amp;</span>gt; d.bar = <span class="st0">&quot;bar&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">console :<span class="nu0">11</span>: error: value selectDynamic is not a member of Dynamic</div>
</li>
<li class="li1">
<div class="de1">val <span class="re1">$ires1</span> = d.bar</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^</div>
</li>
<li class="li1">
<div class="de1">console: <span class="nu0">8</span>: error: value updateDynamic is not a member of Dynamic</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;d.bar = <span class="st0">&quot;bar&quot;</span></div>
</li>
</ol>
</div>
<p>Dynamic is NOT &#8220;a magic type you can set random stuff on&#8221;, it&#8217;s a bit more discrete. You can build such construct using Dynamic &#8211; sure, but that&#8217;s not all it is.</p>
<h2>Part 2: A deep dive into Scala&#8217;s Dynamic type</h2>
<p>Ok, end of rant and back to the basics. So&#8230; How do we use Dynamic? In fact, it&#8217;s used by implementing a few &#8220;magic&#8221; methods:</p>
<ul>
<li><strong></strong><strong>applyDynamic</strong></li>
<li><strong></strong><strong>applyDynamicNamed</strong></li>
<li><strong>selectDynamic</strong></li>
<li><strong>updateDynamic</strong></li>
</ul>
<p>Let&#8217;s take a look (with examples, at each of them. We&#8217;ll start with  the most &#8220;typical one&#8221;, and move on to those which would allow the construct shown above (which didn&#8217;t (back then) compile) and make it work this time ;-)</p>
<h3>applyDynamic</h3>
<p>Ok, our first magic method looks like this:</p>
<div class="geshi no scala">
<div class="head">// applyDynamic example</div>
<ol>
<li class="li1">
<div class="de1">object OhMy extends Dynamic {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; def applyDynamic(methodName: String)(args: Any*) {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; println(s&quot;&quot;&quot;| &nbsp;methodName: $methodName,
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |args: ${args.mkString(&quot;,&quot;)}&quot;&quot;&quot;.stripMargin)
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">OhMy.dynamicMethod(&quot;with&quot;, &quot;some&quot;, 1337)</div>
</li>
</ol>
</div>
<p>So the signature of <strong>applyDynamic</strong> takes the method name and it&#8217;s arguments. So obviously we&#8217;d have to access them by their order. Very nice for building up some strings etc. Our implementation will only print what we want to know about the method being called. Did it really get the values/method name we would exect? You can try it out (it&#8217;s copy paste ready) in your <strong>Scala 2.10.M3 REPL</strong> &#8211; if you don&#8217;t have one at hand: yeah, the output would be:</p>
<pre>  methodName: dynamicMethod,
  args: with,some,1337</pre>
<p>By the way, did you know about <strong>RichString&#8217;s</strong> <strong>stripMargin</strong>? It&#8217;s a nice way to still have nicely printable strings when you&#8217;re using multiline strings. By default it trims everything that is before the | sign (from the left side, for each line). The sign can be overriden of course if you fancy $ signs for example&#8230; ;-)</p>
<h3>applyDynamicNamed</h3>
<p>Ok, that was easy. But it didn&#8217;t give us too much control over the names of the parameters.<br />
Wouldn&#8217;t it be nice if we could just write JSON.node(nickname = &#8220;ktoso&#8221;)? Well&#8230; turns out we can!</p>
<div class="geshi no scala">
<div class="head">// applyDynamicNamed example</div>
<ol>
<li class="li1">
<div class="de1">object JSON extends Dynamic {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; def applyDynamicNamed(name: String)(args: (String, Any)*) {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; println(s&quot;&quot;&quot;Creating a $name, for:\n &quot;${args.head._1}&quot;: &quot;${args.head._2}&quot; &quot;&quot;&quot;)
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">JSON.node(nickname = &quot;ktoso&quot;)</div>
</li>
</ol>
</div>
<p>So this time instead of just a list of values, we also get their names. Thanks to this the response for this example will be:</p>
<pre>Creating a node, for:
 "nickname": "ktoso"</pre>
<p>I can easily imagine some pretty slick <strong>DLSs</strong> being built around this!</p>
<h3>selectDynamic</h3>
<p>Not it&#8217;s time for the more &#8220;unusual&#8221; methods. apply methods we&#8217;re pretty easy to understand. It&#8217;s just a method with some arbitrary name. But hey, isn&#8217;t almost everything in scala a method &#8211; or we can have a method on an object that would act as a field? Yeah, so let&#8217;s give it a try! <strong>We&#8217;ll use the example with applyDynamic here, and try to act like it has a method without ()</strong>:</p>
<div class="geshi no scala">
<div class="head">// compilation failure</div>
<ol>
<li class="li1">
<div class="de1">OhMy.name // fails</div>
</li>
</ol>
</div>
<p>Hey! Why didn&#8217;t this work with <strong>applyDynamic</strong>? Yeah, you figured it out already I guess. Such methods (without ()) are treated special, as they would usualy represent fields for example. <strong>applyDynamic</strong> won&#8217;t trigger on such calls. Let&#8217;s <strong>add selectDynamic</strong> to the mix then, shall we?</p>
<div class="geshi no scala">
<div class="head">// selectDynamic example</div>
<ol>
<li class="li1">
<div class="de1">object HasStuff extends Dynamic {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; def selectDynamic(name: String): String = s&quot;I have $name!&quot;
</div>
</li>
<li class="li1">
<div class="de1">}</div>
</li>
</ol>
</div>
<p>And this time when we execute <strong>HasStuff.bananas</strong> we&#8217;ll get &#8220;I have bananas!&#8221; as expected. Notice that here we return a value instead of printing it. It&#8217;s because it &#8220;acts as a field&#8221; this time around. But we could also return things (of arbitrary types) from any other method described here (<strong>applyDynamic</strong> <strong>could return the string instead of printing it</strong>).</p>
<h3>updateDynamic</h3>
<p>What&#8217;s left you ask? Ask yourself the following question then: &#8220;Since I can act like a <strong>Dynamic</strong> object has some value in some field&#8230; What else should I be able to do with it?&#8221; The answer is obviously: &#8220;set it&#8221;! That&#8217;s what updateDynamic is used for. There is one special rule about <strong>updateDynamic</strong> though &#8211; it&#8217;s only valid if you also took care about selectDynamic &#8211; that&#8217;s why in the first example the code generated errors about both &#8211; select and update. For example if we&#8217;d implement only updateDynamic, we would get an error that selectDynamic was not implemented and it wouldn&#8217;t compile anyway. It makes sense in terms of plain semantics if you think about it.</p>
<p>When we&#8217;re done with this example, we can actually make the (wrong) code from the first code snippet work. The bellow snippet will be an implementation of what was shown on the first snippet on that other website, and this time it&#8217;ll actually work ;-)</p>
<div class="geshi no scala">
<div class="head">// updateDynamic example</div>
<ol>
<li class="li1">
<div class="de1">object MagicBox extends Dynamic {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; private var box = mutable.Map[String, Any]()
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; def updateDynamic(name: String)(value: Any) { box(name) = value }
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; def selectDynamic(name: String) = box(name)
</div>
</li>
<li class="li1">
<div class="de1">}</div>
</li>
</ol>
</div>
<p>Using this <strong>Dynamic</strong> &#8220;<strong>MagicBox</strong>&#8221; we can store items at arbitrary &#8220;fields&#8221; (well, they do seem like fields, even though they are not ;-)). An example run might look like:</p>
<pre>scala&gt; MagicBox.banana = "banana"
MagicBox.banana: Any = banana

scala&gt; MagicBox.banana
res7: Any = banana

scala&gt; MagicBox.unknown
java.util.NoSuchElementException: key not found: unknown</pre>
<p>By the way&#8230; are you curious how Dynamic <a href="https://github.com/scala/scala/blob/master/src/library/scala/Dynamic.scala" onclick="urchinTracker('/outgoing/github.com/scala/scala/blob/master/src/library/scala/Dynamic.scala?referer=');">[source code]</a> is implemented? The fun part here is that the trait Dynamic, does absolutely nothing by itself &#8211; it&#8217;s &#8220;empty&#8221;, just a marker interface, like in the good ol&#8217; Serializable days ;-) Obviously all the heavylifting is done by the compiler here.</p>
<p>Anyway, thanks for reading and&#8230; don&#8217;t overuse Dynamic, will ya? :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1580/scala-2-10-class-ohmy-extends-dynamic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The impossibleness of getting your PhoneNumber in Android and AlertDialogs on Futures</title>
		<link>http://www.blog.project13.pl/index.php/coding/1549/about-the-impossibleness-of-getting-your-phonenumber-in-androids-apis/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1549/about-the-impossibleness-of-getting-your-phonenumber-in-androids-apis/#comments</comments>
		<pubDate>Sat, 05 May 2012 02:07:13 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[async]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[phonenumber]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1549</guid>
		<description><![CDATA[There is a land in which API calls can not always be trusted. A land where docs lie you in the face about return guarantees. It is here, where the Lords of Code join hands &#8211; and with their Keyboards of Steel smite all evil in search of the hidden truth&#8230; Here be dragons &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Bilbo+Swash+Caps::latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })(); </script></p>
<blockquote style="font-family: 'Bilbo+Swash+Caps::latin', cursive; font-size: 1.2em; line-height: 1.2em">
<p style="text-align: center;">There is a land in which API calls can not always be trusted. A land where docs lie you in the face about return guarantees. It is here, where the Lords of Code join hands &#8211; and with their Keyboards of Steel smite all evil in search of the hidden truth&#8230; Here be dragons &#8211; API weirdness.</p>
<p style="text-align: right;"><em>&#8211; Author unknown, 2012</em></p>
</blockquote>
<p>That being said, I got a bit sad today the reason being: It&#8217;s actually really HARD (impossible?) to get your phone number on android. Yeah, you can:</p>
<p><script src="https://gist.github.com/2598757.js?file=normal.scala"></script></p>
<p>But&#8230; It won&#8217;t always work. After some googling around I found an <a href="http://code.google.com/p/android/issues/detail?id=1110#c5" onclick="urchinTracker('/outgoing/code.google.com/p/android/issues/detail?id=1110_c5&amp;referer=');">issue related to this on the android code.google.com</a>. Sadly, it&#8217;s explained there &#8220;black on white&#8221; that if the simcard doesn&#8217;t contain this info (does not have to) you&#8217;re basically a bit screwed, and won&#8217;t be able to obtain the phone number (I did a bit of research and it really seems impossible &#8211; if you know a way, please let me know :-)).</p>
<blockquote><p>The SIM in the device has a slot for the phone number, but it isn&#8217;t required for operation. Some carriers may choose not to populate this SIM field. [...]</p></blockquote>
<p>That&#8217;s v. interesting (to me, not a GSM-network-operator pro ;-)), so the phone number is actually assigned by the network when the simcard comes talking to it. True, that makes sense &#8211; you can switch SIM cards and still keep the same number you had all the time&#8230; What to do? What to do?! I still need a way to find out the number, and sadly when looking at sms messages already stored on the phone, they only contain an &#8220;address&#8221; field which is the &#8220;sent from&#8221; number.</p>
<p>The outcome of this story is the interesting part here I think. I switched to asking the user for his phone number &#8211; it&#8217;s really &#8220;good enough&#8221; for my use case :-) I do something quite funny, the phone.number is actually a lazy value that, if it needs to, will create a dialog to ask the user about it.</p>
<p>So in the activity we add a listener on the Future[String] (actually that&#8217;s Guava&#8217;s SettableFuture[String]), so we&#8217;ll update the UI when the value gets updated.</p>
<p><script src="https://gist.github.com/2598757.js?file=MyActivity.scala"></script></p>
<p>Btw, yeah I have some implicits for Runnable creation etc. So the first parameter here is actually an implementation of Java&#8217;s Runnable. Moving on, let&#8217;s take a look at the implementation of phone.number:</p>
<p><script src="https://gist.github.com/2598757.js?file=MyPhone.scala"></script></p>
<p>So we still try to use the TelephonyManager to obtain the phone number &#8211; sometimes it works. But if it didn&#8217;t, we fallback to asking the user about his phone number. Here&#8217;s the implementation of askUserForHisNumber():</p>
<p><script src="https://gist.github.com/2598757.js?file=MyPhoneRest.scala"></script></p>
<p>It&#8217;s explained in-line there, so take a moment to digest it. The general idea here is to NOT block the main UI thread, while allowing the dialog to show up &#8220;whenever it needs to&#8221;. In this case it&#8217;ll show up when first needed &#8211; when someone gets the Future. In the askUserForHisNumber implementation we store the once entered phone number, so it&#8217;s reused from the shared preferences on the next app start instead of asking the user again. </p>
<p>Also notice that using this flow we created a quite nice UX (IMHO), as the user doesn&#8217;t have to crawl to the settings activity to set this &#8211; he&#8217;ll be asked for the number if it&#8217;s needed, right away :-) If you&#8217;re interested in more Android+Scala posts, just drop a comment &#8211; I&#8217;ll happily follow up in a blogpost.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1549/about-the-impossibleness-of-getting-your-phonenumber-in-androids-apis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scala 2.10.0: Hello $string interpolation!</title>
		<link>http://www.blog.project13.pl/index.php/coding/1540/scala-2-10-0-hello-string-interpolation/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1540/scala-2-10-0-hello-string-interpolation/#comments</comments>
		<pubDate>Thu, 03 May 2012 23:43:03 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[sip-11]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string interpolations]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1540</guid>
		<description><![CDATA[Yup, now with Scala 2.10.0&#8242;s Milestone 3 we should be getting ready for the new SIPs introduced, one of the easiest to grasp (among TypeTokens and Macros ;-)) is the long requested SIP-11: String Interpolation. You can read the full SIP here, but for a quick introduction let&#8217;s proceed with this blogpost. The syntax to [...]]]></description>
			<content:encoded><![CDATA[<p>Yup, now with Scala 2.10.0&#8242;s Milestone 3 we should be getting ready for the new SIPs introduced, one of the easiest to grasp (among TypeTokens and Macros ;-)) is the long requested <strong>SIP-11: String Interpolation</strong>. You can <a href="http://docs.scala-lang.org/sips/pending/string-interpolation.html" onclick="urchinTracker('/outgoing/docs.scala-lang.org/sips/pending/string-interpolation.html?referer=');">read the full SIP here</a>, but for a quick introduction let&#8217;s proceed with this blogpost.</p>
<p>The syntax to use interpolated strings looks like this:</p>
<div class="geshi no scala">
<ol>
<li class="li1">
<div class="de1">val name = &quot;ktoso&quot;
</div>
</li>
<li class="li1">
<div class="de1">val interpol = s&quot;hello $name&quot;
</div>
</li>
<li class="li1">
<div class="de1">interpol should equal &quot;hello ktoso&quot;</div>
</li>
</ol>
</div>
<p>And it&#8217;s actually just a shorthand for the bellow:</p>
<div class="geshi no scala">
<ol>
<li class="li1">
<div class="de1">scala.StringContext(&quot;hello &quot;, &quot;&quot;).f(name)</div>
</li>
</ol>
</div>
<p>So the $name placeholder was replaced with an empty &#8220;part of a string&#8221; in the <a href="https://github.com/scala/scala/blob/master/src/library/scala/StringContext.scala" onclick="urchinTracker('/outgoing/github.com/scala/scala/blob/master/src/library/scala/StringContext.scala?referer=');">StringContext</a>, and the f can be seen a bit similiar to RichString#format() here, it puts the values in their places. The interesting trick here is that the logic behind this trailing &#8220;&#8221; string is that f() inserts the given parameters <strong>between</strong> the parts given to StringContext &#8211; this way it doesn&#8217;t have to do any repetetive parsing etc at runtime, it just inserts into &#8220;known places&#8221; which is a better (performance wise) idea than keeping the pattern with dollar signs and parsing it each time. :-)</p>
<p>Another nice feature in contrast to (for example) Ruby&#8217;s string interpolation here is that &#8220;value not found&#8221; problems can be detected at compile time, so the bellow example would not compile:</p>
<div class="geshi no scala">
<ol>
<li class="li1">
<div class="de1">def string = s&quot;Hello, I&#39;m a $name&quot;</div>
</li>
</ol>
</div>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">$ scalac <span class="kw3">test</span>.scala</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">test</span>.scala:<span class="nu0">4</span>: error: not found: value name</div>
</li>
<li class="li1">
<div class="de1">val string = s<span class="st0">&quot;Hello, I&#39;m a $name&quot;</span></div>
</li>
</ol>
</div>
<p>&#8220;Typesafe!&#8221; one might want to shout&#8230; ;-) Anyway, I think it&#8217;s a welcome feature and will improve our loggers from:</p>
<div class="geshi no scala">
<ol>
<li class="li1">
<div class="de1">logger.info(&quot;it broke, zomg on %s&quot;.format(where))</div>
</li>
</ol>
</div>
<p>to a nicer</p>
<div class="geshi no scala">
<ol>
<li class="li1">
<div class="de1">logger.info(s&quot;it broke, zomg on $where&quot;)</div>
</li>
</ol>
</div>
<p>I&#8217;ll also cover the &#8220;more&#8221; interesting features in some of my upcoming blogposts, so keep an eye out for posts about: <strong>Dynamic</strong>, <strong>Macros</strong> and <strong>Manifests</strong> vs. <strong>TypeTokens</strong> :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1540/scala-2-10-0-hello-string-interpolation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple implicit overhead at runtime &amp; Google Caliper micro-benchmarking</title>
		<link>http://www.blog.project13.pl/index.php/fun/1515/simple-implicit-overhead-at-runtime-google-caliper-micro-benchmarking/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/1515/simple-implicit-overhead-at-runtime-google-caliper-micro-benchmarking/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 22:56:53 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[caliper]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tooling]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1515</guid>
		<description><![CDATA[I&#8217;ve recently been implementing a series of &#8220;Words&#8221; in Scala. To give you a feel for what they are, here&#8217;s a few examples: RetryVerb which can be used as: import RetryVerb._ &#160; val name: String = retry(times = 5) { &#160; Http.getTheName // which sometimes throws exceptions } et cetera&#8230; One of those less useful [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been implementing a series of &#8220;Words&#8221; in <strong>Scala</strong>. To give you a feel for what they are, here&#8217;s a few examples: <strong>RetryVerb</strong> which can be used as:</p>
<div class="geshi no scala">
<div class="head">import RetryVerb._</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">val name: String = retry(times = 5) {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; Http.getTheName // which sometimes throws exceptions
</div>
</li>
<li class="li1">
<div class="de1">}</div>
</li>
</ol>
</div>
<p>et cetera&#8230; One of those less useful Words I have implemented is the <strong>NotAdverb</strong>. It&#8217;s allows you to negate Booleans using a not method that&#8217;s being pimped into them.</p>
<div class="geshi no scala">
<div class="head">import NotAdverb._</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">val isMaster = false
</div>
</li>
<li class="li1">
<div class="de1">if(isMaster.not) { println(&quot;I&#39;m not master :-(&quot;)</div>
</li>
</ol>
</div>
<p>So it obviously doesn&#8217;t provide any more value than just using the ! operator. I guess it may be nicer to read, but that&#8217;s it&#8230; A colegue of mine pointed out that, while perhaps it may be nicer to read&#8230; is the runtime <strong>overhead</strong> of this implicit conversion REALLY worth it? To anwser this question I decided to see for myself (out of curiosity) how much such an implicit costs (in terms of nanoseconds).</p>
<p>I&#8217;ve recently discovered <strong><a href="http://code.google.com/p/caliper/" onclick="urchinTracker('/outgoing/code.google.com/p/caliper/?referer=');">Google Caliper</a></strong> which is a very small micro benchmarking framework, so I decided to use it. Sadly it turns out it&#8217;ll throw</p>
<pre>Class [pl.project13.implicitoverhead.Benchmarks$JustBoolean] has no parameterless constructor.</pre>
<p>even though my test classes (written in scala) obviously did have what Scala considers as parameterless constructor. I almost went out to fix the problem in Caliper, when I found that Daniel Sobral already went out and fixed <a href="https://github.com/dcsobral/scala-foreach-benchmark" onclick="urchinTracker('/outgoing/github.com/dcsobral/scala-foreach-benchmark?referer=');">Caliper to work with <strong>Scala</strong></a>. So here&#8217;s the full implementation of the benchmarks I have written:</p>
<div class="geshi no scala">
<div class="head">package org.example</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">object NotAdverb {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; implicit def bool2hasNot(b: Boolean): HasNot = new HasNot(b)
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; sealed case class HasNot(b: Boolean) {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; def not:Boolean = !b
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">}
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">class Benchmark extends SimpleScalaBenchmark {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; var b: Boolean = _
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; override def setUp() {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; b = false
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; def timeSimpleBoolean(reps: Int) = repeat(reps) {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; if(!b) { b = !b } else { b = !b }
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; b
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; 1
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; import NotAdverb._
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; def timeImplicitBoolean(reps: Int) = repeat(reps) {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; if(b.not) { b = !b } else { b = !b }
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; b
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; 1
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; }
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">}</div>
</li>
</ol>
</div>
<p>The settings I ran the tests on are as follows (default settings would be a bit too small I figured for such simple tests):</p>
<pre>repetitions = 3000
warmup time = 3000 ms
test time = 10_000 ms
trials = 10</pre>
<p>Sadly I was not able to run caliper with &#8211;measureMemory, which would have been really interesting too I think. I didn&#8217;t spent too much time with it, so maybe it ain&#8217;t so hard to include the javaagent it requires hm hm. Anyway, here are the results, first in command line format and then in all it&#8217;s uploaded glory:</p>
<div class="geshi no bash">
<div class="head">&gt; run &#8211;trials 10 &#8211;warmupMillis 3000 &#8211;runMillis 10000</div>
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp;<span class="nu0">0</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">0</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.89</span> ns; ?=<span class="nu0">0.00</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp;<span class="nu0">5</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">1</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.73</span> ns; ?=<span class="nu0">0.00</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">10</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">2</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.89</span> ns; ?=<span class="nu0">0.00</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">15</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">3</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.73</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">10</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">20</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">4</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.74</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">25</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">5</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.74</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">7</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">30</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">6</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.74</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">35</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">7</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.74</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">40</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">8</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.73</span> ns; ?=<span class="nu0">0.00</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">45</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">9</span>, <span class="re2">benchmark=</span>SimpleBoolean<span class="br0">&#125;</span> <span class="nu0">0.73</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">6</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">50</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">0</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.19</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">55</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">1</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.22</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">60</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">2</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.20</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">65</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">3</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.21</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">70</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">4</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.20</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">75</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">5</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.21</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">80</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">6</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.23</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">85</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">7</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.22</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">90</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">8</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.20</span> ns; ?=<span class="nu0">0.00</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> <span class="nu0">95</span><span class="sy0">%</span> Scenario<span class="br0">&#123;</span><span class="re2">vm=</span>java, <span class="re2">trial=</span><span class="nu0">9</span>, <span class="re2">benchmark=</span>ImplicitBoolean<span class="br0">&#125;</span> <span class="nu0">2.20</span> ns; ?=<span class="nu0">0.01</span> ns <span class="sy0">@</span> <span class="nu0">3</span> trials</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; &nbsp; &nbsp; benchmark trial &nbsp; &nbsp;ns linear runtime</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">0</span> <span class="nu0">0.892</span> ============</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">1</span> <span class="nu0">0.731</span> =========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">2</span> <span class="nu0">0.889</span> ===========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">3</span> <span class="nu0">0.733</span> =========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">4</span> <span class="nu0">0.737</span> =========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">5</span> <span class="nu0">0.741</span> =========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">6</span> <span class="nu0">0.739</span> =========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">7</span> <span class="nu0">0.742</span> ==========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">8</span> <span class="nu0">0.733</span> =========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; SimpleBoolean &nbsp; &nbsp; <span class="nu0">9</span> <span class="nu0">0.735</span> =========</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">0</span> <span class="nu0">2.193</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">1</span> <span class="nu0">2.217</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">2</span> <span class="nu0">2.197</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">3</span> <span class="nu0">2.207</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">4</span> <span class="nu0">2.204</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">5</span> <span class="nu0">2.214</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">6</span> <span class="nu0">2.225</span> ==============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">7</span> <span class="nu0">2.218</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">8</span> <span class="nu0">2.198</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> ImplicitBoolean &nbsp; &nbsp; <span class="nu0">9</span> <span class="nu0">2.202</span> =============================</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> vm: java</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> </div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> View current and previous benchmark results online:</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#91;</span>info<span class="br0">&#93;</span> &nbsp; http:<span class="sy0">//</span>microbenchmarks.appspot.com<span class="sy0">/</span>run<span class="sy0">/</span>ktosopl<span class="sy0">@</span>gmail.com<span class="sy0">/</span>org.example.Benchmark</div>
</li>
</ol>
</div>
<p>And then the graphical representation of it (available on <a href="http://microbenchmarks.appspot.com/run/ktosopl@gmail.com/org.example.Benchmark" onclick="urchinTracker('/outgoing/microbenchmarks.appspot.com/run/ktosopl_gmail.com/org.example.Benchmark?referer=');">http://microbenchmarks.appspot.com/run/ktosopl@gmail.com/org.example.Benchmark</a>).</p>
<p><a href="http://www.blog.project13.pl/wp-content/uploads/2012/04/measured_implicits.png"><img class="aligncenter size-full wp-image-1518" title="measured_implicits" src="http://www.blog.project13.pl/wp-content/uploads/2012/04/measured_implicits.png" alt="" width="550" /></a></p>
<p>It&#8217;s quite obvious that the method with implicits would be slower, but it&#8217;s still interesting to first <strong>MEASURE (!)</strong> and <strong>then</strong> judge some solution. So here we&#8217;ve got an average of 300% more slowness than just using the ! operator&#8230; Although we&#8217;re still in very small nano second numbers, that can be considered quite an overhead &#8211; depending on what your use-case is. In our case it isn&#8217;t really the &#8220;slow downer&#8221; as we do more network operations etc, but all in all I think we&#8217;ll say goodbye to the NotAdverb ;-)</p>
<p>By the way, since <strong>caliper</strong> also automatically uploads your test results online, it&#8217;s a really cool tool to show team members how your implementation is faster than theirs etc ;-) I recommend you to check it out, even if it&#8217;s still in it&#8217;s early stages&#8230; :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/1515/simple-implicit-overhead-at-runtime-google-caliper-micro-benchmarking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Teaching JRuby talk with Scala&#8230; on Rails!</title>
		<link>http://www.blog.project13.pl/index.php/fun/1497/teaching-jruby-talk-with-scala-on-rails/</link>
		<comments>http://www.blog.project13.pl/index.php/fun/1497/teaching-jruby-talk-with-scala-on-rails/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 22:29:09 +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[scala]]></category>
		<category><![CDATA[#jruby]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[interop]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[scala jruby]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1497</guid>
		<description><![CDATA[The JVM is awesome. But back to the topic of this post: We&#8217;ll see how you can leverage both Scala and JRuby in one project. Each will doing what it does best: Ruby will handle the FAST frontend development as one of Ruby&#8217;s strong points is obviously Rails which made it so popular. Though there [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.blog.project13.pl/wp-content/uploads/2012/04/scala_love_ruby1.png"><img class="aligncenter size-full wp-image-1500" title="scala_love_ruby" src="http://www.blog.project13.pl/wp-content/uploads/2012/04/scala_love_ruby1.png" alt="Ruby Loves Scala; Scala Loves Ruby; We all Love the JVM" width="500" height="150" /></a></p>
<h3>The JVM is awesome.</h3>
<p>But back to the topic of this post: We&#8217;ll see how you can leverage both <strong><a href="http://scala-lang.org" onclick="urchinTracker('/outgoing/scala-lang.org?referer=');">Scala</a></strong> and <strong><a href="http://jruby.org" onclick="urchinTracker('/outgoing/jruby.org?referer=');">JRuby</a></strong> <strong>in one project</strong>. Each will doing what it does best:</p>
<ul>
<li><strong>Ruby</strong> will<strong> handle the FAST frontend development</strong> as one of Ruby&#8217;s strong points is obviously<strong> Rails</strong> which made it so popular. Though there are people implementing APIs in ruby, if you need <em>pure performance</em>, you may need some other lang (vide airbreak, twitter&#8230;).</li>
<li><strong>Scala</strong> will be doing all the heavy lifting including some of our existing code which interacts with <strong>zookeeper</strong> or uses <strong><a href="http://http://akka.io/" onclick="urchinTracker('/outgoing/http_//akka.io/?referer=');">Akka</a></strong> actors to crunch some numbers.</li>
</ul>
<p>Another great point here is the reuse of our existing scala codebase which has some nice libraries we&#8217;ve implemented during our day-to-day. Anyway, let&#8217;s see some code!</p>
<h3>Start out with a plain Rails 3.2 project</h3>
<p>You know the drill. <strong>rvm, ruby, rails new.</strong> The only difference here is that we&#8217;ll use JRuby right from the start here, so:</p>
<div class="geshi no bash">
<div class="head"># get JRuby and start a new rails app</div>
<ol>
<li class="li1">
<div class="de1">rvm <span class="kw2">install</span> jruby <span class="sy0">&amp;&amp;</span> rvm use jruby</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">gem <span class="kw2">install</span> rails</div>
</li>
<li class="li1">
<div class="de1">rails new scala-on-rails</div>
</li>
</ol>
</div>
<h3>JRubify it!</h3>
<p>Next we&#8217;ll add some more dependencies to our <strong>Gemfile:</strong></p>
<div class="geshi no ruby">
<ol>
<li class="li1">
<div class="de1"><span class="co1"># jruby dependencies in Gemfile</span></div>
</li>
<li class="li1">
<div class="de1">gem <span class="st0">&#39;jruby-openssl&#39;</span> <span class="co1"># simply required</span></div>
</li>
<li class="li1">
<div class="de1">gem <span class="st0">&#39;jruby-scala&#39;</span> <span class="co1"># a jruby scala bridge</span></div>
</li>
<li class="li1">
<div class="de1">gem <span class="st0">&#39;warbler&#39;</span> <span class="co1"># to create a war file that we&#39;ll deploy layer</span></div>
</li>
</ol>
</div>
<p>Most important here is the <a href="https://github.com/wemrysi/jruby-scala" onclick="urchinTracker('/outgoing/github.com/wemrysi/jruby-scala?referer=');">jruby-scala</a> gem, which acts as a bridge to allow the use of scala constructs in ruby, more naturally. For a longre read on this check out <a href="http://www.codecommit.com/blog/ruby/integrating-scala-into-jruby" onclick="urchinTracker('/outgoing/www.codecommit.com/blog/ruby/integrating-scala-into-jruby?referer=');">Daniel Spiewak&#8217;s blogposts about it</a>.<br />
Now do the usual <strong>bundle install </strong>(be sure that you&#8217;re running jruby (!)). If you don&#8217;t want to <strong>rvm use jruby</strong>, you could also run bundler like this: <strong>jruby -S bundle install</strong>.</p>
<p>One thing I&#8217;m not covering in this blogpost is how to throw out ActiveRecord from rails. But that&#8217;s easily googlable: Just don&#8217;t require it, as shown here: <a href="http://stackoverflow.com/questions/2212709/remove-activerecord-in-rails-3" onclick="urchinTracker('/outgoing/stackoverflow.com/questions/2212709/remove-activerecord-in-rails-3?referer=');">Rails 3 without ActiveRecord</a>. Of course you CAN use active record with JRuby etc, but in my project we won&#8217;t need it, so I&#8217;m removing it.</p>
<h3>Scalify it!</h3>
<p>Ok, now that we have all the gems we need let&#8217;s proceed with putting scala into our lib/ directory. We&#8217;ll need it at runtime obviously&#8230; :-)</p>
<div class="geshi no bash">
<div class="head"># copy scala into your rails /lib directory</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw3">cd</span> lib<span class="sy0">/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">cp</span> <span class="re1">$SCALA_HOME</span><span class="sy0">/</span>lib<span class="sy0">/</span>scala-library.jar .</div>
</li>
</ol>
</div>
<p>One way to include jar dependencies into your project is by simply pasting them into the lib/ directory, so if you need some cool-java-library.jar, just drop it in there! It&#8217;ll also be automatically packaged with the app into the warfile by warbler &#8211; yay!</p>
<h3>Require &#8216;java&#8217;!</h3>
<p>Kk, now on to some code, let&#8217;s assume I have a nice &#8220;number formatter&#8221; I&#8217;d like to use in my rails app, that I&#8217;ve already implemented in some &#8220;commons&#8221; library in Scala. (Obviously that&#8217;s not the only thing from scala we&#8217;re using in our app but it&#8217;s just an example class ;-)). Here&#8217;s how we&#8217;d write our controller:</p>
<div class="geshi no ruby">
<div class="head"># app/controllers/AnyController.rb</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw3">require</span> <span class="st0">&#39;java&#39;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">require</span> <span class="st0">&#39;scala-library.jar&#39;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">require</span> <span class="st0">&#39;scala-cool-formatting.jar&#39;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1"># here&#39;s how to obtain a nice name for something in the Java namespace</span></div>
</li>
<li class="li1">
<div class="de1">PrettyOrdinalNumber = Java::pl.<span class="me1">project13</span>.<span class="me1">common</span>.<span class="kw3">format</span>.<span class="me1">PrettyOrdinalNumber</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">class</span> AnyController <span class="sy0">&lt;</span> ApplicationController</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> index</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; n = <span class="nu0">12</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; nth = PrettyOrdinalNumber.<span class="me1">new</span><span class="br0">&#40;</span>n<span class="br0">&#41;</span> <span class="co1"># the constructor in Scala actually takes a Long &#8211; but no worries about types, JRuby can handle it</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="re1">@whoa_from_scala</span> = <span class="st0">&quot;the number #{n} is the #{nth.ordinal} natural number!&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
</ol>
</div>
<p>By the way, PrettyOrdinalNumber is a trait in scala. There we use it via implicit conversions to nicely print numbers when counting servers etc ;-) A small thing but nice to have.</p>
<p>The view here is boring &#8211; we just print this one variable; So I won&#8217;t even put a code block here for it ;-)</p>
<h3><strong>Run it!</strong></h3>
<p>We still have not launched the app&#8230; Does it work at all? It does &#8211; but let&#8217;s check. The nice thing here is&#8230; You can still simply run the app via the good ol&#8217;&#8230;</p>
</pre>
<div class="geshi no bash">
<div class="head"># rails s works as you&#39;d expect it to</div>
<ol>
<li class="li1">
<div class="de1">rails s</div>
</li>
</ol>
</div>
<p>command. (Just be sure you're running JRuby.) Tests and everything just works as you'd expect it to - no worries here.</p>
<p>One thing worth mentioning here is that currently assets pipeline may not be working with JRuby (or maybe it does but I didn't care so I just generate assets before I build the war file). So you'll want to disable it in production like this (in <strong>config/enrivoments/production.rb</strong>):</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0"># Precompile assets to be included in the WAR file</span></div>
</li>
<li class="li1">
<div class="de1">config.assets.compile = <span class="kw2">true</span></div>
</li>
</ol>
</div>
<p>Then in order to pre-generate assets (compile scss -&gt; css, et cetera)  you can run:</p>
<div class="geshi no bash">
<div class="head"># precompile assets like this</div>
<ol>
<li class="li1">
<div class="de1"><span class="re2">RAILS_ENV=</span>production bundle <span class="kw3">exec</span> rake assets:precompile</div>
</li>
</ol>
</div>
<p>Which will generate all assets and throw them into <strong>public/assets/</strong>. Oh and don't panic if this takes a long time - yup, sometimes it does.</p>
<p><a href="http://www.blog.project13.pl/wp-content/uploads/2012/04/20120420-ra1nf6mdib2wbecw4ahmnn593r.png"><img src="http://www.blog.project13.pl/wp-content/uploads/2012/04/20120420-ra1nf6mdib2wbecw4ahmnn593r.png" alt="" title="20120420-ra1nf6mdib2wbecw4ahmnn593r" width="311" height="111" class="aligncenter size-full wp-image-1507" /></a></p>
<h3>Ship it!</h3>
<p>Now that we've got our app running let's see how we can make a war from it... We'll be using the (awesome) <strong>warbler </strong>gem here. So if you don't want to tweak anything, you just run:</p>
<div class="geshi no bash">
<div class="head"># let&#39;s create a WAR</div>
<ol>
<li class="li1">
<div class="de1">bundle <span class="kw3">exec</span> warbler</div>
</li>
</ol>
</div>
<p>and it'll create a war containing all your libraries from lib/ and obviously the entire rails app. (Warbler is "smart" and can detect if your project is a rails app etc). If you need more control over what warbler is including (and where) in your warfile you can run:</p>
<div class="geshi no bash">
<div class="head"># for PROs who want to configure warbler</div>
<ol>
<li class="li1">
<div class="de1">warble config</div>
</li>
</ol>
</div>
<p>Which will create a <strong>warble.rb</strong> file in <strong>conf/</strong>. I'll leave it up to you if you need more tweaking or not (you could exclude temp/ and other directories from the warfile for example).</p>
<p>So... We've got our shiny war file. How can we run it? I'll show you two ways of dealing with this, first: on Glassfish 3 (a applicationserver) and on Jetty (a small and fast servlet container).</p>
<p>So, with glassfish installed you could just:</p>
<div class="geshi no bash">
<div class="head"># deploy a jruby war file to glassfish</div>
<ol>
<li class="li1">
<div class="de1">asadmin start-domain domain1</div>
</li>
<li class="li1">
<div class="de1">asadmin deploy scala-on-rails.jar</div>
</li>
<li class="li1">
<div class="de1">chromium-browser http:<span class="sy0">//</span>localhost:<span class="nu0">8080</span><span class="sy0">/</span>scala-on-rails</div>
</li>
</ol>
</div>
<p>You may want to set it's context path to / instead of /scala-on-rails but as you can see, it started and you're running JRuby... accessing Scala code, on a normal JEE server!</p>
<p>If you prefer a smaller server, which ain't so easy to administer remotely (asadmin rocks) but is a bit smaller etc, you should check out Jetty. There is a gem that claims to run apps on jetty "just so", but it didn't work out for me. And all in all... Deploying to jetty is also just 1 line of code, so why would a need a gem for that? ;-) Here's how to deploy your war to jetty:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0"># It&#39;s that easy to deploy an app to jetty (using jetty-runner)</span></div>
</li>
<li class="li1">
<div class="de1">curl http:<span class="sy0">//</span>repo2.maven.org<span class="sy0">/</span>maven2<span class="sy0">/</span>org<span class="sy0">/</span>mortbay<span class="sy0">/</span>jetty<span class="sy0">/</span>jetty-runner<span class="sy0">/</span><span class="nu0">7.6</span><span class="nu0">.0</span>.RC5<span class="sy0">/</span>jetty-runner<span class="nu0">-7.6</span><span class="nu0">.0</span>.RC5.jar <span class="sy0">&amp;</span>gt; jetty-runner.jar</div>
</li>
<li class="li1">
<div class="de1">java -jar jetty-runner.jar scala-on-rails.war</div>
</li>
</ol>
</div>
<p>...and that's it! Look for the app on <a href="http://localhost:8080/" onclick="urchinTracker('/outgoing/localhost_8080/?referer=');">http://localhost:8080/</a></p>
<h3>Ruby &lt;3 Scala &lt;3 Java &lt;3 JVM =&gt; Best friends</h3>
<p>That's it - we've deployed our first app using JRuby and Scala libraries. Such setup is doing pretty well for us and we can gain from scala/java power inside our quickly developed rails app.</p>
<p>The only tradeoff we made here is the fact that some gems require native extensions, which won't work with JRuby. But we gained a hell lot of powerful libraries (lessening code duplication among projects in the process too!) and "1 file deployments", which are really a lot nicer than deploying rails apps (that's a personal opinion there, don't kill me ;-)).</p>
<p>That's it folks. <em><strong>All hail to the JVM and keep on hakking!</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/fun/1497/teaching-jruby-talk-with-scala-on-rails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>[FixMacOS #1] Fix jump one word back/forward in iTerm2</title>
		<link>http://www.blog.project13.pl/index.php/terminal-heroes/1492/fixmacos-1-fix-jump-by-one-backforward-word-in-iterm2/</link>
		<comments>http://www.blog.project13.pl/index.php/terminal-heroes/1492/fixmacos-1-fix-jump-by-one-backforward-word-in-iterm2/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 21:42:36 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[terminal heroes]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[macos]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1492</guid>
		<description><![CDATA[So&#8230; yeah, I&#8217;ve been using a Mac since a few months for my softwaremill &#8211; work stuff. ;-) While I still do &#8220;my stuff&#8221; mostly on my Fedora machine, right next to it, Macs have few nice things to them. One of those nice things is iTerm2 :-) One bad / weird thing I noticed [...]]]></description>
			<content:encoded><![CDATA[<p>So&#8230; yeah, I&#8217;ve been using a Mac since a few months for my <a href="http://www.softwaremill.com" target="_blank" onclick="urchinTracker('/outgoing/www.softwaremill.com?referer=');">softwaremill</a> &#8211; work stuff. ;-)<br />
While I still do &#8220;my stuff&#8221; mostly on my Fedora machine, right next to it, Macs have few nice things to them. One of those nice things is <a href="http://www.iterm2.com/" target="_blank" onclick="urchinTracker('/outgoing/www.iterm2.com/?referer=');">iTerm2</a> :-)</p>
<p>One bad / weird thing I noticed in it though was the fact it didn&#8217;t understand the &#8220;jump by word&#8221; shortcuts I&#8217;ve grown used to in the bash prompt (alt + left / alt + right).</p>
<p>Thank god today I&#8217;ve found out how to fix this: Open up iterm <strong>preferences</strong> and then go to the <strong>Keys</strong> tab and add such bindings in the global key bindings:</p>
<div style="align: center;"><img src="https://img.skitch.com/20120412-xy4xcacwmus53yjscqhy6gpdjd.png" alt="bindings" /></div>
<div style="align: center;"></div>
<div style="align: center;">So:</div>
<div style="align: center;">
<ul>
<li>ALT+LEFT set &#8220;Send escape sequence&#8221; + <strong>F</strong> (like forward)</li>
<li>ALT+RIGHT set &#8220;Send escape sequence&#8221; + <strong>B</strong> (like back)</li>
</ul>
<p>Actually, you can try this &#8220;manually&#8221;, by pressing ESC and then F or B. Yup, a bash feature. Good ol&#8217; bash would never let you down now, would it? ;-)</p>
<p>By the way, it turns out that&#8217;s also the emacs keybindings for navigating around&#8230; :-)</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/terminal-heroes/1492/fixmacos-1-fix-jump-by-one-backforward-word-in-iterm2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I&#8217;m featured @ Java Magazine</title>
		<link>http://www.blog.project13.pl/index.php/project13/1466/im-featured-java-magazine/</link>
		<comments>http://www.blog.project13.pl/index.php/project13/1466/im-featured-java-magazine/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 08:38:47 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Project13]]></category>
		<category><![CDATA[#jruby]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[konrad]]></category>
		<category><![CDATA[magazine]]></category>
		<category><![CDATA[publication]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1466</guid>
		<description><![CDATA[As Java programmers you&#8217;ve probably read the Java Magazine at least once&#8230; well, this issue is a bit special to me, as I&#8217;m featured as one of &#8220;new java developers&#8221;, or rising stars (lul? ;-)) on the title page: The article is about different young devs getting into the Java world and trying to &#8220;move [...]]]></description>
			<content:encoded><![CDATA[<p>As <strong>Java</strong> programmers you&#8217;ve probably read the <a href="http://www.oracle.com/technetwork/java/javamagazine/index.html" onclick="urchinTracker('/outgoing/www.oracle.com/technetwork/java/javamagazine/index.html?referer=');"><strong>Java Magazine</strong></a> at least once&#8230; well, this issue is a bit special to me, as I&#8217;m featured as one of &#8220;new java developers&#8221;, or rising stars (lul? ;-)) on the title page:</p>
<p>The article is about different young devs getting into the Java world and trying to &#8220;move it&#8221; (GeeCON pun intented). I for example facilitate a bunch of meetings in Poland, like Code Retreats, JUG meetings (as part of the cool <a href="http://www.java.pl" onclick="urchinTracker('/outgoing/www.java.pl?referer=');">PolishJUG</a>, or meetups like Android hackathons or reading clubs with friends: <a href="http://www.sckrk.com" onclick="urchinTracker('/outgoing/www.sckrk.com?referer=');">Software Craftsmanship Kraków</a>&#8230; There&#8217;s more, but that&#8217;s the community part of it ;-) Speaking and doing conferences is yet another long story&#8230; :-) I&#8217;m quite happy to see oracle reaching out to people and putting life back into Java communities, I mean &#8211; the JVM is far from dead at the moment, so let&#8217;s enjoy the upcoming interesting times! :-)</p>
<p><a href="http://www.blog.project13.pl/wp-content/uploads/2012/03/jm_full.png"><img src="http://www.blog.project13.pl/wp-content/uploads/2012/03/jm_full-1024x690.png" alt="" title="Konrad Malawski @ Java Magazine" width="540" class="aligncenter size-large wp-image-1474" /></a></p>
<p>I really like the word play they did using my head and the Java Magazine&#8217;s slogan on the <strong>title page</strong>, turning it from &#8220;By and for the Java Community&#8221; into &#8220;B &#8230;. the Java Community&#8221; &#8211; nicely played! :-)</p>
<p><a href="http://www.blog.project13.pl/wp-content/uploads/2012/03/jm_bw.png"><img src="http://www.blog.project13.pl/wp-content/uploads/2012/03/jm_bw-1024x738.png" alt="" title="article title page" width="540" class="aligncenter size-large wp-image-1477" /></a></p>
<p>Needless to say, I&#8217;m really proud of it and will continue to do my pest for our Java communities in Poland :-) By the way, I hope you&#8217;ve already registered for this year&#8217;s <a href="http://geecon.org/" onclick="urchinTracker('/outgoing/geecon.org/?referer=');"><strong>GeeCON</strong></a>, right? :-) We&#8217;ll have a bunch of cool stuff prepared for everyone&#8230; :-) If you want to read the whole issue you can download if for free from oracle&#8217;s site: <a href="http://www.oraclejavamagazine-digital.com/javamagazine/current" onclick="urchinTracker('/outgoing/www.oraclejavamagazine-digital.com/javamagazine/current?referer=');">http://www.oraclejavamagazine-digital.com/javamagazine/current</a>, there&#8217;s a nice article about the distruptor pattern on the last pages so you might want to take a look at the whole issue, not just the bellow image ;-)</p>
<p><a href="http://www.blog.project13.pl/wp-content/uploads/2012/03/jm_art_full.png"><img src="http://www.blog.project13.pl/wp-content/uploads/2012/03/jm_art_full-1024x742.png" alt="" title="jm_art_full" width="540" class="aligncenter size-large wp-image-1476" /></a></p>
<p>In other cool news this week: I&#8217;m currently hanging out and hacking around <em>in Mountain View, California</em>, which in turn is quite near San Francisco:</p>
<p><a href="http://www.blog.project13.pl/wp-content/uploads/2012/03/P1060141.jpg"><img src="http://www.blog.project13.pl/wp-content/uploads/2012/03/P1060141-300x168.jpg" alt="ktoso at golden gate" title="Golden Gate Bridge" width="540" class="aligncenter size-medium wp-image-1483" /></a></p>
<p>Awesome! :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/project13/1466/im-featured-java-magazine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>[Scala] Implicit Manifest tip</title>
		<link>http://www.blog.project13.pl/index.php/coding/1445/scala-implicit-manifest-tip/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1445/scala-implicit-manifest-tip/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 16:20:07 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[manifest]]></category>
		<category><![CDATA[marshalling]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1445</guid>
		<description><![CDATA[Hello again! Today I&#8217;d like to show a nice little trick you can do in Scala to make your methods look more &#8220;like Scala&#8221;, and require less typing :-) Let&#8217;s take a look at the two methods bellow: // before: val cookie = unmarshall&#40;classOf&#91;Cookie&#93;, jsonRepresentingACookie&#41; &#160; // which is the same as the bellow sample [...]]]></description>
			<content:encoded><![CDATA[<p>Hello again! Today I&#8217;d like to show a nice little trick you can do in Scala to make your methods look more &#8220;like Scala&#8221;, and require less typing :-) Let&#8217;s take a look at the two methods bellow:</p>
<div class="geshi no java">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// before:</span></div>
</li>
<li class="li1">
<div class="de1">val cookie = unmarshall<span class="br0">&#40;</span>classOf<span class="br0">&#91;</span>Cookie<span class="br0">&#93;</span>, jsonRepresentingACookie<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// which is the same as the bellow sample in Java</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Cookie cookie = unmarshall(Cookie.class, jsonRepresentingACookie)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// after:</span></div>
</li>
<li class="li1">
<div class="de1">val cookie = unmarshall<span class="br0">&#91;</span>Cookie<span class="br0">&#93;</span><span class="br0">&#40;</span>jsonRepresentingACookie<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// which would look like this in Java:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Cookie cookie = unmarshall&lt;cookie&gt;(json) // NOT enough&lt;/cookie&gt;</span></div>
</li>
</ol>
</div>
<p>In our example we&#8217;ll want to unmarshall a Cookie object from it&#8217;s string representation, a pretty typical task. In order to do that (for example with JAX-B), we&#8217;ll need a Class object we can pass to the deserializer &#8211; so it can work all the field mappings etc. Obviously the second example in Java just isn&#8217;t enough &#8211; we need the Class object, and just using &lt;Cookie&gt; isn&#8217;t enough to retain this type information. Scala obviously suffers from the exact same problem as it&#8217;s a JVM issue (type erasure, grrr!).</p>
<p>But even so, the above Scala code will work fine if we do some tricks in the method definition. We&#8217;ll resort to using: </p>
<ul>
<li> a second (implicit) argument list</li>
<li> Manifest[T]</li>
</ul>
<p>That&#8217;s a bunch of scary looking terms, but it&#8217;s actually quite easy. Let&#8217;s take a look at the definition of the Scala version of unmarshall.<br />
</p>
<div class="geshi no java">
<ol>
<li class="li1">
<div class="de1">def unmarshal<span class="br0">&#91;</span>T<span class="br0">&#93;</span><span class="br0">&#40;</span>str: <span class="kw3">String</span><span class="br0">&#41;</span><span class="br0">&#40;</span>implicit manifest: <span class="kw3">Manifest</span><span class="br0">&#91;</span>T<span class="br0">&#93;</span><span class="br0">&#41;</span>: T = <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; val unmarshaller = createUnmarshaller<span class="br0">&#40;</span>manifest.<span class="me1">erasure</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; unmarshal<span class="br0">&#40;</span>str, unmarshaller<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>First, let&#8217;s analyze the signature of this method. Obviously it&#8217;s parameterized method, thus we need the [T] in front of it. Next is the argument list, with just one argument &#8211; str, the string representation we want to unmarshall &#8211; easy. Now for the more fun part &#8211; the <strong>second argument list</strong>. Yeah, you can have multiple argument lists in Scala. &#8220;Why?&#8221;, you ask? For example in our case the second list is implicit &#8211; this means that the compiler will figure out and try to fill in these arguments with matching types it finds in scope. In the case of supplying a Manifest[T] it&#8217;s fairly easy &#8211; it will just create the manifest based on the T type, during runtime at the call site of the method, and pass it into unmarshall.</p>
<p>A Manifest[T] can be thought of like a &#8220;better&#8221; a Class[_] which contains full type information &#8211; so for example we wouldn&#8217;t loose the information contained in a List&lt;Cookie&gt; like we would with plain Java (where we would have to hack around this JVM issue via a <a href="http://google-gson.googlecode.com/svn/tags/1.1.1/docs/javadocs/com/google/gson/reflect/TypeToken.html" title="Google Gson TypeToken" target="_blank" onclick="urchinTracker('/outgoing/google-gson.googlecode.com/svn/tags/1.1.1/docs/javadocs/com/google/gson/reflect/TypeToken.html?referer=');">TypeToken</a>). Anyway, thanks to the Manifest we&#8217;re able to get the Class we need to get our unmarshalling done! <strong>Manifest.erasure</strong> contains the type we need. If you want to read more about Manifest, the <a href="http://www.scala-lang.org/api/current/scala/reflect/Manifest.html" onclick="urchinTracker('/outgoing/www.scala-lang.org/api/current/scala/reflect/Manifest.html?referer=');">ScalaDoc</a> about it does a really nice job explaining how to use it.</p>
<p>&#8212; EXTRA for Scala Geeks &#8212; </p>
<p>You may have noticed the word &#8220;<strong>implicitly</strong>&#8221; appearing from time to time in Scala discussions. It&#8217;s a shorthand for accessing shorthand passed implicits. Let me explain this on our example &#8211; so instead of the code above we could do the following (which does the same thing):</p>
<div class="geshi no java">
<ol>
<li class="li1">
<div class="de1">def unmarshal<span class="br0">&#91;</span>T: <span class="kw3">Manifest</span><span class="br0">&#93;</span><span class="br0">&#40;</span>str: <span class="kw3">String</span><span class="br0">&#41;</span>: T = <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; val unmarshaller = createUnmarshaller<span class="br0">&#40;</span>implicitly<span class="br0">&#91;</span><span class="kw3">Manifest</span><span class="br0">&#91;</span>T<span class="br0">&#93;</span><span class="br0">&#93;</span>.<span class="me1">erasure</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; unmarshal<span class="br0">&#40;</span>str, unmarshaller<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// and a quick Repl check if it really does what we think it should:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// scala&gt; def unmarshal[T: Manifest](str: String) = {</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; &nbsp; &nbsp;| implicitly[Manifest[T]].erasure</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; &nbsp; &nbsp;| }</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// unmarshal: [T](str: String)(implicit evidence$1: Manifest[T])java.lang.Class[_]</span></div>
</li>
</ol>
</div>
<p>So instead of creating a second argument list we say that the Type parameter T will be used as a Manifest. And then we can access it via the implicitly magic method. This approach has been made possible since Scala 2.8, due to how often the above pattern was discovered in real life code.<br />
Anyway &#8211; it&#8217;s up to you which version you like the most.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1445/scala-implicit-manifest-tip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Scala SBT and Test Dependencies</title>
		<link>http://www.blog.project13.pl/index.php/coding/1434/scala-sbt-and-test-dependencies/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1434/scala-sbt-and-test-dependencies/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 23:00:39 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[#maven]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[project management]]></category>
		<category><![CDATA[sbt]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1434</guid>
		<description><![CDATA[Remember the ol&#8217; days with Maven where you had to create a project for just about anything if you wanted to keep your depencencies clean and separated? We&#8217;ve encountered such a problem with a current project, and started to tackle it &#8220;the maven way&#8221;. It wasn&#8217;t too long that we&#8217;ve realized that we&#8217;re in scala [...]]]></description>
			<content:encoded><![CDATA[<p>Remember the ol&#8217; days with <strong>Maven</strong> where you had to create a project for just about anything if you wanted to keep your depencencies clean and separated? We&#8217;ve encountered such a problem with a current project, and started to tackle it &#8220;the maven way&#8221;. It wasn&#8217;t too long that we&#8217;ve realized that we&#8217;re in scala world now and things should have been fixed or made possible quite some time ago&#8230; :-)</p>
<p>The case is this: We have a common configuration (a bunch of <strong>scala objects</strong>) and some helper framework to help us in writing unit tests that integrate with the model. And then there&#8217;s the model obviously. If you&#8217;d like to allow people to use this test scoped helper framework, if should be in another project (which using maven conventions would usually be called something like &#8220;model-testing&#8221;) and it would be used as a dependency in the maven project which wanted to test some model related behaviours. The problem with maven here is that it would require us to put those helpers into a new project, and also&#8230; put the configuration scala objects into another projects &#8211; as they&#8217;d need to be shared among the <strong>helper utils</strong>, the model and all projects using both of them (the details about &#8220;why?&#8221; are a bit specific to the project, but depending on how it&#8217;s structured and how it should work that would be the way to go with maven).</p>
<p>Thank goodness we weren&#8217;t unaware of the excticing strengths that sbtr gives us, and instead of creating multiple projects we were able to got away with just exposing the test sources as classpath dependencies for the projects which would need the model. This can be done via:</p>
<div class="geshi no scala">
<div class="head">// in projects/Build.scala</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">object TheProjectBuild extends Build {
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; import Dependencies._
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; import BuildSettings._
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; lazy val iUseTheModel: Project = Project(
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &quot;i-use-the-model&quot;,
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; file(&quot;i-use-the-model&quot;),
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; settings = buildSettings ++
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; Seq(libraryDependencies ++= Seq(/*deps*/)
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; ) dependsOn(model % &quot;compile-&gt;compile;test-&gt;test&quot;)
</div>
</li>
<li class="li1">
<div class="de1">}</div>
</li>
</ol>
</div>
<p>All the magic is in the second-to-last line. It&#8217;s something <strong>sbt</strong> calls &#8220;<strong><a title="per-configuration classpath dependencies" href="https://github.com/harrah/xsbt/wiki/Getting-Started-Multi-Project" onclick="urchinTracker('/outgoing/github.com/harrah/xsbt/wiki/Getting-Started-Multi-Project?referer=');">per-configuration classpath dependencies</a></strong>&#8220;. And if explained in layman terms means &#8220;<em>i want the classpath used in the lefthand project in the scope X to be used in the right hand project in scope Y</em>&#8220;. So in our example we define that we depend on the model project (a Project instance), and declare that it&#8217;s compile classpath should be included in OUR compile classpath, and it&#8217;s test classpath should be included in our test classpath. You could do the same with &#8220;it&#8221; (for integration tests) for example&#8230; or for any other (so called) &#8220;Configuration&#8221; defined within <strong>sbt</strong>.</p>
<p>Using this we were able to avoid creating a &#8220;bazzilion&#8221; (a number which you can&#8217;t count to) of projects to achieve a simple goal &#8211; share test helpers. I&#8217;m getting more and more excicted about Scala and it&#8217;s tooling. As you can see <strong>SBT</strong> enables you to do some quite expressive and powerful things which would be impossible to do in maven for example. If there is any downside to <strong>SBT</strong> then it&#8217;s that the documentation is a bit chaotic, but the guys are really working on that, so I&#8217;m full of hope and optimism about it. :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1434/scala-sbt-and-test-dependencies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>[conference] Deep Dive Into RoboGuice @ Cracow.Mobi</title>
		<link>http://www.blog.project13.pl/index.php/project13/1389/conference-deep-dive-into-roboguice-cracow-mobi/</link>
		<comments>http://www.blog.project13.pl/index.php/project13/1389/conference-deep-dive-into-roboguice-cracow-mobi/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 00:12:54 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[polish]]></category>
		<category><![CDATA[Project13]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[di]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[guice]]></category>
		<category><![CDATA[ioc]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jsr330]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[slides]]></category>
		<category><![CDATA[tweets]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1389</guid>
		<description><![CDATA[Today I have presented yet another *new* Android Talk at the Cracow.Mobi conference. This time I focused on RoboGuice, and Guice in general. As from what I&#8217;ve seen a lot of android apps still get written without dependency injection &#8211; which saddens me &#8211; static global variables or weird helpers still come up in apps [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cracow.mobi" onclick="urchinTracker('/outgoing/www.cracow.mobi?referer=');"><img class="alignright size-medium wp-image-1413" style="background: white; padding: 5px; margin: 5px;" title="logo" src="http://www.blog.project13.pl/wp-content/uploads/2011/12/logo-300x107.png" alt="" width="150" height="70" /></a><br />
Today I have presented yet another *new* <strong>Android</strong> Talk at the <a href="http://cracow.mobi" onclick="urchinTracker('/outgoing/cracow.mobi?referer=');">Cracow.Mobi</a> conference. This time I focused on <a href="http://code.google.com/p/roboguice/" onclick="urchinTracker('/outgoing/code.google.com/p/roboguice/?referer=');"><strong>RoboGuice</strong></a>, and Guice in general.</p>
<p>As from what I&#8217;ve seen a lot of android apps still get written without dependency injection &#8211; which saddens me &#8211; static global variables or weird helpers still come up in apps I do security / performance / code quality audits for &#8211; so I thought that&#8217;s something I need to teach the general audience.</p>
<p>The conference is a 2 day event. Organized by 2 students from Politechnika Krakowska (and a few of their helpers of course), and it&#8217;s a free event. We, as <a href="http://www.llp.pl" onclick="urchinTracker('/outgoing/www.llp.pl?referer=');">Lunar Logic Polska</a>, were proud to be one of the main sponsors of the event. I also personally helped out with a few tips etc, as part of the <a href="http://www.java.pl" onclick="urchinTracker('/outgoing/www.java.pl?referer=');">PolishJUG</a> and <a href="http://krakow.gtug.pl" onclick="urchinTracker('/outgoing/krakow.gtug.pl?referer=');">KrakówGTUG</a>. We also got some swag from the polish Google office which was a really nice gesture from them&#8230; :-) <em>But back to the presentation! Here it is:</em></p>
<p><iframe id="android-conference-deep-dive" src="http://www.blog.project13.pl/wp-content/uploads/2011/12/presentation.html" width="100%" height="450"></iframe></p>
<p><script type="text/javascript">// < ![CDATA[
// < ![CDATA[
// < ![CDATA[
(function() {
function resizeMe(){
   var iFrame =  document.getElementById('android-conference-deep-dive');
   var iFrameBody;
   if ( iFrame.contentDocument ) 
   { // FF
     iFrameBody = iFrame.contentDocument.getElementsByTagName('body')[0];
   }
   else if ( iFrame.contentWindow ) 
   { // IE
     iFrameBody = iFrame.contentWindow.document.getElementsByTagName('body')[0];
   }
 iFrameBody.style.cssText = "zoom: 0.5; -moz-transform: scale(0.5); -moz-transform-origin: 0 0;"
 }
resizeMe();
setTimeout(resizeMe, 500);
})();
// ]]&gt;</script></p>
<p><strong>You can actually use RIGHT/LEFT and H controls in the above iframe to go through the presentation!</strong> <a title="Sources for it are available on my github" href="https://github.com/ktoso/cracow-mobi-android-di" target="_blank" onclick="urchinTracker('/outgoing/github.com/ktoso/cracow-mobi-android-di?referer=');">Sources for it are available on my github</a>.</p>
<p><a href="http://www.blog.project13.pl/wp-content/uploads/2011/12/awesome_tweet_thanks.png"><img class="aligncenter size-medium wp-image-1421" title="awesome_tweet_thanks" src="http://www.blog.project13.pl/wp-content/uploads/2011/12/awesome_tweet_thanks-300x122.png" alt="" width="400" /></a></p>
<p>From the audiences response etc, it seems that this one has been the cleanest, in the sense of &#8220;most fluent&#8221; presentation I&#8217;ve done up until today. I&#8217;ve also went into the code and showed off some minor details. <em>In <a href="http://www.jetbrains.com/idea/" onclick="urchinTracker('/outgoing/www.jetbrains.com/idea/?referer=');">Intellij IDEA 11</a> of course &#8211; be sure to check it out if you&#8217;re an Android (or any kind of) developer! The productivity boost it gives you is &#8220;zomg wooot!&#8221; ;-)</em></p>
<p>I also really enjoyed the talks I was able to attend, and met some old (and possibly quite a few new?) friends. Hope to see you all again!</p>
<p><strong>UPDATE!</strong></p>
<p>This post has been awesomely mentioned by @roboguice :-)</p>
<p><a href="http://www.blog.project13.pl/wp-content/uploads/2011/12/roboguice_cool_tweet.png"><img class="aligncenter size-medium wp-image-1429" title="roboguice_cool_tweet" src="http://www.blog.project13.pl/wp-content/uploads/2011/12/roboguice_cool_tweet-300x135.png" alt="" width="400" /></a></p>
<p><strong>UPDATE 2!</strong></p>
<p>An awesome insider tip from within LLP I recieved today:</p>
<blockquote><p>One guy told me that he was on an Android presentation by some long-haired guy and that it was really good, way better than the rest ;)</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/project13/1389/conference-deep-dive-into-roboguice-cracow-mobi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

