<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://united-coders.com"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>united-coders.com - java</title>
 <link>http://united-coders.com/taxonomy/term/4/0</link>
 <description></description>
 <language>en</language>
<item>
 <title>facebook Hacker Cup 2012 Qualification - solution for billboards</title>
 <link>http://united-coders.com/christian-harms/facebook-hacker-cup-2012-qualification-solution-for-billboards</link>
 <description>&lt;p&gt;The second problem from this year facebook hackercup sound like the classic &lt;a href=&quot;http://en.wikipedia.org/wiki/Knapsack_problem&quot;&gt;knapsack problem&lt;/a&gt;. But the solution is much easier (words are in fixed sort order). Feel free to find a smarter algorithm or comment my python solution.&lt;/p&gt;
&lt;h2&gt;problem description&lt;/h2&gt;
&lt;p&gt;We are starting preparations for Hacker Cup 2013 really early. Our first step is to prepare billboards to advertise the contest. We have text for hundreds of billboards, but we need your help to design them.&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/christian-harms/facebook-hacker-cup-2012-qualification-solution-for-billboards&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/christian-harms/facebook-hacker-cup-2012-qualification-solution-for-billboards&quot; dc:identifier=&quot;http://united-coders.com/christian-harms/facebook-hacker-cup-2012-qualification-solution-for-billboards&quot; dc:title=&quot;facebook Hacker Cup 2012 Qualification - solution for billboards&quot; trackback:ping=&quot;http://united-coders.com/trackback/119&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-1525&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/christian-harms/facebook-hacker-cup-2012-qualification-solution-for-billboards#comments</comments>
 <category domain="http://united-coders.com/category/tags/code-puzzle">code puzzle</category>
 <category domain="http://united-coders.com/category/tags/facebook-hackercup">facebook hackercup</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <category domain="http://united-coders.com/category/tags/python">python</category>
 <category domain="http://united-coders.com/category/tags/solution">solution</category>
 <pubDate>Wed, 25 Jan 2012 18:50:17 +0000</pubDate>
 <dc:creator>Christian Harms</dc:creator>
 <guid isPermaLink="false">119 at http://united-coders.com</guid>
</item>
<item>
 <title>Google Code Jam - Space Emergency</title>
 <link>http://united-coders.com/nico-heid/google-code-jam-space-emergency</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt;&lt;a href=&quot;http://code.google.com/codejam/contest/dashboard?c=1128486#s=p1&amp;amp;a=1&quot;&gt;Space Emergency&lt;/a&gt; is a nice little puzzle from Google Code Jam 2011.&lt;/p&gt;
&lt;p&gt;The solution is quite simple. Fly as long as the boosters are built. Once they are done, reorder your remaining distance. Use the boosters on longest distances. Voila - that&#039;s it.&lt;/p&gt;
&lt;p&gt;Let’s see the &lt;a href=&quot;https://github.com/nheid/unitedcoders-examples/blob/f9eecfdec15498e5299dcd509e396190d37d49c8/src-java/com/unitedcoders/examples/codejam/SpaceEmergency.java&quot;&gt;straight forward implementation for the small input.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;java geshifilter-java&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; casenr &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; casenr &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;=&lt;/span&gt; testcases&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; casenr&lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003399;&quot;&gt;Integer&lt;/span&gt; time &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003399;&quot;&gt;Integer&lt;/span&gt; boosters &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; scanner.&lt;span style=&quot;color: #006633;&quot;&gt;nextInt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// L&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;long&lt;/span&gt; buildTime &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; scanner.&lt;span style=&quot;color: #006633;&quot;&gt;nextLong&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// t&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003399;&quot;&gt;Integer&lt;/span&gt; finalStar &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; scanner.&lt;span style=&quot;color: #006633;&quot;&gt;nextInt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// N&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003399;&quot;&gt;Integer&lt;/span&gt; stars &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; scanner.&lt;span style=&quot;color: #006633;&quot;&gt;nextInt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// C&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;Integer&lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt; distances &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; ArrayList&lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt;Integer&lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/google-code-jam-space-emergency&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/google-code-jam-space-emergency&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/google-code-jam-space-emergency&quot; dc:title=&quot;Google Code Jam - Space Emergency&quot; trackback:ping=&quot;http://united-coders.com/trackback/105&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-5836&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/google-code-jam-space-emergency#comments</comments>
 <category domain="http://united-coders.com/category/tags/code-jam">code jam</category>
 <category domain="http://united-coders.com/category/tags/google">google</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <pubDate>Mon, 18 Jul 2011 12:54:49 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">105 at http://united-coders.com</guid>
</item>
<item>
 <title>Google Code Jam - Picking Up Chicks</title>
 <link>http://united-coders.com/nico-heid/google-code-jam-picking-up-chicks</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt;&lt;a href=&quot;http://code.google.com/codejam/contest/dashboard?c=635101#s=p1&quot;&gt;This is a problem&lt;/a&gt; I particularly enjoyed. I had to turn it around a few times in my head before I found the solution.&lt;/p&gt;
&lt;p&gt;First I was thinking about simulation the chickens moving before noticing I am going in the totally wrong direction.&lt;br /&gt;
Then it dawned to me, that the solution is quite simple.&lt;/p&gt;
&lt;p&gt;We can break the solution down into two parts.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is the specific case solvable&lt;/li&gt;
&lt;li&gt;How many swaps do we need&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Is the specific case solvable&lt;/h2&gt;
&lt;p&gt;Leaving all other aspects aside, just check if enough chickens can make it to the barn in time. If this is not the case, it&#039;s an IMPOSSIBLE one to solve.&lt;br /&gt;
For this to find out, you only need to get their position, add the speed multiplied by the time you have at hands and see if they make it into safety, also known as the barn.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;java geshifilter-java&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; finishers &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;boolean&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; isFastEnough &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;boolean&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;startposition.&lt;span style=&quot;color: #006633;&quot;&gt;length&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/google-code-jam-picking-up-chicks&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/google-code-jam-picking-up-chicks&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/google-code-jam-picking-up-chicks&quot; dc:title=&quot;Google Code Jam - Picking Up Chicks&quot; trackback:ping=&quot;http://united-coders.com/trackback/102&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-9018&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/google-code-jam-picking-up-chicks#comments</comments>
 <category domain="http://united-coders.com/category/tags/code-jam">code jam</category>
 <category domain="http://united-coders.com/category/tags/google">google</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <pubDate>Wed, 13 Apr 2011 17:36:51 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">102 at http://united-coders.com</guid>
</item>
<item>
 <title>Google Code Jam - Minimum Scalar Product</title>
 <link>http://united-coders.com/nico-heid/google-code-jam-minimum-scalar-product</link>
 <description>&lt;p&gt;With the &lt;a href=&quot;http://code.google.com/codejam&quot; target=&quot;_blank&quot;&gt;Google Code Jam 2011&lt;/a&gt; less than four weeks away, it is time for some finger exercises.&lt;/p&gt;
&lt;p&gt;Let&#039;s start with the &lt;a href=&quot;http://code.google.com/codejam/contest/dashboard?c=32016#s=p0&amp;amp;a=0&quot; target=&quot;_blank&quot;&gt;Minimum Scalar Product&lt;/a&gt;, which should only take you a few minutes.&lt;/p&gt;
&lt;p&gt;Here&#039;s the Java version, which will only work for the small input set. I&#039;ll explain later.&lt;br /&gt;
&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;java geshifilter-java&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; getMinimumScalarProduct2&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; x, &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; y&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003399;&quot;&gt;Arrays&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;sort&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;x&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003399;&quot;&gt;Arrays&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;sort&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;y&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; sum&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; x.&lt;span style=&quot;color: #006633;&quot;&gt;length&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; i&lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sum &lt;span style=&quot;color: #339933;&quot;&gt;+=&lt;/span&gt; x&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;*&lt;/span&gt; y&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;x.&lt;span style=&quot;color: #006633;&quot;&gt;length&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt;i&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: bold; font-style: italic;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;return&lt;/span&gt; sum&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;What we do is sort both arrays, then multiply them. One starting from the beginning, the other from the end. So our biggest numbers are multiplied with the smallest. The math is on Google&#039;s solution page, we&#039;re just looking at coding here.&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/google-code-jam-minimum-scalar-product&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/google-code-jam-minimum-scalar-product&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/google-code-jam-minimum-scalar-product&quot; dc:title=&quot;Google Code Jam - Minimum Scalar Product&quot; trackback:ping=&quot;http://united-coders.com/trackback/101&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-9370&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/google-code-jam-minimum-scalar-product#comments</comments>
 <category domain="http://united-coders.com/category/tags/code-jam">code jam</category>
 <category domain="http://united-coders.com/category/tags/google">google</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <category domain="http://united-coders.com/category/tags/python">python</category>
 <pubDate>Sun, 10 Apr 2011 12:52:54 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">101 at http://united-coders.com</guid>
</item>
<item>
 <title>An Android SeekBar for your MediaPlayer</title>
 <link>http://united-coders.com/nico-heid/an-android-seekbar-for-your-mediaplayer</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt;&lt;img src=&#039;http://united-coders.com/sites/default/files/imagepicker/1/android_logo_1.jpg&#039; alt=&#039;android logo&#039;  class=&quot;imgp_img&quot; style=&quot;float:left; padding: 5px;&quot; /&gt;We all like a playback progress bar underneath our media players, so we can see how far we are and, if necesary, drag the thumb to were we want it to be.&lt;/p&gt;
&lt;p&gt;Lets do this on Android: enter &lt;a href=&quot;http://developer.android.com/reference/android/widget/SeekBar.html&quot; title=&quot;http://developer.android.com/reference/android/widget/SeekBar.html&quot;&gt;http://developer.android.com/reference/android/widget/SeekBar.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As we will need a Runnable to update the bar regularly, let you class implement Runnable. Let&#039;s look at the run() method.&lt;br /&gt;
&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;java geshifilter-java&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp;@Override&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; run&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// mp is your MediaPlayer&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// progress is your ProgressBar&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; currentPosition &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; total &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; mp.&lt;span style=&quot;color: #006633;&quot;&gt;getDuration&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; progress.&lt;span style=&quot;color: #006633;&quot;&gt;setMax&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;total&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;mp &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; currentPosition &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; total&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: bold; font-style: italic;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003399;&quot;&gt;Thread&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; currentPosition &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; mp.&lt;span style=&quot;color: #006633;&quot;&gt;getCurrentPosition&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;InterruptedException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/an-android-seekbar-for-your-mediaplayer&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/an-android-seekbar-for-your-mediaplayer&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/an-android-seekbar-for-your-mediaplayer&quot; dc:title=&quot;An Android SeekBar for your MediaPlayer&quot; trackback:ping=&quot;http://united-coders.com/trackback/98&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-3492&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/an-android-seekbar-for-your-mediaplayer#comments</comments>
 <category domain="http://united-coders.com/category/tags/android">Android</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <pubDate>Sat, 26 Feb 2011 15:49:44 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">98 at http://united-coders.com</guid>
</item>
<item>
 <title>Android UI testing with robotium</title>
 <link>http://united-coders.com/nico-heid/android-ui-testing-with-robotium</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt;&lt;img src=&#039;http://pragmatic-geek.com/uc/sites/default/files/imagepicker/1/android_logo.jpg&#039; alt=&#039;android logo&#039; style=&quot;float: left; padding: 5px;&quot; class=&quot;imgp_img&quot; /&gt;&lt;br /&gt;
I will base this post on the last article: &lt;a href=&quot;http://united-coders.com/nico-heid/android-viewflipper-within-tabhost-for-tabs-with-different-views-and-better-memory&quot; target=&quot;_blank&quot;&gt;Android ViewFlipper within TabHost for Tabs with different Views ... and better memory footprint&lt;/a&gt;, where we had a TabHost and a ViewFlipper. To test that our example is still working, we have to start the app, start the tab example, click on the ViewFlipper then change to Tab2 and press the button. Of course you can do this by hand if you must, which basically always happens when you&#039;re in the middle of development -unless you&#039;re doing test driven development. But later on, you don&#039;t really want to sit there and click a lot, or even worse, enter text with your thick fingers on a tiny android device screen. So a good idea to test the UI is to get it automated in some way. That is where robotium comes into the game.&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/android-ui-testing-with-robotium&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/android-ui-testing-with-robotium&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/android-ui-testing-with-robotium&quot; dc:title=&quot;Android UI testing with robotium&quot; trackback:ping=&quot;http://united-coders.com/trackback/81&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-1710&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/android-ui-testing-with-robotium#comments</comments>
 <category domain="http://united-coders.com/category/tags/android">Android</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <category domain="http://united-coders.com/category/tags/robotium">robotium</category>
 <category domain="http://united-coders.com/category/tags/testing">testing</category>
 <pubDate>Sun, 31 Oct 2010 09:59:43 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">81 at http://united-coders.com</guid>
</item>
<item>
 <title>Android ViewFlipper within TabHost for Tabs with different Views ... and better memory footprint</title>
 <link>http://united-coders.com/nico-heid/android-viewflipper-within-tabhost-for-tabs-with-different-views-and-better-memory</link>
 <description>&lt;p&gt;&lt;img src=&quot;http://oi54.tinypic.com/2hd7akx.jpg&quot; align=&quot;left&quot; alt=&quot;android&quot; style=&quot;padding:5px;&quot; /&gt;&lt;br /&gt;
This article is a follow up of &lt;a href=&quot;http://united-coders.com/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity&quot;&gt;Use Android ActivityGroup within TabHost to show different Activity&lt;/a&gt;. As you probably noticed or read in the comments, the provided solution in the last article was less than ideal. Even though it does work, it uses multiple activies and therefor has a bigger memory consumption than necessary.&lt;/p&gt;
&lt;h2&gt;What happens when you use ActivityGroup with Tabhost&lt;/h2&gt;
&lt;p&gt;In the previous example we had one Activiy per tab. One tab was even holding two Activies and using ActivityGroup to switch between them. That&#039;s a total of five Activites that end up on the activity stack. Also the hierarchy was more nested than needed.&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/android-viewflipper-within-tabhost-for-tabs-with-different-views-and-better-memory&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;The improvement&lt;/h2&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/android-viewflipper-within-tabhost-for-tabs-with-different-views-and-better-memory&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/android-viewflipper-within-tabhost-for-tabs-with-different-views-and-better-memory&quot; dc:title=&quot;Android ViewFlipper within TabHost for Tabs with different Views ... and better memory footprint&quot; trackback:ping=&quot;http://united-coders.com/trackback/79&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-8664&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/android-viewflipper-within-tabhost-for-tabs-with-different-views-and-better-memory#comments</comments>
 <category domain="http://united-coders.com/category/tags/activitygroup">ActivityGroup</category>
 <category domain="http://united-coders.com/category/tags/android">Android</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <category domain="http://united-coders.com/category/tags/tabhost">TabHost</category>
 <category domain="http://united-coders.com/category/tags/viewflipper">viewflipper</category>
 <pubDate>Sat, 16 Oct 2010 13:56:05 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">79 at http://united-coders.com</guid>
</item>
<item>
 <title>Use Android ActivityGroup within TabHost to show different Activity</title>
 <link>http://united-coders.com/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt;&lt;img src=&quot;http://oi54.tinypic.com/2hd7akx.jpg&quot; align=&quot;left&quot; alt=&quot;android&quot; style=&quot;padding:5px;&quot; /&gt;&lt;/p&gt;
&lt;h3&gt;there is an updated version to this article with some improvements. please also read: &lt;a href=&quot;http://united-coders.com/nico-heid/android-viewflipper-within-tabhost-for-tabs-with-different-views-and-better-memory&quot;&gt;Android ViewFlipper within TabHost for Tabs with different Views ... and better memory footprint&lt;/a&gt;.&lt;/h3&gt;
&lt;p&gt;When you&#039;re using a &lt;a href=&quot;http://developer.android.com/reference/android/widget/TabHost.html&quot; target=&quot;_blank&quot;&gt;TabHost&lt;/a&gt; each tab has it&#039;s own Activity. Now image you want to change the Activity for a certain tab. If you just go on and create a new Activity and display it, your Tab Layout is no longer visible. &lt;/p&gt;
&lt;p&gt;For that reason you need a &lt;a href=&quot;http://developer.android.com/reference/android/app/ActivityGroup.html&quot; target=&quot;_blank&quot;&gt;ActivityGroup&lt;/a&gt; within the Tab where you want to change the Activity. &lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity&quot; dc:title=&quot;Use Android ActivityGroup within TabHost to show different Activity&quot; trackback:ping=&quot;http://united-coders.com/trackback/78&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-5642&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity#comments</comments>
 <category domain="http://united-coders.com/category/tags/activitygroup">ActivityGroup</category>
 <category domain="http://united-coders.com/category/tags/android">Android</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <category domain="http://united-coders.com/category/tags/tabhost">TabHost</category>
 <pubDate>Thu, 30 Sep 2010 07:34:44 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">78 at http://united-coders.com</guid>
</item>
<item>
 <title>Show ProgressBar in Notification Area like Google does when downloading from Android market</title>
 <link>http://united-coders.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android</link>
 <description>&lt;!--paging_filter--&gt;&lt;p&gt;&lt;img src=&#039;http://united-coders.com/sites/default/files/imagepicker/1/andoid_download_progress.png&#039; alt=&#039;android download progress&#039; style=&quot;float: left; padding:5px;&quot; class=&quot;imgp_img&quot; /&gt;When you download from the Market you get informed about the progress in the notification area.&lt;/p&gt;
&lt;p&gt;That&#039;s a really nice feature, which you may want for your own download or processing progress. I will show you the basics of generating such a Notification. All you need to do is add it to your code. &lt;/p&gt;
&lt;p&gt;I included a screenshot. You can find the code at &lt;a href=&quot;http://github.com/nheid/unitedcoders-android&quot; target=&quot;_blank&quot;&gt;github.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First of all, you need your Notification object:&lt;br /&gt;
&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;java geshifilter-java&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// configure the notification&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;final&lt;/span&gt; Notification notification &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Notification&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;R.&lt;span style=&quot;color: #006633;&quot;&gt;drawable&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;icon&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;simulating a download&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;span style=&quot;color: #006633;&quot;&gt;currentTimeMillis&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; notification.&lt;span style=&quot;color: #006633;&quot;&gt;flags&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; notification.&lt;span style=&quot;color: #006633;&quot;&gt;flags&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;|&lt;/span&gt; Notification.&lt;span style=&quot;color: #006633;&quot;&gt;FLAG_ONGOING_EVENT&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android&quot; dc:title=&quot;Show ProgressBar in Notification Area like Google does when downloading from Android market&quot; trackback:ping=&quot;http://united-coders.com/trackback/77&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-1268&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/show-progressbar-in-notification-area-like-google-does-when-downloading-from-android#comments</comments>
 <category domain="http://united-coders.com/category/tags/android">Android</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <pubDate>Wed, 08 Sep 2010 16:22:19 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">77 at http://united-coders.com</guid>
</item>
<item>
 <title>Google Code Jam - Rotate</title>
 <link>http://united-coders.com/nico-heid/google-code-jam-rotate</link>
 <description>&lt;p&gt;It&#039;s time for some basic finger exercise. The &lt;a href=&quot;http://code.google.com/codejam/contest/dashboard?c=544101#&quot; target=&quot;_blank&quot;&gt;Google Code Jam Rotate&lt;/a&gt; is very trivial, so relax and fire up your IDE.&lt;/p&gt;
&lt;p&gt;I was a bit lazy, so there is no reading of the input sets, just a two-dimensional array and two functions&lt;/p&gt;
&lt;h3&gt;Rotating&lt;/h3&gt;
&lt;p&gt;As the Google solution pointed out, there is actually no need to really rotate the 2dim array. Just push everything to the right, as if gravity would be to the right. That&#039;s the same as rotating everything and keeping gravity towards the bottom. But we save a few lines this way.&lt;/p&gt;
&lt;p&gt;So here is the &quot;gravity from the right&quot; code&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;geshifilter&quot;&gt;&lt;div class=&quot;java geshifilter-java&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; fakeRotate&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; board&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; N&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; i&lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; j &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; N &lt;span style=&quot;color: #339933;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; j &lt;span style=&quot;color: #339933;&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; j&lt;span style=&quot;color: #339933;&quot;&gt;--&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;board&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;j&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;.&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// push to right&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; m &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&quot;font-family: monospace; font-weight: normal;&quot;&gt;&lt;div style=&quot;font-family: monospace; font-weight: normal; font-style: normal&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;j &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; m&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; N &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; board&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;j &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; m&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;.&#039;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class=&quot;read-more&quot;&gt;&lt;a href=&quot;/nico-heid/google-code-jam-rotate&quot;&gt;&lt;strong&gt;Read more&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;!--
&lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:trackback=&quot;http://madskills.com/public/xml/rss/module/trackback/&quot;&gt;
&lt;rdf:Description rdf:about=&quot;http://united-coders.com/nico-heid/google-code-jam-rotate&quot; dc:identifier=&quot;http://united-coders.com/nico-heid/google-code-jam-rotate&quot; dc:title=&quot;Google Code Jam - Rotate&quot; trackback:ping=&quot;http://united-coders.com/trackback/71&quot; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
&lt;div class=&#039;sexybookmarks-default-6341&#039;&gt;&lt;/div&gt;</description>
 <comments>http://united-coders.com/nico-heid/google-code-jam-rotate#comments</comments>
 <category domain="http://united-coders.com/category/tags/code-jam">code jam</category>
 <category domain="http://united-coders.com/category/tags/code-puzzles">code puzzles</category>
 <category domain="http://united-coders.com/category/tags/google">google</category>
 <category domain="http://united-coders.com/category/tags/java">java</category>
 <pubDate>Sun, 15 Aug 2010 16:33:08 +0000</pubDate>
 <dc:creator>Nico Heid</dc:creator>
 <guid isPermaLink="false">71 at http://united-coders.com</guid>
</item>
</channel>
</rss>


