<?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>Japko</title>
	<atom:link href="http://www.japko.net/blog/lang/en/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.japko.net/blog</link>
	<description>Trochę o japkach, trochę o czymś innym</description>
	<lastBuildDate>Mon, 30 Jan 2012 11:53:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Gadu-Gadu scanning URL addresses</title>
		<link>http://www.japko.net/blog/lang/en/2012/01/30/gadu-gadu-skanuje-urle</link>
		<comments>http://www.japko.net/blog/lang/en/2012/01/30/gadu-gadu-skanuje-urle#comments</comments>
		<pubDate>Mon, 30 Jan 2012 11:48:23 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[Wszystko inne]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=323</guid>
		<description><![CDATA[Apparently, Gadu-Gadu, most popular polish communicator is scanning URL addresses sent in chat window.]]></description>
			<content:encoded><![CDATA[<p>Apparently, Gadu-Gadu, most popular polish communicator is scanning URL addresses sent in chat window.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2012/01/30/gadu-gadu-skanuje-urle/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Environment independent WAR in Grails</title>
		<link>http://www.japko.net/blog/lang/en/2011/07/21/environment-independent-war-in-grails</link>
		<comments>http://www.japko.net/blog/lang/en/2011/07/21/environment-independent-war-in-grails#comments</comments>
		<pubDate>Thu, 21 Jul 2011 12:30:57 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=276</guid>
		<description><![CDATA[Sometimes I like to break out of Grails convention of building separate WAR archives for each environment. I guess that typical Grails application is developed with development profile and when code is ready it is pushed straight to the production. Unfortunately, that is not the case in corporate environment Common choice of environments I see everyday [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I like to break out of Grails convention of building separate WAR archives for each environment. I guess that typical Grails application is developed with development profile and when code is ready it is pushed straight to the production. Unfortunately, that is not the case in corporate environment <img src='http://www.japko.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Common choice of environments I see everyday is development, integration, certification (or staging) and production. Possibilities are almost endless, and depend on creativity of  your enterprise architects <img src='http://www.japko.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Suppose we want adapt light web framework to heavyweight corporate standards:</p>
<p>Adding custom environment is simple. Open <strong>Config.groovy</strong> and add new section id Grails' DSL:</p>
<pre class="groovy">environments <span style="color: #66cc66;">&#123;</span>
    production <span style="color: #66cc66;">&#123;</span>
        grails.<span style="color: #006600;">serverURL</span> = <span style="color: #ff0000;">&quot;http://localhost:8080/${appName}&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
    staging <span style="color: #66cc66;">&#123;</span>
        grails.<span style="color: #006600;">serverURL</span> = <span style="color: #ff0000;">&quot;http://localhost:8080/${appName}&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
    development <span style="color: #66cc66;">&#123;</span>
        grails.<span style="color: #006600;">serverURL</span> = <span style="color: #ff0000;">&quot;http://localhost:8080/${appName}&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
    test <span style="color: #66cc66;">&#123;</span>
        grails.<span style="color: #006600;">serverURL</span> = <span style="color: #ff0000;">&quot;http://localhost:8080/${appName}&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>You can do exactly the same thing in <strong>DataSource.groovy</strong> and add database url for new enviroment:</p>
<pre class="groovy">environments <span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">//    ...</span>
&nbsp;
    integration <span style="color: #66cc66;">&#123;</span>
        dataSource <span style="color: #66cc66;">&#123;</span>
            dbCreate = <span style="color: #ff0000;">&quot;update&quot;</span>
            url = <span style="color: #ff0000;">&quot;jdbc:hsqldb:file:intDb;shutdown=true&quot;</span>
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>Finallly, run grails application with usual command line option:</p>
<pre>grails -Dgrails.env=integration run-app</pre>
<p>or, even better, add this command line switch to your favorite servlet container environment options.</p>
<h2>I want more</h2>
<p>Adding custom environment with just another database setting is trivial use case. You may want to have additional per-environment configuration settings, different for each environment. For example, while developing eBay auction sniper, you would like to publish production like instance, but connecting to "sandbox" API. Thanks to Grails' flexibility it is plain simple. Go back to Config.groovy and add anything you with to environment blocks:</p>
<pre class="groovy">environments <span style="color: #66cc66;">&#123;</span>
    production <span style="color: #66cc66;">&#123;</span>
        grails.<span style="color: #006600;">serverURL</span> = <span style="color: #ff0000;">&quot;http://localhost:8080/${appName}&quot;</span>
        ebay.<span style="color: #006600;">url</span> = <span style="color: #ff0000;">&quot;http://open.api.ebay.com/&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
    staging <span style="color: #66cc66;">&#123;</span>
        grails.<span style="color: #006600;">serverURL</span> = <span style="color: #ff0000;">&quot;http://localhost:8080/${appName}&quot;</span>
        ebay.<span style="color: #006600;">url</span> = <span style="color: #ff0000;">&quot;https://api.sandbox.ebay.com/&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
    development <span style="color: #66cc66;">&#123;</span>
        grails.<span style="color: #006600;">serverURL</span> = <span style="color: #ff0000;">&quot;http://localhost:8080/${appName}&quot;</span>
        ebay.<span style="color: #006600;">url</span> = <span style="color: #ff0000;">&quot;https://api.sandbox.ebay.com/&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
    test <span style="color: #66cc66;">&#123;</span>
        grails.<span style="color: #006600;">serverURL</span> = <span style="color: #ff0000;">&quot;http://localhost:8080/${appName}&quot;</span>
        ebay.<span style="color: #006600;">url</span> = <span style="color: #ff0000;">&quot;https://api.sandbox.ebay.com/&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>You can access variables defined inside braces via ConfigurationHolder singleton:</p>
<pre class="groovy">ConfigurationHolder.<span style="color: #006600;">config</span>.<span style="color: #006600;">ebay</span>.<span style="color: #006600;">url</span></pre>
<h2>Telling current configuration from code</h2>
<p>You may want to show running environment name somewhere on page, to make sure application your testers are playing with is not connected to production ebay environment <img src='http://www.japko.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Grails offers a way to obtain current running configuration:</p>
<pre class="groovy"><a href="http://www.google.de/search?as_q=Environment&num=100&hl=en&as_occt=url&as_sitesearch=java.sun.com%2Fj2se%2F1.5.0%2Fdocs%2Fapi%2F" class="liexternal"><span style="color: #aaaadd; font-weight: bold;">Environment</span></a>.<span style="color: #006600;">getCurrent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></pre>
<p>Environment is actually enum type and <em>getCurrent() </em>returns value for current configuration. There is one catch: this is enum, so it lists only factory-defined configurations: <em>PRODUCTION</em>, <em>DEVELOPMENT</em>, <em>TEST</em>, and for everything else: <em>CUSTOM</em>. Casting this enum to string will effectively return "CUSTOM" for all custom configuration. However, if you make call like this one:</p>
<pre class="groovy"><a href="http://www.google.de/search?as_q=Environment&num=100&hl=en&as_occt=url&as_sitesearch=java.sun.com%2Fj2se%2F1.5.0%2Fdocs%2Fapi%2F" class="liexternal"><span style="color: #aaaadd; font-weight: bold;">Environment</span></a>.<span style="color: #006600;">getCurrent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></pre>
<p>You will find that <em>getCurrent()</em> method is smart enough to alter CUSTOM enum's name property and set it to right value.</p>
<p>This is why people love Grails: it is simple, yet flexible. Have fun!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2011/07/21/environment-independent-war-in-grails/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Phocus! iPhone app update</title>
		<link>http://www.japko.net/blog/lang/en/2011/06/28/phocus-iphone-app-update</link>
		<comments>http://www.japko.net/blog/lang/en/2011/06/28/phocus-iphone-app-update#comments</comments>
		<pubDate>Tue, 28 Jun 2011 20:27:40 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[Wszystko inne]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=291</guid>
		<description><![CDATA[Caution: if you are not a photographer, or your understanding of photography is taking pictures of kids or girlfriend with compact or phone camera - don't worry text below is beyond of your understanding. I'm happy to annouce update of my little Phocus! app. Version 1.1 brings a cool new feature: calculating optimal aperture and [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Caution:</strong> if you are not a photographer, or your understanding of photography is taking pictures of kids or girlfriend with compact or phone camera - don't worry text below is beyond of your understanding.</p>
<p>I'm happy to annouce update of my little <a href="http://itunes.apple.com/us/app/phocus/id386478043?mt=8" class="liexternal">Phocus!</a> app. Version 1.1 brings a cool new feature: calculating optimal aperture and focus point to achieve given depth of field. Everything else (including delicious UI <img src='http://www.japko.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  is left unchanged.</p>
<ul>
<li><a href="http://itunes.apple.com/app/phocus/id386478043?mt=8" class="liexternal">Phocus in App Store</a></li>
<li><a href="http://www.japko.net/phocus/" target="_blank" class="liinternal">Phocus! website.</a></li>
</ul>
<div id="attachment_294" class="wp-caption alignleft" style="width: 210px"><a href="http://www.japko.net/blog/wp-content/uploads/2011/06/phocus-adep.png" class="liimagelink"><img class="size-medium wp-image-294" title="Phocus! Depth of field priority." src="http://www.japko.net/blog/wp-content/uploads/2011/06/phocus-adep-200x300.png" alt="" width="200" height="300" /></a><p class="wp-caption-text">Phocus! Depth of field priority.</p></div>
<div id="attachment_292" class="wp-caption alignleft" style="width: 210px"><a href="http://www.japko.net/blog/wp-content/uploads/2011/06/phocus-dof.png" class="liimagelink"><img class="size-medium wp-image-292" title="Phocus! Depth of field" src="http://www.japko.net/blog/wp-content/uploads/2011/06/phocus-dof-200x300.png" alt="" width="200" height="300" /></a><p class="wp-caption-text">Phocus! Depth of field</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2011/06/28/phocus-iphone-app-update/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove untracked files in Mercurial</title>
		<link>http://www.japko.net/blog/lang/en/2011/06/02/remove-untracked-files-in-mercurial</link>
		<comments>http://www.japko.net/blog/lang/en/2011/06/02/remove-untracked-files-in-mercurial#comments</comments>
		<pubDate>Thu, 02 Jun 2011 21:22:19 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[dvcs]]></category>
		<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=280</guid>
		<description><![CDATA[It happens after wild act of creation that we notice we went wrong way. Quick decision is made: "go back and start over". With VCS it is plain simple, just type hg revert and you're at home. Almost. Unsurprisingly, hg revert reverts only modifications and leaves new files intact. There is simple solution for that: [...]]]></description>
			<content:encoded><![CDATA[<p>It happens after wild act of creation that we notice we went wrong way. Quick decision is made: "go back and start over". With VCS it is plain simple, just type hg revert and you're at home. Almost. Unsurprisingly, hg revert reverts only modifications and leaves new files intact.</p>
<p>There is simple solution for that: and <a href="http://www.japko.net/blog/2010/12/23/add-some-color-to-mercurial/" title="Barwniejszy Mercurial|Add some color to Mercurial" target="_blank" class="liinternal">there's again</a> nice, but obscure feature that is included in the box, but just not activated. Let's edit the .hgrc in your home directory, and make sure there is something like this:</p>
<pre>[extensions]
purge =</pre>
<p>and once it is, just type</p>
<pre>hg purge</pre>
<p>to send unwanted files to /dev/null.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2011/06/02/remove-untracked-files-in-mercurial/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextMate pro tip for weird paging behaviour</title>
		<link>http://www.japko.net/blog/lang/en/2011/05/17/textmate-pro-tip-for-weird-paging-behaviour</link>
		<comments>http://www.japko.net/blog/lang/en/2011/05/17/textmate-pro-tip-for-weird-paging-behaviour#comments</comments>
		<pubDate>Tue, 17 May 2011 22:45:16 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[Wszystko inne]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=268</guid>
		<description><![CDATA[For some time one small thing bothered me in TextMate: extremely weird behaviour of PageUp and PageDown. Basically it was not deterministic Quick googling pointed me to the solution, the guilty one is Apple's smooth scrolling feature, which, thankfully, is easy to disable in TextMate while leaving it active for other apps. Just key in [...]]]></description>
			<content:encoded><![CDATA[<p>For some time one small thing bothered me in TextMate: extremely weird behaviour of PageUp and PageDown. Basically it was not deterministic <img src='http://www.japko.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Quick googling pointed me to the solution, the guilty one is Apple's smooth scrolling feature, which, thankfully, is easy to disable in TextMate while leaving it active for other apps.</p>
<p>Just key in a magical command:</p>
<pre>defaults write com.macromates.textmate AppleScrollAnimationEnabled -bool NO</pre>
<p>And scrolling is back sraight!</p>
<p>[via <a href="http://lists.macromates.com/textmate/2011-January/032098.html" target="_blank" class="liexternal">http://lists.macromates.com/textmate/2011-January/032098.html</a>]</p>
<p>&nbsp;</p>

]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2011/05/17/textmate-pro-tip-for-weird-paging-behaviour/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Have a CIDR</title>
		<link>http://www.japko.net/blog/lang/en/2011/04/05/cidr-jablkowy-na-zdrowie-have-a-cidr</link>
		<comments>http://www.japko.net/blog/lang/en/2011/04/05/cidr-jablkowy-na-zdrowie-have-a-cidr#comments</comments>
		<pubDate>Tue, 05 Apr 2011 22:09:41 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[Wszystko inne]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=261</guid>
		<description><![CDATA[Java developers are constantly being indulged by state of the art development tools. Even free tools provide tools that dramatically increase productivity, and if you are willing to spend some $$$, you can get even more. JetBrains annouced their plans to develop IDE for Objective-C, and now, wait is over. It's still an EAP, but [...]]]></description>
			<content:encoded><![CDATA[<p>Java developers are constantly being indulged by state of the art development tools. Even <a href="http://www.netbeans.org/" target="_blank" class="liexternal">free</a> <a href="http://www.eclipse.org/" target="_blank" class="liexternal">tools</a> provide tools that dramatically increase productivity, and if you are willing to spend some $$$, you can <a href="http://www.jetbrains.com/" target="_blank" class="liexternal">get even more</a>. JetBrains annouced their plans to develop IDE for Objective-C, and now, wait is over.</p>
<p>It's still an EAP, but it is quite impressive. It fills the gaps in places I missed so much: refactoring, quick fixes, and on-the-fly code analysis. I played with it just a little, but definitely:</p>
<ul>
<li>rename works</li>
<li>extract method works</li>
<li>change method signature works</li>
<li>@class and #import is added automatically when class is used</li>
<li>you can generate ivars and @properties</li>
</ul>
<p>and many more. Great job, JetBrains!</p>
<p>I only wish Apple not making some stupid decision about banning or blocking other IDEs. I hope I'm paranoid in that case.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2011/04/05/cidr-jablkowy-na-zdrowie-have-a-cidr/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy JSON pretty-print</title>
		<link>http://www.japko.net/blog/lang/en/2011/04/02/easy-json-pretty-print</link>
		<comments>http://www.japko.net/blog/lang/en/2011/04/02/easy-json-pretty-print#comments</comments>
		<pubDate>Sat, 02 Apr 2011 10:41:03 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=247</guid>
		<description><![CDATA[It turns out that pretty-printing any give JSON data is dead simple if you have Python by hand. On decent OSes you get Python interpreter right out-of-the box. For the less decent ones, you can download distribution. Once you got it, just filter it through simple python interpretter invocation, like: echo '{ &#34;Japko.net&#34; : &#34;Rulez&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>It turns out that pretty-printing any give JSON data is dead simple if you have <a href="http://docs.python.org/library/json.html" class="liexternal">Python</a> by hand. On decent OSes you get Python interpreter right out-of-the box. For the less decent ones, you can <a href="http://www.python.org/download/" target="_blank" class="liexternal">download distribution</a>. Once you got it, just filter it through simple python interpretter invocation, like:</p>
<pre class="bash"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'{ &quot;Japko.net&quot; : &quot;Rulez&quot; }'</span> | python -mjson.tool</pre>

]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2011/04/02/easy-json-pretty-print/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add some color to Mercurial</title>
		<link>http://www.japko.net/blog/lang/en/2010/12/23/add-some-color-to-mercurial</link>
		<comments>http://www.japko.net/blog/lang/en/2010/12/23/add-some-color-to-mercurial#comments</comments>
		<pubDate>Thu, 23 Dec 2010 00:06:16 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[dvcs]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=231</guid>
		<description><![CDATA[I do use command line regularly, especially on OSes which command line does not suck (read OS X, Linux and friends). By default, Mercurial looks a bit boring, but by just adding a few lines to configuration file, Mercurial may explode with colors. Let's open .hgrc with our favorite editor: vim ~/.hgrc And add some [...]]]></description>
			<content:encoded><![CDATA[<p>I do use command line regularly, especially on OSes which command line does not suck (read OS X, Linux and friends). By default, Mercurial looks a bit boring, but by just adding a few lines to configuration file, Mercurial may explode with colors. Let's open <strong>.hgrc</strong> with our favorite editor:</p>
<pre class="bash">vim ~/.hgrc</pre>
<p>And add some magical lines:</p>
<pre class="ini"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>extensions<span style="">&#93;</span></span>
color =
highlight =
graphlog =</pre>
<p>color and highlight enable colored output of diff and stat. graphlog adds new command, glog, which will just try to draw revision graph using ASCII-art alongside with normal log output. There's a lot of <a href="http://mercurial.selenic.com/wiki/UsingExtensions" class="liexternal">extensions to be discovered</a>, I just started with bringing some life to dull default interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2010/12/23/add-some-color-to-mercurial/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No calendar API on Android?</title>
		<link>http://www.japko.net/blog/lang/en/2010/12/09/no-calendar-api-on-android</link>
		<comments>http://www.japko.net/blog/lang/en/2010/12/09/no-calendar-api-on-android#comments</comments>
		<pubDate>Thu, 09 Dec 2010 10:00:41 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[android]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=223</guid>
		<description><![CDATA[So much is spoken about Android's "openess" versus iPhone being close, proprietrary and very bad at all. And "open" is not always the same "open" you may think of. Today I've come to surprising discovery: there is no API to access calendar in Android SDK. What? Even iOS has this (well... right, it was added [...]]]></description>
			<content:encoded><![CDATA[<p>So much is spoken about Android's "<em>openess</em>" versus iPhone being close, proprietrary and very bad at all. And "<em>open</em>" is not always the same "<em>open</em>" you may think of. Today I've come to surprising discovery: there is no API to access calendar in Android SDK. What? Even iOS has this (well... right, it was added in iOS 4.0). Of course you can access cloud-based <a href="http://samples.google-api-java-client.googlecode.com/hg/calendar-v2-atom-android-sample/instructions.html?r=default" class="liexternal">Google Calendar Data</a>. Anyway, Google is not a charity. They do want you to work in cloud and have good reason for that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2010/12/09/no-calendar-api-on-android/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Coding WTF</title>
		<link>http://www.japko.net/blog/lang/en/2010/12/05/iphone-coding-wtf</link>
		<comments>http://www.japko.net/blog/lang/en/2010/12/05/iphone-coding-wtf#comments</comments>
		<pubDate>Sun, 05 Dec 2010 15:48:28 +0000</pubDate>
		<dc:creator>Tomek</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://www.japko.net/blog/?p=206</guid>
		<description><![CDATA[I was asked to code some enhancements to existing iPhone app. I was told it suffered from a lot of bugs leading to crashes and even twice rejection by App Store review team. I was preparing for, quoting last words of Kurtz: "The horror! The horror!". Unfortunately it came true. Obvious truth has been proved once [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked to code some enhancements to existing iPhone app. I was told it suffered from a lot of bugs leading to crashes and even twice rejection by App Store review team. I was preparing for, quoting last words of Kurtz: <em>"The horror! The horror!"</em>.</p>
<p>Unfortunately it came true. Obvious truth has been proved once more: you may know the programming language, and even API, but software design is left behind. Main app controller class was almost 3000 lines long, and below you can find one of my favorite pieces.</p>
<p>The morale is short and simple: stop thinking in Turbo Pascal. Objective-C, as name suggests is object-oriented language, so for God's sake, use it!</p>
<p>Masterpiece example is to be seen below...</p>
<p><span id="more-206"></span></p>
<pre class="objc"><span style="color: #0000ff;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #0000ff;">int</span> i=<span style="color: #0000dd;">0</span>; i&amp;lt;<span style="color: #0000dd;">8</span>; i++<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
   <span style="color: #ff0000;">// ... (few lines omited)</span>
&nbsp;
<span style="color: #0000ff;">switch</span> <span style="color: #002200;">&#40;</span>i<span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
  <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">0</span>:
  <span style="color: #002200;">&#123;</span>
    btn.tag = <span style="color: #0000dd;">0</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>_selectedDay != <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #0000ff;">int</span> ab = <span style="color: #0000dd;">60</span> * <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;hour&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span> +
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;minute&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span>;
      <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>ab == <span style="color: #0000dd;">0</span><span style="color: #002200;">&#41;</span> btn.selected = YES;
    <span style="color: #002200;">&#125;</span>
  <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">break</span>;
  <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">1</span>:
  <span style="color: #002200;">&#123;</span>
    btn.tag = <span style="color: #0000dd;">5</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>_selectedDay != <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #0000ff;">int</span> ab = <span style="color: #0000dd;">60</span> * <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;hour&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span> +
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;minute&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span>;
      <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>ab == <span style="color: #0000dd;">5</span><span style="color: #002200;">&#41;</span> btn.selected = YES;
    <span style="color: #002200;">&#125;</span>
  <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">break</span>;
  <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">2</span>:
  <span style="color: #002200;">&#123;</span>
    btn.tag = <span style="color: #0000dd;">15</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>_selectedDay != <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #0000ff;">int</span> ab = <span style="color: #0000dd;">60</span> * <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;hour&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span> +
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;minute&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span>;
      <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>ab == <span style="color: #0000dd;">15</span><span style="color: #002200;">&#41;</span> btn.selected = YES;
    <span style="color: #002200;">&#125;</span>
  <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">break</span>;
  <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">3</span>:
  <span style="color: #002200;">&#123;</span>
    btn.tag = <span style="color: #0000dd;">30</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>_selectedDay != <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #0000ff;">int</span> ab = <span style="color: #0000dd;">60</span> * <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;hour&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span> +
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;minute&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span>;
      <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>ab == <span style="color: #0000dd;">30</span><span style="color: #002200;">&#41;</span> btn.selected = YES;
    <span style="color: #002200;">&#125;</span>
  <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">break</span>;
  <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">4</span>:
  <span style="color: #002200;">&#123;</span>
    btn.tag = <span style="color: #0000dd;">45</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>_selectedDay != <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #0000ff;">int</span> ab = <span style="color: #0000dd;">60</span> * <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;hour&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span> +
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;minute&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span>;
      <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>ab == <span style="color: #0000dd;">45</span><span style="color: #002200;">&#41;</span> btn.selected = YES;
    <span style="color: #002200;">&#125;</span>
  <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">break</span>;
  <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">5</span>:
  <span style="color: #002200;">&#123;</span>
    btn.tag = <span style="color: #0000dd;">60</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>_selectedDay != <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #0000ff;">int</span> ab = <span style="color: #0000dd;">60</span> * <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;hour&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span> +
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;minute&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span>;
      <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>ab == <span style="color: #0000dd;">60</span><span style="color: #002200;">&#41;</span> btn.selected = YES;
    <span style="color: #002200;">&#125;</span>
  <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">break</span>;
  <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">6</span>:
  <span style="color: #002200;">&#123;</span>
    btn.tag = <span style="color: #0000dd;">120</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>_selectedDay != <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #0000ff;">int</span> ab = <span style="color: #0000dd;">60</span> * <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;hour&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span> +
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;minute&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span>;
      <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>ab == <span style="color: #0000dd;">120</span><span style="color: #002200;">&#41;</span> btn.selected = YES;
    <span style="color: #002200;">&#125;</span>
  <span style="color: #002200;">&#125;</span>
    <span style="color: #0000ff;">break</span>;
  <span style="color: #0000ff;">case</span> <span style="color: #0000dd;">7</span>:
  <span style="color: #002200;">&#123;</span>
    btn.tag = <span style="color: #0000dd;">180</span>;
    <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>_selectedDay != <span style="color: #0000ff;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
      <span style="color: #0000ff;">int</span> ab = <span style="color: #0000dd;">60</span> * <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;hour&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span> +
        <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>_selectedDay valueForKey:@<span style="color: #666666;">&quot;minute&quot;</span><span style="color: #002200;">&#93;</span> intValue<span style="color: #002200;">&#93;</span>;
      <span style="color: #0000ff;">if</span> <span style="color: #002200;">&#40;</span>ab == <span style="color: #0000dd;">180</span><span style="color: #002200;">&#41;</span> btn.selected = YES;
    <span style="color: #002200;">&#125;</span>
  <span style="color: #002200;">&#125;</span>
  <span style="color: #0000ff;">break</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">&#125;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.japko.net/blog/lang/en/2010/12/05/iphone-coding-wtf/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

