<?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>Ampere&#039;s IT Weblog</title>
	<atom:link href="http://www.justpowered.de/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.justpowered.de/blog</link>
	<description>when google&#039;ing is no use</description>
	<lastBuildDate>Mon, 28 Mar 2011 14:35:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Batchfile: simple slideshow with custom image order</title>
		<link>http://www.justpowered.de/blog/shellbatch/windows-batch-slideshow-with-custom-image-order.html</link>
		<comments>http://www.justpowered.de/blog/shellbatch/windows-batch-slideshow-with-custom-image-order.html#comments</comments>
		<pubDate>Mon, 28 Mar 2011 14:35:05 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[shell/batch]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=339</guid>
		<description><![CDATA[Last week a friend of mine wanted to have a image slideshow for a presentation TV screen for an exhibition. Besides of a large number of images that should be displayed in order he wanted to display his company logo image every second image, like: image 1 company image image 2 company image image 3 [...]]]></description>
			<content:encoded><![CDATA[<p>Last week a friend of mine wanted to have a image slideshow for a presentation TV screen for an exhibition. Besides of a large number of images that should be displayed in order he wanted to display his company logo image every second image, like:</p>
<ol>
<li>image 1</li>
<li>company image</li>
<li>image 2</li>
<li>company image</li>
<li>image 3</li>
<li>company image</li>
<li>&#8230;</li>
</ol>
<p>I wanted to do this without writing a program or installing Perl (his laptop is a Windows box) so I did this with a tiny Windows batch file:</p>
<pre class="brush: bash; title: ; notranslate">

@ECHO OFF
setLocal EnableDelayedExpansion

SET count=1
SET IMAGEDIR=%1
SET FILLIMAGE=%2

cd %IMAGEDIR%
FOR %%a IN (*.*) DO ( call :do &quot;%%a&quot; )
GOTO :EOF

:do
SET UQ1=%1
ren %UQ1% &quot;%count%_!UQ1:&quot;=!&quot;
set /a count+=1
copy %FILLIMAGE% &quot;%count%.jpg&quot;
set /a count+=1
GOTO :eof
</pre>
<p>Given the batchfile <strong>slideshow.bat</strong>, the directory with a copy of all the source images in <strong>C:\images</strong> and the company logo image in <strong>C:\companyimage.jpg</strong> the call simply is:</p>
<pre class="brush: bash; title: ; notranslate">

slideshow.bat &quot;C:\images\&quot; &quot;C:\companyimage.jpg&quot;
</pre>
<p>This will rename all the pictures found in C:\images with a number in front of the original file name &#8211; with one number left out; like 1,3,5,7,etc. The company image is copied in between all these images as 2.jpg, 4.jpg, 6.jpg, etc. Now simply viewing the first image with Windows Picture Viewer and hitting the slideshow button will display the files by name which is exactly the desired display order.</p>
<p>Regarding the batchfile: it would be possible to execute multiple statements within the <strong>DO ( &#8230; )</strong> but that way the counter variable did not work. I had to do a call to a method which then changes the counter. Another issue was the unquoting of the file name. The <strong>&#8220;%%a&#8221;</strong> supplies the image file name with double quotes to the %1 inside the <strong>:do</strong> function. As the final name should be<strong> counter + image-name</strong> without unquoting it would look like <strong>1_&#8221;my image.jpg&#8221;</strong> which will do an error. The magick is the <strong>!VAR:&#8221;=!</strong> which unquotes the string in VAR.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/shellbatch/windows-batch-slideshow-with-custom-image-order.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bookmarklet for QR Codes from Android market links</title>
		<link>http://www.justpowered.de/blog/misc/android-market-qr-code-bookmarklet.html</link>
		<comments>http://www.justpowered.de/blog/misc/android-market-qr-code-bookmarklet.html#comments</comments>
		<pubDate>Wed, 23 Feb 2011 13:11:26 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=321</guid>
		<description><![CDATA[Since the beginning of this month Google has been allowing access to its android app market for non-Android devices via http://market.android.com. Unfortunately when accessing the app pages with a non-android device there&#8217;re no QR codes for the apps, so getting the app to the device is pretty cumbersome. I wrote a little bookmarklet to convert [...]]]></description>
			<content:encoded><![CDATA[<p>Since the beginning of this month Google has been allowing access to its android app market for non-Android devices via <a href="http://market.android.com" target="_blank">http://market.android.com</a>. Unfortunately when accessing the app pages with a non-android device there&#8217;re no QR codes for the apps, so getting the app to the device is pretty cumbersome. I wrote a little bookmarklet to convert the http://market URL into a market:// one and generate a QR code image for that link.</p>
<pre class="brush: jscript; title: ; notranslate">

javascript:(function(){var exp = /details\?id=([\w\.]*)/; exp.exec(location.href); window.open('http://qrcode.kaywa.com/img.php?s=8&amp;d=' + encodeURIComponent('market://details?id='+RegExp.$1), '_blank');})()
</pre>
<p>Just Drag&amp;Drop this linked image:</p>
<p style="text-align: center;"><a onclick="javascript:return false;" href="javascript:(function(){var exp = /details\?id=([\w\.]*)/; exp.exec(location.href); window.open('http://qrcode.kaywa.com/img.php?s=8&amp;d=' + encodeURIComponent('market://details?id='+RegExp.$1), '_blank');})()"><img class="size-full wp-image-333 aligncenter" title="AndroidScanner" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/AndroidScanner.png" alt="Android QR" width="48" height="48" /></a></p>
<p><a href="javascript:(function(){var exp = /details\?id=([\w\.]*)/; exp.exec(location.href); window.open('http://qrcode.kaywa.com/img.php?s=8&amp;d=' + encodeURIComponent('market://details?id='+RegExp.$1), '_blank');})()"></a> to your bookmarks bar and click on it when you&#8217;re on a android app page:</p>
<p style="text-align: center;"><a href="http://www.justpowered.de/blog/wp-content/uploads/2011/02/draganddropbookmarklet2.jpg"><img class="size-full wp-image-335 aligncenter" title="draganddropbookmarklet" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/draganddropbookmarklet2.jpg" alt="Drag the bookmarklet" width="540" height="542" /></a></p>
<p style="text-align: center;">
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/misc/android-market-qr-code-bookmarklet.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Favorite Android Apps</title>
		<link>http://www.justpowered.de/blog/misc/favorite-android-apps.html</link>
		<comments>http://www.justpowered.de/blog/misc/favorite-android-apps.html#comments</comments>
		<pubDate>Thu, 03 Feb 2011 20:54:07 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=221</guid>
		<description><![CDATA[For half a year my job has been getting me in &#8220;touch&#8221; with Apple devices: an iPad 3G+WLAN and a new iPod touch. Most of the time we use these devices for testing our mobile websites and to find out how the rest of the mobile world does it. As I&#8217;m not that in favour [...]]]></description>
			<content:encoded><![CDATA[<p>For half a year my job has been getting me in &#8220;touch&#8221; <img src='http://www.justpowered.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  with Apple devices: an iPad 3G+WLAN and a new iPod touch. Most of the time we use these devices for testing our mobile websites and to find out how the rest of the mobile world does it. As I&#8217;m not that in favour of spending so much money for an Apple phone I ordered a startup Android 2.1 phone some time ago. The actual Huawei-manufactured Vodafone 845 comes with a pretty small resistive 320&#215;240 pixel display &#8211; but: hey, it came only 100€!</p>
<p>After trying many many apps the following list is an overview of my favorite ones. I might add a list pretty useful iOS apps in another article together with Benjamin in the next days.</p>
<p>&#8212;</p>
<h2>Games</h2>
<h3>123 Maze Lite</h3>
<p>Maze game which get&#8217;s quite tricky in the later levels.</p>
<p><img class="size-full wp-image-233 alignnone" title="android_123maze1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_123maze1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-235" title="android_123maze2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_123maze2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dmaze.game&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=maze.game">http://market.android.com/details?id=maze.game</a></p>
<h3>Scumm VM (alpha)</h3>
<p>The scumm VM is a virtual machine for the best adventure games ever &#8211; created some years ago by Lucas Arts. Till now I could only find a very early ported version for android but following the instructions in the website at: <a href="http://sites.google.com/site/scummvmandroid/">http://sites.google.com/site/scummvmandroid/</a> I got the manually installed apk running. You&#8217;ll need some files from the scumm VM project (<a href="http://wiki.scummvm.org/index.php/Datafiles">datafiles</a>) &#8211; just stick to their FAQ and it should work.</p>
<p>You can get some of the old games from abandonware games website on the web or just copy the data from your 3.5&#8243; floopy disks <img src='http://www.justpowered.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> . I successfully played Monkey Island 1 + 2, Zak McKraken, Sam &amp; Max and Day Of the Tentacle (though the sound is sometimes cracking).</p>
<p><img class="alignnone size-full wp-image-287" title="android_scumm1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_scumm1.jpg" alt="" width="320" height="240" /> <img class="alignnone size-full wp-image-288" title="android_scumm2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_scumm2.jpg" alt="" width="320" height="240" /> <img class="alignnone size-full wp-image-289" title="android_scumm3" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_scumm3.jpg" alt="" width="320" height="240" /></p>
<h3>X Construction Lite</h3>
<p>Like the bridge builder and Pontifex games in X Construction you have to compose stable bridges for a train using metal segments.</p>
<p><img class="alignnone size-full wp-image-300" title="android_xconstruct1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_xconstruct1.jpg" alt="" width="320" height="240" /> <img class="alignnone size-full wp-image-234" title="android_xconstruct2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_xconstruct2.jpg" alt="" width="320" height="240" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dde.hms.xconstruction&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=de.hms.xconstruction" target="_blank">http://market.android.com/details?id=de.hms.xconstruction</a></p>
<h3>Traffic Jam Free</h3>
<p>Rushhour is a puzzle game where you have to move cars out of the way so a yellow can drive to the exit. Thousands of levels and you can set the difficulty in various steps.</p>
<p><img class="alignnone size-full wp-image-295" title="android_trafficjam1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_trafficjam1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-296" title="android_trafficjam2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_trafficjam2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.jiuzhangtech.rushhour&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.jiuzhangtech.rushhour" target="_blank">http://market.android.com/details?id=com.jiuzhangtech.rushhour</a></p>
<h3>Labyrinth Lite</h3>
<p>The kids just love it, though the lite version does not come with many levels.</p>
<p><img class="alignnone size-full wp-image-271" title="android_labyrinth" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_labyrinth.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dse.illusionlabs.labyrinth.lite&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=se.illusionlabs.labyrinth.lite" target="_blank">http://market.android.com/details?id=se.illusionlabs.labyrinth.lite</a></p>
<h3>Andoku</h3>
<p>Yet another Sudoku game with many variations and thousands of levels.</p>
<p><img class="alignnone size-full wp-image-238" title="android_andoku1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_andoku1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-239" title="android_andoku2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_andoku2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.googlecode.andoku&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.googlecode.andoku" target="_blank">http://market.android.com/details?id=com.googlecode.andoku</a></p>
<h3>Android Invasion</h3>
<p>Space invaders clone.</p>
<p><img class="alignnone size-full wp-image-242" title="android_androidinvasion2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_androidinvasion2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.invadersgame&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.invadersgame" target="_blank">http://market.android.com/details?id=com.invadersgame</a></p>
<h3>Chess for Android</h3>
<p>You can set the CPU strength which gives even my bad chess skills a chance to win.</p>
<p><img class="alignnone size-full wp-image-252" title="android_chess1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_chess1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-253" title="android_chess2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_chess2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.google.android.chess&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.google.android.chess" target="_blank">http://market.android.com/details?id=com.google.android.chess</a></p>
<h3>Droid Balance Lite</h3>
<p>Fun with the position sensor of the phone. By turning the phone left and right you have to get rid of red shapes while preventing the blue ones from falling down.</p>
<p><img class="alignnone size-full wp-image-256" title="android_droidbalance1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_droidbalance1.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.DroidBalanceLite&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.DroidBalanceLite" target="_blank">http://market.android.com/details?id=com.DroidBalanceLite</a></p>
<h3>Gensoid Lite</h3>
<p>Gensoid is an emulator for good old SEGA games, such as Sonic the Hedgehog or Street Figther.</p>
<p><img class="alignnone size-full wp-image-263" title="android_gensoid1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_gensoid1.jpg" alt="" width="320" height="240" /> <img class="alignnone size-full wp-image-264" title="android_gensoid2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_gensoid2.jpg" alt="" width="320" height="240" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.androidemu.genslite&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.androidemu.genslite" target="_blank">http://market.android.com/details?id=com.androidemu.genslite</a></p>
<h3>Math Attack &amp; Math Workout</h3>
<p>Two &#8220;brain-train&#8221; math games.</p>
<p><img class="alignnone size-full wp-image-273" title="android_mathattack1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_mathattack1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-274" title="android_mathattack2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_mathattack2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.chilisapps.android.mathAttack&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.chilisapps.android.mathAttack" target="_blank">http://market.android.com/details?id=com.chilisapps.android.mathAttack</a></p>
<p><img class="alignnone size-full wp-image-275" title="android_mathworkout1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_mathworkout1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-276" title="android_mathworkout2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_mathworkout2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.akbur.mathsworkout&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.akbur.mathsworkout" target="_blank">http://market.android.com/details?id=com.akbur.mathsworkout</a></p>
<h3>National Flags Quiz</h3>
<p>Either you have to chose the correct country name according to a shown flag or the other way around. I knew suprisingly few of them &#8230;</p>
<p><img class="alignnone size-full wp-image-280" title="android_nationalflagsquiz1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_nationalflagsquiz1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-281" title="android_nationalflagsquiz2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_nationalflagsquiz2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dnet.fractalgate.android.nationalflags&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=net.fractalgate.android.nationalflags" target="_blank">http://market.android.com/details?id=net.fractalgate.android.nationalflags</a></p>
<h3>Save Newton Lite</h3>
<p>Using arrows shot by a bow you have to save Newton from apples falling from the tree.</p>
<p><img class="alignnone size-full wp-image-286" title="android_savenewton" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_savenewton.jpg" alt="" width="320" height="240" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dml.game.android.SaveNewton.lite&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=ml.game.android.SaveNewton.lite" target="_blank">http://market.android.com/details?id=ml.game.android.SaveNewton.lite</a></p>
<h3>Sea Fight</h3>
<p>Classic sea fight game. Just place your ships wise and try to nuke the CPU one&#8217;s.</p>
<p><img class="alignnone size-full wp-image-290" title="android_seafight1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_seafight1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-291" title="android_seafight2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_seafight2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.ztech.seafight&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.ztech.seafight" target="_blank">http://market.android.com/details?id=com.ztech.seafight</a></p>
<p>&#8212;</p>
<h2>Tools &amp; spare time</h2>
<h3>c:geo</h3>
<p>All-you-need for geocaching. Just connected my geocaching.com account and turned on GPS and it worked like a charm. Comes with Google maps overlay, GPS compass, detailed cache information with riddles, coordinates and user hints. You can store geocache information for later use &#8211; e.g. if there&#8217;s no network in the woods.</p>
<p><img class="alignnone size-full wp-image-248" title="android_cgeo1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_cgeo1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-249" title="android_cgeo2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_cgeo2.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-250" title="android_cgeo3" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_cgeo3.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-251" title="android_cgeo4" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_cgeo4.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcarnero.cgeo&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=carnero.cgeo" target="_blank">http://market.android.com/details?id=carnero.cgeo</a></p>
<h3>IMDb</h3>
<p>Accesses movie information from the internet movie database. Very handy for quicky looking up a movie or what actor did which movie and such.</p>
<p><img class="alignnone size-full wp-image-267" title="android_imdb1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_imdb1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-268" title="android_imdb2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_imdb2.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-269" title="android_imdb3" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_imdb3.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.imdb.mobile&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.imdb.mobile" target="_blank">http://market.android.com/details?id=com.imdb.mobile</a></p>
<h3>Google Sky Map</h3>
<p>Ever looked to the night sky and wondered: what&#8217;s the name of that bright star? Google sky map can tell you, just point your phone into the direction of the target.Can also guide you to find a specific galaxy or star.</p>
<p><img class="alignnone size-full wp-image-292" title="android_skymap1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_skymap1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-293" title="android_skymap2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_skymap2.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-294" title="android_skymap3" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_skymap3.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.google.android.stardroid&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.google.android.stardroid" target="_blank">http://market.android.com/details?id=com.google.android.stardroid</a></p>
<h3>DailyStrip</h3>
<p>Displays comic strips which you can chose from a large list. I&#8217;m much in favour of XKCD, Dilbert and Peanuts.</p>
<p><img class="alignnone size-full wp-image-254" title="android_dailystrip1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_dailystrip1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-255" title="android_dailystrip2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_dailystrip2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.fusetree.android.dailyStrip&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href=" http://market.android.com/details?id=com.fusetree.android.dailyStrip" target="_blank">http://market.android.com/details?id=com.fusetree.android.dailyStrip</a></p>
<h3>fring</h3>
<p>Instant message client for Gtalk, msn, icq or yahoo. Can also do video calls. I&#8217;ve been using it for ICQ chatting sometimes.</p>
<p><img class="alignnone size-full wp-image-262" title="android_fring1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_fring1.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.fring&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.fring" target="_blank">http://market.android.com/details?id=com.fring</a></p>
<h3>barcoo</h3>
<p>Given a scanned barcode of a grocery item you can look up it&#8217;s caloric values or where to get it with best price.</p>
<p><img class="alignnone size-full wp-image-243" title="android_barcoo1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_barcoo1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-244" title="android_barcoo2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_barcoo2.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-245" title="android_barcoo3" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_barcoo3.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dde.barcoo.android&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=de.barcoo.android" target="_blank">http://market.android.com/details?id=de.barcoo.android</a></p>
<h3>Mileage</h3>
<p>Small app for tracking fuel consumption and gas station prices.</p>
<p><img class="alignnone size-full wp-image-278" title="android_mileage1" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_mileage1.jpg" alt="" width="240" height="320" /> <img class="alignnone size-full wp-image-279" title="android_mileage2" src="http://www.justpowered.de/blog/wp-content/uploads/2011/02/android_mileage2.jpg" alt="" width="240" height="320" /></p>
<p><img class="alignnone" title="QR Code" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=200x200&amp;chl=market%3A//details%3Fid%3Dcom.evancharlton.mileage&amp;chld=H|0" alt="" width="200" height="200" /></p>
<p><a href="http://market.android.com/details?id=com.evancharlton.mileage" target="_blank">http://market.android.com/details?id=com.evancharlton.mileage</a></p>
<p>&#8212;</p>
<p>By the way: I used the <a href="http://createqrcode.appspot.com/" target="_blank">QR Code generator by Jason Delport of Paxmodept to create the QR codes</a>. You can get market links and package names of android apps using <a href="http://www.androlib.com" target="_blank">androlib.com</a> and &#8211; as of today, I believe &#8211; you can visit the market links using any browser as google opened the market for the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/misc/favorite-android-apps.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Timer and Stack Trace Debugging</title>
		<link>http://www.justpowered.de/blog/misc/javascript-timer-and-stack-trace-debugging.html</link>
		<comments>http://www.justpowered.de/blog/misc/javascript-timer-and-stack-trace-debugging.html#comments</comments>
		<pubDate>Wed, 24 Nov 2010 15:15:55 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=214</guid>
		<description><![CDATA[Today I had to work on a webpage with a large amount of JavaScript timers running and I had to find a bug which one of them caused. Unfortunatly the timeline in the Google Chrome developer tools only showed the order of the timer execution together with the timer ID. That IDs are created by [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had to work on a webpage with a large amount of JavaScript timers running and I had to find a bug which one of them caused. Unfortunatly the timeline in the Google Chrome developer tools only showed the order of the timer execution together with the timer ID. That IDs are created by each JavaScript setInterval() and setTimeout call. But just the ID doesn&#8217;t help much. So I rewrote the prototype of both the setTimeout and setInterval functions:</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;

window._oldTimeOut = window.setTimeout;
window.setTimeout = function(execute, timeout) {
  var id = window._oldTimeOut(execute, timeout);
  console.debug(&quot;created timer with id:&quot;, id, arguments.callee.caller.toString());
  console.debug('execute',execute.toString());
  return id;
};

window._oldInterval = window.setInterval;
window.setInterval = function(execute, timeout) {
  var id = window._oldInterval(execute, timeout);
  console.debug(&quot;created interval with id:&quot;, id, arguments.callee.caller.toString());
  console.debug('execute',execute.toString());
  return id;
};

&lt;/script&gt;
</pre>
<p>This gave me at least a hint where the sourcecode lines of the timer-executed code can be found. Also very helpful is a stack trace (aka call stack) at the current code position to find out which other function was calling the current one. I found a pretty old but still working code snippet on <a href="http://helephant.com/2007/05/diy-javascript-stack-trace/" target="_blank">http://helephant.com/2007/05/diy-javascript-stack-trace/</a> and added it to my timer debugging:</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;

Function.prototype.trace = function() {
 var trace = [];
 var current = this;
 while(current) {
 trace.push(current.signature());
  current = current.caller;
 }
 return trace;
};

Function.prototype.signature = function() {
 var signature = {
  name: this.getName(),
  params: [],
  toString: function() {
   var params = this.params.length &gt; 0 ?  &quot;'&quot; + this.params.join(&quot;', '&quot;) + &quot;'&quot; : &quot;&quot;;
   return this.name + &quot;(&quot; + params + &quot;)&quot;;
  }
 };
 if(this.arguments) {
  for(var x=0; x&lt;this.arguments.length; x++)
   signature.params.push(this.arguments[x]);
 }
 return signature;
};

Function.prototype.getName = function() {
 if(this.name)
  return this.name;
 var definition = this.toString().split(&quot;\n&quot;)[0];
 var exp = /^function ([^\s(]+).+/;
 if(exp.test(definition))
  return definition.split(&quot;\n&quot;)[0].replace(exp, &quot;$1&quot;) || &quot;anonymous&quot;;
 return &quot;anonymous&quot;;
};

window._oldTimeOut = window.setTimeout;
window.setTimeout = function(execute, timeout) {
 var id = window._oldTimeOut(execute, timeout);
 console.debug(&quot;created timer with id:&quot;, id);
 console.debug('execute',execute.toString());
 console.debug(&quot;stacktrace&quot;, arguments.callee.trace());
 return id;
};

window._oldInterval = window.setInterval;
window.setInterval = function(execute, timeout) {
 var id = window._oldInterval(execute, timeout);
 console.debug(&quot;created interval with id:&quot;, id);
 console.debug('execute',execute.toString());
 console.debug(&quot;stacktrace&quot;, arguments.callee.trace());
 return id;
};

&lt;/script&gt;
</pre>
<p>Be sure to add that script tag at the very top of your JavaScript execution (as the first element of your &lt;head&gt; tag for example).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/misc/javascript-timer-and-stack-trace-debugging.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Find UTF-8 byte order marks</title>
		<link>http://www.justpowered.de/blog/linux/find-utf-8-byte-order-marks.html</link>
		<comments>http://www.justpowered.de/blog/linux/find-utf-8-byte-order-marks.html#comments</comments>
		<pubDate>Thu, 21 Oct 2010 09:48:27 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[shell/batch]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=208</guid>
		<description><![CDATA[In a templating application I just ran into ugly &#8220;ï»¿&#8221; characters a the beginning of the text. This is caused by the byte order mark with the hex characters 0xEFBBBF. As it was not the only one file that contained the BOM I ran a search: To remove the BOM I followed the suggested way [...]]]></description>
			<content:encoded><![CDATA[<p>In a templating application I just ran into ugly &#8220;ï»¿&#8221; characters a the beginning of the text. This is caused by the byte order mark with the hex characters 0xEFBBBF. As it was not the only one file that contained the BOM I ran a search:</p>
<pre class="brush: bash; title: ; notranslate">
find . -iname '*.css' -o -iname '*.html' -o -iname '*.js' -o -iname '*.pm' -o -iname '*.pl' -o -iname '*.xml' | xargs grep -rl $'\xEF\xBB\xBF'
</pre>
<p>To remove the BOM I followed the suggested way by <a href="http://stackoverflow.com/questions/204765/elegant-way-to-search-for-utf-8-files-with-bom">http://stackoverflow.com/questions/204765/elegant-way-to-search-for-utf-8-files-with-bom</a> using sed:</p>
<pre class="brush: bash; title: ; notranslate">
find . -iname '*.css' -o -iname '*.html' -o -iname '*.js' -o -iname '*.pm' -o -iname '*.pl' -o -iname '*.xml' -exec sed 's/^\xEF\xBB\xBF//' -i.bak {} \; -exec rm {}.bak \;
</pre>
<p>Tada, no more ugly BOMs!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/linux/find-utf-8-byte-order-marks.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Optimize all PNG images recursively</title>
		<link>http://www.justpowered.de/blog/shellbatch/optimize-all-png-images-recursively.html</link>
		<comments>http://www.justpowered.de/blog/shellbatch/optimize-all-png-images-recursively.html#comments</comments>
		<pubDate>Sun, 19 Sep 2010 08:04:19 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[shell/batch]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=201</guid>
		<description><![CDATA[Windows batch file syntax sometimes is a pain compared to UNIX bash/sh. Using optipng I wanted to shrink all the PNG images in a directory and inside its subdirectories as well. Notice that I had to write the command into a .bat batch file, it did not work directly from the command line: The optipng [...]]]></description>
			<content:encoded><![CDATA[<p>Windows batch file syntax sometimes is a pain compared to UNIX bash/sh. Using optipng I wanted to shrink all the PNG images in a directory and inside its subdirectories as well. Notice that I had to write the command into a .bat batch file, it did not work directly from the command line:</p>
<pre class="brush: bash; title: ; notranslate">
FOR /F &quot;tokens=*&quot; %%G IN ('dir /s /b *.png') DO optipng -nc -nb -o7 -full %%G
</pre>
<p>The optipng params -nc and -nb prevent any color and color depth changes of the png files. Those may change the appearance, for example in the evil Internet Explorer. -o7 means the best and slowest optimization and -full does a full scan of the IDAT part. Using UNIX the same job may look like:</p>
<pre class="brush: bash; title: ; notranslate">
find . -name *.png | xargs optipng -nc -nb -o7 -full
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/shellbatch/optimize-all-png-images-recursively.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HDR Panorama Tutorial</title>
		<link>http://www.justpowered.de/blog/misc/hdr-panorama-tutorial.html</link>
		<comments>http://www.justpowered.de/blog/misc/hdr-panorama-tutorial.html#comments</comments>
		<pubDate>Sun, 01 Aug 2010 14:03:43 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[miscellaneous]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=181</guid>
		<description><![CDATA[Stitching panorama pictures from a series of taken photos is simple, besides of buyable software like Panorama Studio or Autopano there&#8217;re even free alternatives like Microsoft ICE. But what if you have three series of pictures for the panorama &#8211; each serial taken with a different exposure time? With single images it&#8217;s easy to merge [...]]]></description>
			<content:encoded><![CDATA[<p>Stitching panorama pictures from a series of taken photos is simple, besides of buyable software like Panorama Studio or Autopano there&#8217;re even free alternatives like Microsoft ICE. But what if you have three series of pictures for the panorama &#8211; each serial taken with a different exposure time? With single images it&#8217;s easy to merge the images into an HDR image by using Photoshop or Photomatix for example. But combining both techniques into a HDR panorama is a little tricky, hence I wrote this tutorial with a solution that worked for me.</p>
<h2>Autopano Giga and HDRs</h2>
<p>The &#8220;Giga&#8221; version of Autopano supports working with multiple exposure series. So my first idea is to just apply the Autopano workflow to all the pictures that will belong to the panorama. There&#8217;re 12 pictures in my case and Autopano automatically sorts them into 4 panorama parts (4 views á 3 different exposure times).</p>
<p><a href="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_imported_images.jpg"><img class="aligncenter size-full wp-image-182" title="autopano_imported_images" src="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_imported_images.jpg" alt="" width="403" height="388" /></a></p>
<p>Now I just apply the detection and change to the editing mode of the resulting panorama. There I choose not to apply any color correction (I want to tone map the HDR later anyway) plus I crop the borders. Notice the layer setting to output only one blended layer.</p>
<p><a href="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_click_on_edit.jpg"><img class="aligncenter size-full wp-image-183" title="autopano_click_on_edit" src="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_click_on_edit.jpg" alt="" width="662" height="404" /></a></p>
<p style="text-align: center;"><a href="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_edit_panorama_blendedlayer.jpg"><img class="aligncenter size-full wp-image-184" title="autopano_edit_panorama_blendedlayer" src="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_edit_panorama_blendedlayer.jpg" alt="" width="811" height="567" /></a></p>
<p>Now I just render the panorama with one target .hdr file.</p>
<p><a href="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_render_settings_hdr.jpg"><img class="aligncenter size-full wp-image-185" title="autopano_render_settings_hdr" src="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_render_settings_hdr.jpg" alt="" width="429" height="679" /></a></p>
<p>So far so good. Next I open the hdr file I just created in Photomatix to do some tone mapping, but what&#8217;s this?</p>
<p style="text-align: center;"><a href="http://www.justpowered.de/blog/wp-content/uploads/2010/08/photomatix_issues_with_autopano_hdr.jpg"><img class="aligncenter size-large wp-image-186" title="photomatix_issues_with_autopano_hdr" src="http://www.justpowered.de/blog/wp-content/uploads/2010/08/photomatix_issues_with_autopano_hdr-1024x261.jpg" alt="" width="819" height="209" /></a></p>
<p>Seems like this does not work the way I want to. There&#8217;re many ugly blending errors and the light spots are all overspilled!</p>
<h2>The workaround</h2>
<p>Ok, back to Autopano&#8217;s edit panorama mode. In the layer section I now chose &#8220;Group by speed&#8221; as I want to get a separate panorama image for each exposure serial, but with exactly the same panorama stitching (the three panoramas have to match each other exactly, otherwise the later HDR generation in Photomatix would screw up the .hdr entirely).</p>
<p><a href="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_layer_settings_group_by_speed.jpg"><img class="aligncenter size-full wp-image-199" title="autopano_layer_settings_group_by_speed" src="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_layer_settings_group_by_speed.jpg" alt="" width="327" height="146" /></a></p>
<p>Now again I render the panorama but not targeting one .hdr file. Instead I choose the 8Bits TIFF format. To get one TIFF per exposure serial I have to add a &#8220;%L&#8221; to the file name for the layer name.</p>
<p><a href="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_export_tiff_layers.jpg"><img class="aligncenter size-full wp-image-187" title="autopano_export_tiff_layers" src="http://www.justpowered.de/blog/wp-content/uploads/2010/08/autopano_export_tiff_layers.jpg" alt="" width="424" height="676" /></a></p>
<p>Great, after exporting I get three TIFF images with the stitched panorama for each exposure serial.</p>
<h2>HDR generation &amp; tone mapping</h2>
<p>The next step is as simple as I is with non-panoramic pictures. I just create a new panorama in Photomatix and deactivate the alignment tool (the panorama, taken using a tripod, is already aligned) and activate the ghost reduction for objects and people (this happens quite often with exposures lower than 5 seconds). Really important is to activate the noise reduction &#8211; otherwise the hdr will look like a Christmas tree. Finally, after applying the tone mapping and doing some little fixes in GIMP (sharpen, denoise, contrast), it&#8217;s a nice HDR panorama.</p>
<p style="text-align: center;"><a href="http://www.justpowered.de/blog/wp-content/uploads/2010/08/markt_tonemapped.jpg"><img class="aligncenter size-large wp-image-189" title="markt_tonemapped" src="http://www.justpowered.de/blog/wp-content/uploads/2010/08/markt_tonemapped-1024x338.jpg" alt="" width="747" height="247" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/misc/hdr-panorama-tutorial.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spread pages book layout in PDF documents</title>
		<link>http://www.justpowered.de/blog/uncategorized/spread-pages-book-layout-in-pdf-documents.html</link>
		<comments>http://www.justpowered.de/blog/uncategorized/spread-pages-book-layout-in-pdf-documents.html#comments</comments>
		<pubDate>Thu, 11 Mar 2010 19:50:08 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=170</guid>
		<description><![CDATA[This week I composed a document with flyleaf and subsequent two-paged layout like in these two examples with Adobe Indesign and Microsoft Word: But when exporting/printing to a PDF file the PDF document in Acrobat Reader shows only a single page at a time. One may manually select the view option with two-paged layout and [...]]]></description>
			<content:encoded><![CDATA[<p>This week I composed a document with flyleaf and subsequent two-paged layout like in these two examples with Adobe Indesign and Microsoft Word:</p>
<p><img class="size-full wp-image-171 aligncenter" title="Example for two-paged layout in InDesign and Word" src="http://www.justpowered.de/blog/wp-content/uploads/2010/03/blog_indd_word.png" alt="" width="563" height="252" />But when exporting/printing to a PDF file the PDF document in Acrobat Reader shows only a single page at a time. One may manually select the view option with two-paged layout and flyleaf but I wanted the document to be always shown that way! After Googling I found a <a href="http://indesignsecrets.com/make-it-look-like-a-book-in-the-acrobat-pdf.php" target="_blank">solution using Adobe Acrobat Pro</a> where it is possible to set this option and save the changes directly to the PDF file. Unfortunately Acrobat Pro isn&#8217;t cheap and I don&#8217;t own a copy so I looked for an alternative.</p>
<p>Finally I found <a href="http://www.becyhome.de/becypdfmetaedit/description_eng.htm" target="_blank">BeCyPDFMetaEdit by Benjamin Bentmann</a> which is a small freeware Windows utility for changing the XMP meta data of a PDF document file. The viewer preference  actually is just a XMP setting. The program can remove any application or pdf printer metadata as well (like &#8220;Created with &#8230;foo program&#8221; or &#8220;Printed using PDF&#8230;bar&#8221;). The result after opening the PDF document in Adobe Acrobat Reader then looks like (before vs. after):</p>
<p><img class="aligncenter size-full wp-image-172" title="Comparison of Acrobat reader viewer layouts" src="http://www.justpowered.de/blog/wp-content/uploads/2010/03/blog_acroreader_flyleaf2paged.png" alt="" width="539" height="391" />Ta-da, A book!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/uncategorized/spread-pages-book-layout-in-pdf-documents.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl -e in Windows batch and Linux shell scripts</title>
		<link>http://www.justpowered.de/blog/linux/perl-e-in-windows-batch-and-linux-shell-scripts.html</link>
		<comments>http://www.justpowered.de/blog/linux/perl-e-in-windows-batch-and-linux-shell-scripts.html#comments</comments>
		<pubDate>Thu, 11 Mar 2010 16:47:16 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[PERL]]></category>
		<category><![CDATA[shell/batch]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=163</guid>
		<description><![CDATA[Recently I had to extract a partial string from a space-seperated list of names in a loop within a script. There have to be two versions of that script, one for Windows and one for Linux shell. To loop through one such list is quite easy, in Windows: and in Linux shell: But now came [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to extract a partial string from a space-seperated list of names in a loop within a script. There have to be two versions of that script, one for Windows and one for Linux shell. To loop through <strong>one </strong>such list is quite easy, in Windows:</p>
<pre class="brush: bash; title: ; notranslate">
@echo off
SETLOCAL
set WEBSITES=Test1 Test2 Test3

FOR /D %%A IN (%WEBSITES%) DO (
 echo WebsiteName=%%A
)
GOTO :EOF

ENDLOCAL
</pre>
<p>and in Linux shell:</p>
<pre class="brush: bash; title: ; notranslate">
WEBSITES=&quot;Test1 Test2 Test3&quot;

for WEBSITE_ALIAS in $WEBSITES ; do
 echo &quot;Website= $WEBSITE_ALIAS ...&quot;
done
</pre>
<p>But now came a <strong>second </strong>list of string into play containing the domain names of the website aliases:</p>
<pre class="brush: bash; title: ; notranslate">
WEBSITES=&quot;Test1 Test2 Test3&quot;
DOMAINNAMES=&quot;www.test1.lan www.test2.lan www.test3.lan&quot;
</pre>
<p>In a conventional programming language I would just use a <em>for</em>-loop with an index variable and utilize that variable to access both arrays within one loop. But in that batch/shell scripting this turned out to be quite tricky. My solution here was a small inline PERL script. For Windows:</p>
<pre class="brush: bash; title: ; notranslate">
set WEBSITE_UNIT=Unit4
set WEBSITES=Test1 Test2 Test3
set DOMAINNAMES=www.test1.lan www.test2.lan www.test3.lan
perl -e &quot;use strict; die(\&quot;argv mismatch!\&quot;) if !@ARGV or scalar(@ARGV) &lt; 2; my @Websites = split(/[\s,;\|]/, $ARGV[0]); my @Domains = split(/[\s,;\|]/, $ARGV[1]); die(\&quot;number of aliases differs from domain names!\&quot;) if scalar(@Websites) != scalar(@Domains); for(my $i=0; $i&lt;scalar(@Websites); $i++) { system('perl dosomething.pl -user /Root/'.$ENV{'WEBSITE_UNIT'}.'/admin -passwd admin -servername '.$ENV{'SERVER_NAME'}.' -alias '.$Website[$i].''); system('perl doanotherthing.pl -user /Root/'.$ENV{'WEBSITE_UNIT'}.'/admin -passwd admin -alias '.$Website[$i].' DomainName=\&quot;'.$Domains[$i].'\&quot;'); }&quot; &quot;%WEBSITES%&quot; &quot;%DOMAINNAMES%&quot;
</pre>
<p>And for Linux:</p>
<pre class="brush: bash; title: ; notranslate">
WEBSITE_UNIT=Unit4
WEBSITES=&quot;Test1 Test2 Test3&quot;
DOMAINNAMES=&quot;www.test1.lan www.test2.lan www.test3.lan&quot;
perl -e 'use strict; die(&quot;argv mismatch!&quot;) if !@ARGV or scalar(@ARGV) &lt; 2; my @Websites = split(/[\s,;\|]/, $ARGV[0]); my @Domains = split(/[\s,;\|]/, $ARGV[1]); die(&quot;number of aliases differs from domain names!&quot;) if scalar(@Websites) != scalar(@Domains); for(my $i=0; $i&lt;scalar(@Websites); $i++) { system(&quot;perl dosomething.pl -user /Root/'${WEBSITE_UNIT}'/admin -passwd admin -servername &quot;.$ENV{&quot;SERVER_NAME&quot;}.&quot; -alias &quot;.$Website[$i].&quot;&quot;); system(&quot;perl doanotherthing.pl -user /Root/'${WEBSITE_UNIT}'/admin -passwd admin -alias &quot;.$Website[$i].&quot; DomainName=\&quot;&quot;.$Domains[$i].&quot;\&quot;&quot;);  }' &quot;$WEBSITES&quot; &quot;$DOMAINNAMES&quot;
</pre>
<p>Notice the different handling of the ticks and quotes and the different access to external parameters. In Windows there&#8217;s no difference in PERL&#8217;s $ENV hash whether accessing real environment variables or local variables set by the batch script. Not so under Linux: I can only access my system-wide exported environment variable SERVER_NAME using $ENV but not my local script&#8217;s WEBSITE_UNIT variable. When using the exec<em> -e</em> with perl for Windows I had to use quotes to wrap the execution PERL-code but for linux shell, I needed single <strong>&#8216;</strong>-ticks which can NOT be used inside the PERL code &#8211; not event when escapting them like <strong>\&#8217;. </strong>The single ticks are &#8220;reserved&#8221; by the shell script for being able to insert shell variables anywhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/linux/perl-e-in-windows-batch-and-linux-shell-scripts.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Disable auto word wrap in nano</title>
		<link>http://www.justpowered.de/blog/linux/disable-auto-word-wrap-in-nano.html</link>
		<comments>http://www.justpowered.de/blog/linux/disable-auto-word-wrap-in-nano.html#comments</comments>
		<pubDate>Wed, 16 Dec 2009 08:30:22 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[nano]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tty]]></category>
		<category><![CDATA[word wrap]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=145</guid>
		<description><![CDATA[Quite annoying when editing source code via console in nano is the automatic word wrap, which often screws up compilation of the edited file. To disable the word wrap, just edit the .nanorc in your home directory and add: You can also do this when starting nano:]]></description>
			<content:encoded><![CDATA[<p>Quite annoying when editing source code via console in nano is the automatic word wrap, which often screws up compilation of the edited file. To disable the word wrap, just edit the .nanorc in your home directory and add:</p>
<pre class="brush: bash; title: ; notranslate">

set nowrap
</pre>
<p>You can also do this when starting nano:</p>
<pre class="brush: bash; title: ; notranslate">

nano -w &lt;file&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/linux/disable-auto-word-wrap-in-nano.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Focal length stats</title>
		<link>http://www.justpowered.de/blog/uncategorized/focal-length-stats.html</link>
		<comments>http://www.justpowered.de/blog/uncategorized/focal-length-stats.html#comments</comments>
		<pubDate>Thu, 12 Nov 2009 13:35:43 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[focal]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[length]]></category>
		<category><![CDATA[lens]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=132</guid>
		<description><![CDATA[Benjamin recently posted a diagram with the results of my FocalApp application applied to all his images. Here&#8217;re the results with my images: Obviously I only posess the 18-55mm Kit lens and I use smaller focal lenths more often. The Google chart API is quite handy for such simple statistics.]]></description>
			<content:encoded><![CDATA[<p>Benjamin recently posted a <a href="http://foto.benjaminbaum.de/?p=407" target="_blank">diagram with the results of my FocalApp application</a> applied to all his images. Here&#8217;re the results with my images:</p>
<div>
<img height="215" width="450" alt="" src="http://chart.apis.google.com/chart?cht=bvs&amp;chco=FF7400|4D89F9|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F|9F9F9F&amp;chd=t:1523,1016,119,115,112,106,103,102,95,89,81,81,77,74&amp;chds=0,1523&amp;chs=450x215&amp;chxt=x,y&amp;chxl=0:|18|55|21|27|22|28|31|25|35|33|37|30|24|34|1:|0|250|500|750|1000|1250|1523" title="Brennweitenstatistik" class="alignnone">
</div>
<p>Obviously I only posess the 18-55mm Kit lens and I use smaller focal lenths more often. The Google chart API is quite handy for such simple statistics.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/uncategorized/focal-length-stats.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FocalApp v0.2</title>
		<link>http://www.justpowered.de/blog/java/focalapp-v0-2.html</link>
		<comments>http://www.justpowered.de/blog/java/focalapp-v0-2.html#comments</comments>
		<pubDate>Wed, 11 Nov 2009 17:20:43 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[exif]]></category>
		<category><![CDATA[FILE]]></category>
		<category><![CDATA[focal]]></category>
		<category><![CDATA[focus]]></category>
		<category><![CDATA[garbage collector]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=121</guid>
		<description><![CDATA[I changed my FocalApp java application a little bit. First, there was sometimes a memory exception as the old version did a &#8220;new File()&#8221; in each loop iteration and apparently the garbage collector couldn&#8217;t catch up. I moved the file-open operation into an own class method and now the GC seems to get its job [...]]]></description>
			<content:encoded><![CDATA[<p>I changed my FocalApp java application a little bit. First, there was sometimes a memory exception as the old version did a &#8220;new File()&#8221; in each loop iteration and apparently the garbage collector couldn&#8217;t catch up. I moved the file-open operation into an own class method and now the GC seems to get its job done. Second, I added some more command line parameters for specifying the camera model, the file extensions and the file name pattern &#8211; which all filter the resulting image file list used for the focal length count. Hence one can now say &#8220;Only count the images whose EXIF data&#8217;s camera model is a Canon 300D, but only the CRW files and only the files starting with CRW_50&#8243;. In addition I added a little help screen:</p>
<pre class="brush: bash; title: ; notranslate">
Build:
javac -Xlint:unchecked -classpath .;metadata-extractor-2.4.0-beta-1.jar FocalApp.java
jar cfm FocalApp.jar Manifest.txt *.class

Usage:
java -jar FocalApp.jar [Options]

Description:
For all images in the given directory and its subdirectories read the
lenses' focal length from the exif data and print a summary of how
often the particular focal lengths are used.

Currently this program works with the following image types:
* JPEG
* CRW - Canon Raw
* CR2 - Canon Raw v2
* NEF - Nikon Raw
* ARW - Sony Raw
* TIF/TIFF

Options:
-imagepath          path for the images to work on                          (required)
-camera             string with the name of the camera, the program will    (optional)
only count the images containing that camera name
-fileext            only count images with that file extension(s)           (optional)
-filename           only count images matching this regular expression      (optional)

Examples:
java -jar FocalApp.jar -imagedir &quot;D:\testimages&quot;
java -jar FocalApp.jar -imagedir &quot;D:\testimages&quot; -camera &quot;Canon EOS 30D&quot;
-fileext &quot;jpg,crw&quot; -filename &quot;^CRW(.*)&quot;
</pre>
<p>Feel free to get the new version <a href="http://www.justpowered.de/blog/wp-content/uploads/2009/11/focalapp_v0.2.zip">here</a>. You can find the original blog post to the FocalApp <a href="http://www.justpowered.de/blog/perl/most-widely-used-camera-focus-length.html" target="_self">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/java/focalapp-v0-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find all files containing a string but NOT containing another</title>
		<link>http://www.justpowered.de/blog/uncategorized/find-all-files-containing-a-string-but-not-containing-another.html</link>
		<comments>http://www.justpowered.de/blog/uncategorized/find-all-files-containing-a-string-but-not-containing-another.html#comments</comments>
		<pubDate>Thu, 29 Oct 2009 09:08:53 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=108</guid>
		<description><![CDATA[Find all files containing a string but NOT containing another. Believe it or not, this was quite a challenge. I tried to use precedent and subsequente regular expressions in UltraEdit for this but UltraEdit&#8217;s regex is quite dumb. So I came up with good-old shell: Beginning from the current directory (&#8220;find .&#8221;) this finds all [...]]]></description>
			<content:encoded><![CDATA[<p>Find all files containing a string but NOT containing another.</p>
<p>Believe it or not, this was quite a challenge. I tried to use precedent and subsequente regular expressions in UltraEdit for this but UltraEdit&#8217;s regex is quite dumb. So I came up with good-old shell:</p>
<pre class="brush: bash; title: ; notranslate">

find . -name &quot;*html&quot; | xargs grep -l 'StringA' | xargs grep -L 'StringB'
</pre>
<p>Beginning from the current directory (&#8220;find .&#8221;) this finds all html files containing the string &#8216;StringA&#8217; in the first grep statement but NOT the ones containing the string &#8216;StringB&#8217; in the second grep statement. If any nerd could tell me how to do this more easily, this would bring light in my day-to-day life. <img src='http://www.justpowered.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Actually this shell piping is pretty fast. I ran this over hundreds of html files in half of a second. Using PERL you&#8217;d need 30 lines and half an hour, I think.</p>
<p>To do this in Windows, you&#8217;ll need gfind, xargs and GNU grep (see <a href="http://unxutils.sourceforge.net/" target="_blank">UnxUtils website</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/uncategorized/find-all-files-containing-a-string-but-not-containing-another.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New wordpress theme</title>
		<link>http://www.justpowered.de/blog/uncategorized/new-wordpress-theme.html</link>
		<comments>http://www.justpowered.de/blog/uncategorized/new-wordpress-theme.html#comments</comments>
		<pubDate>Wed, 28 Oct 2009 17:21:00 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=103</guid>
		<description><![CDATA[With the default wordpress theme the size of the centre column was too small. So I changed to a new theme, called &#8220;Arclite&#8221;. Source code should be better readable now.]]></description>
			<content:encoded><![CDATA[<p>With the default wordpress theme the size of the centre column was too small. So I changed to a new theme, called &#8220;Arclite&#8221;. Source code should be better readable now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/uncategorized/new-wordpress-theme.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Most widely used camera focus length</title>
		<link>http://www.justpowered.de/blog/perl/most-widely-used-camera-focus-length.html</link>
		<comments>http://www.justpowered.de/blog/perl/most-widely-used-camera-focus-length.html#comments</comments>
		<pubDate>Tue, 27 Oct 2009 17:23:49 +0000</pubDate>
		<dc:creator>ampere</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[PERL]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[exif]]></category>
		<category><![CDATA[focal]]></category>
		<category><![CDATA[focus]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sort by value]]></category>
		<category><![CDATA[treemap]]></category>

		<guid isPermaLink="false">http://www.justpowered.de/blog/?p=90</guid>
		<description><![CDATA[Recently a collegue of mine argued that he more often needs a small camera focus length (wide-angled) than a zoom focus length (tele). To proof &#8211; or confute &#8211; this I wrote a small java program which extracts the exif data from a given directory of images and counts the focal length parameters used when [...]]]></description>
			<content:encoded><![CDATA[<p>Recently a collegue of mine argued that he more often needs a small camera focus length (wide-angled) than a zoom focus length (tele). To proof &#8211; or confute &#8211; this I wrote a small java program which extracts the exif data from a given directory of images and counts the focal length parameters used when taking the pictures. I used the beta version of <a title="Link to the metadata extractor jar library" href="http://www.drewnoakes.com/code/exif/" target="_blank">Drew Noakes&#8217; metadata extractor</a>. As I haven&#8217;t coded in java for some time, the code might be a little bit dirty.</p>
<pre class="brush: java; title: ; notranslate">
import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.exif.ExifReader;
import com.drew.metadata.iptc.IptcReader;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGDecodeParam;
import com.sun.image.codec.jpeg.JPEGImageDecoder;
import com.drew.metadata.*;
import com.drew.metadata.exif.ExifDirectory;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.FilenameFilter;
import java.util.*;
import java.util.regex.*;

public class FocalApp {
 public FocalApp(String dirname) {
 // list of files
 File folder = new File(dirname);
 List&lt;File&gt; filelist = new ArrayList&lt;File&gt;();
 this.getFiles(folder, filelist);

 // key - value pairs: focallength - count
 SortedMap&lt;Double, Integer&gt; focalmap = new TreeMap&lt;Double,Integer&gt;();

 // for all found files
 for (Iterator it=filelist.iterator(); it.hasNext(); ) {
 String filename = it.next().toString();
 //System.out.println(&quot; --- working on file: &quot;+filename);

 File imageFile = new File(filename);
 try {
 Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
 Directory exifDirectory = metadata.getDirectory(ExifDirectory.class);

 Double cameraFocus = 0.0;
 try {
 String cameraFocusString = exifDirectory.getString(ExifDirectory.TAG_FOCAL_LENGTH);
 if (cameraFocusString != null) {
 // value is present
 cameraFocus = Double.parseDouble(cameraFocusString);
 }
 //System.out.println(&quot;Focus lenght = &quot; + cameraFocus);
 } catch(NumberFormatException nFE) {
 //System.out.println(&quot;Not an Integer&quot;);
 }

 Integer currentimagecount = 0;
 if(focalmap.containsKey(cameraFocus)) {
 //System.out.println(&quot;key already tgere&quot;);
 currentimagecount = focalmap.get(cameraFocus);
 }
 currentimagecount++;
 //System.out.println(&quot;putting in map: &quot;+currentvalue);
 focalmap.put(cameraFocus, currentimagecount);
 } catch (ImageProcessingException e) {
 System.err.println(&quot;skipping file &quot;+filename+&quot;due to error:&quot;+e);
 }
 }

 Integer totalimagecount = 0;

 TreeSet set = new TreeSet(new Comparator() {
 public int compare(Object obj, Object obj1) {
 int vcomp = ((Comparable) ((Map.Entry) obj1).getValue()).compareTo(((Map.Entry)
 obj).getValue());
 if (vcomp != 0) return vcomp;
 else return ((Comparable) ((Map.Entry) obj1).getKey()).compareTo(((Map.Entry)
 obj).getKey());

 }
 });

 set.addAll(focalmap.entrySet());
 System.out.println(&quot;focal length in mm;number of images;&quot;);
 for (Iterator i = set.iterator(); i.hasNext();) {
 Map.Entry entry = (Map.Entry) i.next();
 Double key = (Double) entry.getKey();
 String keyname;
 if(key == 0) {
 keyname = &quot;?&quot;;
 } else {
 keyname = key.toString();
 }
 Integer numimages = (Integer) entry.getValue();
 System.out.println(keyname + &quot;;&quot; + numimages+&quot;;&quot;);
 totalimagecount+=numimages;
 }

 //System.out.println(&quot;total: &quot;+totalimagecount+&quot; images.&quot;);
 }

 private void getFiles(File folder, List&lt;File&gt; list) {
 folder.setReadOnly();

 File[] files = folder.listFiles(new ImageFileFilter());
 for(int j = 0; j &lt; files.length; j++) {
 list.add(files[j]);
 }

 File[] subfolders = folder.listFiles();
 for(int j = 0; j &lt; subfolders.length; j++) {
 if(subfolders[j].isDirectory()) {
 getFiles(subfolders[j], list);
 }
 }
 }

 public static void main(String[] args)
 {
 if(args.length &gt; 0 &amp;&amp; args[0].length() &gt; 0) {
 String imagepath = args[0];
 if(new File(imagepath).exists()) {
 new FocalApp(imagepath);
 } else {
 System.err.println(&quot;given image directory not found!&quot;);
 System.exit(2);
 }
 } else {
 System.err.println(&quot;please give a directory containing the images!&quot;);
 System.exit(1);
 }
 }
}

class ImageFileFilter implements FilenameFilter
{
 public boolean accept( File f, String s )
 {
 Pattern pattern = Pattern.compile(&quot;([^\\s]+(?=\\.(jpg|crw|cr2|nef|arw|tiff|tif))\\.\\2)&quot;, Pattern.CASE_INSENSITIVE);
 return pattern.matcher(s).matches();
 }
}
</pre>
<p>I used JDK 1.6. To build, you&#8217;ll need the &#8220;metadata-extractor-2.4.0-beta-1.jar&#8221; from the <a title="Link to the metadata extractor jar library" href="http://www.drewnoakes.com/code/exif/" target="_blank">metadata extractor</a> page. Then use:</p>
<pre class="brush: bash; title: ; notranslate">
javac -Xlint:unchecked -classpath .;metadata-extractor-2.4.0-beta-1.jar FocalApp.java
jar cfm FocalApp.jar Manifest.txt *.class
</pre>
<p>to build it. The Manifest.txt is just for entry method:</p>
<pre class="brush: bash; title: ; notranslate">
Manifest-Version: 1.0
Created-By: 1.6.0 (Sun Microsystems Inc.)
Class-Path: metadata-extractor-2.4.0-beta-1.jar
Main-Class: FocalApp
</pre>
<p>The run the jar, i.e. using:</p>
<pre class="brush: bash; title: ; notranslate">
java -jar FocalApp.jar &quot;/path/to/your/images&quot;
</pre>
<p>A tricky construct I had to google for after all the java-free months was how to sort a TreeMap by its values and not by the keys. In PERL this is simple (see <a title="Hash section of the perlfaq4 page" href="http://perldoc.perl.org/perlfaq4.html#How-do-I-sort-a-hash-%28optionally-by-value-instead-of-key%29?" target="_blank">Perlfaq4 </a>for example):</p>
<pre class="brush: perl; title: ; notranslate">
my @keys = sort { $hash{$a} &lt;=&gt; $hash{$b} } keys %hash;
</pre>
<p>You get an array containig the hash&#8217;s keys, but sorted in the order of the hash&#8217;s values.<br />
Now you can just iterate over the keys, displaying the values which could be something like that:</p>
<pre class="brush: perl; title: ; notranslate">
foreach my $Key (@keys) {
  print &quot;Key $Key has value $hash{$Key}&quot;;
}
</pre>
<p>In java I couldn&#8217;t find such an easy solution. First, I use a TreeMap to store the key-value pairs. This can already sort by keys using a SortedMap. But to turn the sorting around I needed put the entire content of that SortedMap into a TreeSet collection (code line 78), which uses a custom Comperator instance. I got this snippet from this <a href="http://forums.sun.com/thread.jspa?threadID=634742" target="_blank">forum page</a>.</p>
<p>You can download the java code in a zip from <a href="http://www.justpowered.de/blog/wp-content/uploads/2009/10/focalapp.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justpowered.de/blog/perl/most-widely-used-camera-focus-length.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

