<?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>Lachlan.Rogers.name &#187; Hacks and Tricks</title>
	<atom:link href="http://lachlan.rogers.name/category/hacks-and-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://lachlan.rogers.name</link>
	<description>An online home</description>
	<lastBuildDate>Mon, 04 Jul 2011 12:54:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Tau really does make more sense</title>
		<link>http://lachlan.rogers.name/2011/07/tau-really-does-mak-more-sense/</link>
		<comments>http://lachlan.rogers.name/2011/07/tau-really-does-mak-more-sense/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 12:54:46 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=934</guid>
		<description><![CDATA[Pi is wrong. This startling assertion became so abundantly clear to me last week that I was surprised it has taken this long for me to encounter the arguments. Of course, as the number of diameters in a circle&#8217;s circumference then pi = 3.141592 653589 793238 462643 383279 50288&#8230; is technically correct. But it is [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_935" class="wp-caption alignleft" style="width: 310px"><a href="http://lachlan.rogers.name/wordpress/wp-content/uploads/2011/07/DSC_6909.jpg" rel="lightbox"><img class="size-medium wp-image-935" title="Tau Day pies" src="http://lachlan.rogers.name/wordpress/wp-content/uploads/2011/07/DSC_6909-300x199.jpg" alt="Baked pies" width="300" height="199" /></a><p class="wp-caption-text">Tau Day is celebrated with two pi(e)s, and we couldn't let that expectation go unfulfilled.</p></div>
<p>Pi is wrong.  This startling assertion became so abundantly clear to me last week that I was surprised it has taken this long for me to encounter the arguments.  Of course, as the number of diameters in a circle&#8217;s circumference then pi = 3.141592 653589 793238 462643 383279 50288&#8230; is technically correct.  But it is wrong <em>conceptually</em>!  Mathematically it is the radius, not the diameter, which is the defining dimension of a circle.</p>
<p>And so a better circle constant is τ (tau) =2π.  Happily I learnt of this just in time to celebrate Tau Day.</p>
<p>There are many excellent reasons why tau is better than pi, and I won&#8217;t bother presenting them all here.  Michael Hartl makes the argument convincingly in The Tau Manifesto if you are looking for some reading, but this video presents the salient points in a thoroughly entertaining way.</p>
<p><iframe width="425" height="349" src="http://www.youtube.com/embed/jG7vhMMXagQ" frameborder="0" allowfullscreen></iframe></p>
<p>If you&#8217;re strugging to catch on to tau as the new circle constant, then maybe this musical representation of the number will help.</p>
<p><iframe width="560" height="349" src="http://www.youtube.com/embed/3174T-3-59Q" frameborder="0" allowfullscreen></iframe></p>
<p>We dutifully and cheerfully celebrated Tau Day with two pies, and it is a shame that next June 28 is a year away.  I guess that is a full year in which to extol the virtues of Tau.</p>
<p>And there&#8217;s another job to do.  The 36 digits of pi listed above were written from memory. I have them firmly lodged in my brain as a result of a friendly competition in grade 5.  Now I&#8217;m going to have to memorise at least <a href="http://www.wolframalpha.com/input/?i=N[2+Pi%2C+37]">37 digits of tau</a>!</p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2011/07/tau-really-does-mak-more-sense/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Revisiting categories, and generally improving this site</title>
		<link>http://lachlan.rogers.name/2010/05/revisiting-categories-and-generally-improving-this-site/</link>
		<comments>http://lachlan.rogers.name/2010/05/revisiting-categories-and-generally-improving-this-site/#comments</comments>
		<pubDate>Mon, 17 May 2010 11:56:38 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Lachlan.Rogers.name]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=618</guid>
		<description><![CDATA[When I first started using WordPress to construct this website, it had &#8220;categories&#8221; and not &#8220;tags&#8221;. Since then, I have tried to improve my use of categories and tags have come along to add another complication to the fray. I have now finally reached a system that I really like. One of the difficulties of [...]]]></description>
			<content:encoded><![CDATA[<p>When I first started using WordPress to construct this website, it had &#8220;categories&#8221; and not &#8220;tags&#8221;.  Since then, <a href="http://lachlan.rogers.name/2007/08/the-trouble-with-hierarchical-categories/">I have tried to improve my use of categories</a> and tags have come along to add another complication to the fray.  I have now finally reached a system that I really like.</p>
<p>One of the difficulties of a personal website (as opposed to a blog on a specific topic) is that there is such a variety of post types.  Sometimes the site becomes a little soap-box where essays can be delivered.  Other times, it is a news feed to keep family and friends updated about exciting travel activities.  It is also a valuable way to store and share helpful tricks and insights.</p>
<p>So I have now culled my category list down to six distinct topics, and a seventh &#8220;uncategorised&#8221; overflow pigeonhole.  Within these broad categories, posts are further grouped by tags.  It is possible to browse posts by category, or by tag.  While I&#8217;m not claiming that this sort of organising strategy is anything new or unique, I think it is finally a functional way to hold this site together.</p>
<p>I have also revamped this site visually and under the bonnet.  Here are some of the more technical details.<br />
<span id="more-618"></span></p>
<p>There are times when I need more space for a wide post (such as for <a href="http://lachlan.rogers.name/2009/03/pathfinder-expedition-at-mt-selwyn/">this embedded interactive map with geotagged photos</a>).  To do this, I created a &#8220;Without sidebar&#8221; category and then told my wordpress to leave out the sidebar for any post in this category.  After reorganising, I didn&#8217;t want this category to feature in my condensed list.</p>
<p>I was able to exclude it by modifying the category widget section of the file <code>wp-includes/default-widgets.php</code> to replace the line</p>
<p><code>$cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);</code></p>
<p>with</p>
<p><code>$cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, 'exclude' => '27');</code></p>
<p>(where 27 is the number of my &#8220;Without sidebar&#8221; category).  I found the details for this <a href="http://www.lancelhoff.com/exclude-categories-from-sidebar-in-wordpress-26/">here</a>, but had to work out how to apply them to my situation.</p>
<p>Another thing that has changed since I started this site is the incorporation of my RSS feeds into other online social environments.  My posts here get imported to my Facebook profile as notes, and they also get pulled in as Buzzes with Google.  Both these locations allow people to comment on my writing there rather than here, but I would prefer people to participate in the conversation here.  This website is visible and accessible to people without requiring them to create a profile and log on.  </p>
<p>I have found a <a href="http://code.google.com/p/sig2feed/">wordpress plugin that will add a &#8220;signature&#8221; to my RSS feeds</a>.  If it works properly, my posts here that get displayed elsewhere will have a little comment encouraging readers to join the conversation on the original post.</p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2010/05/revisiting-categories-and-generally-improving-this-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Renaming photos to give attribution</title>
		<link>http://lachlan.rogers.name/2010/02/renaming-photos-to-give-attribution/</link>
		<comments>http://lachlan.rogers.name/2010/02/renaming-photos-to-give-attribution/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 10:44:43 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[bash shell]]></category>
		<category><![CDATA[GNU/Linux]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=585</guid>
		<description><![CDATA[At ASA Convention, a number of us took many photographs.  Late on the last night, I helped compile the highlights into a souvenir data DVD.  Using the nifty little exiv2 utility, I was able to adjust the image timestamps and retrospectively synchronise the clocks in every camera.  This makes for very enjoyable photo browsing, as [...]]]></description>
			<content:encoded><![CDATA[<p>At ASA Convention, a number of us took many photographs.  Late on the last night, I helped compile the highlights into a souvenir data DVD.  Using the nifty little <code>exiv2</code> utility, I was able to adjust the image timestamps and retrospectively synchronise the clocks in every camera.  This makes for very enjoyable photo browsing, as you can view chronologically regardless of which camera was used.</p>
<p>Unfortunately I was too rushed to place attribution in the filenames, and so it is not obvious who took each photo.  Luckily we all used different camera models, and that information is still present in the exif metadata.  I used this to split the photos into directories and embed the photographer in both metadata and filename.</p>
<p>I was shooting on my Nikon D200, and so was able to separate my photos by:</p>
<p><code>for ii in *.jpg; do if grep -q "NIKON D200" $ii ; then mv $ii lachlan/ ; fi ; done</code></p>
<p>This says: for each jpg file, check if it contains &#8220;NIKON D200&#8243; in the exif metadata and if it does then move it to the subdirectory lachlan/</p>
<p>All you need to do is find the camera model string to search for (my friends with Canons had things like &#8220;Canon EOS 30D&#8221;).  Now I&#8217;m going to append photographer names to the filenames, and then return them to their original chronological directories.</p>
<p>[<em>For Facebook Notes readers: this post is redirected from my personal website <a title="Lachlan.Rogers.name &gt;&gt; Renaming photos to give attribution" href="http://lachlan.rogers.name/2010/02/renaming-photos-to-give-attribution/">lachlan.rogers.name</a></em>]</p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2010/02/renaming-photos-to-give-attribution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Producing handout with LaTeX Beamer</title>
		<link>http://lachlan.rogers.name/2009/11/producing-handout-with-latex-beamer/</link>
		<comments>http://lachlan.rogers.name/2009/11/producing-handout-with-latex-beamer/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 12:23:52 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[bash shell]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Latex]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=489</guid>
		<description><![CDATA[I jotted this down a year ago when I needed to produce a set of handout notes for a 3rd year physics lecture I took. Just last week, after taking a similar set of lectures, I wanted to find it but couldn&#8217;t. Murphy&#8217;s Law has come into effect, and my jotted note has turned up [...]]]></description>
			<content:encoded><![CDATA[<p>I jotted this down a year ago when I needed to produce a set of handout notes for a 3rd year physics lecture I took.  Just last week, after taking a similar set of lectures, I wanted to find it but couldn&#8217;t.  Murphy&#8217;s Law has come into effect, and my jotted note has turned up now that my need for it has passed.</p>
<p>The Beamer class for LaTeX is a great way to produce very nice presentation slides with useful features such as automatic progress markers and internal hyperlinks.  Being LaTeX, it is also possible to completely change the output formatting by simply altering certain document settings.  This allows me to produce slides that have black backgrounds for better projection onto a screen, and then change a single line (specifying the colour theme) to get a white-background version optimised for printing on paper.</p>
<p>To make it even more efficient to print, I used the following command to fit 3 slides to an A4 page:</p>
<p><code>pdfnup  --frame false --nup 1x3 --paper a4paper --orient auto --pages all --trim "0 0 0 0" --delta "1cm 1cm" --offset "0 0" --scale 0.91 --turn true --noautoscale false --openright false --column false --columnstrict false --tidy true --outfile main3up.pdf main.pdf</code></p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2009/11/producing-handout-with-latex-beamer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting video files for playback on Android Google Phone</title>
		<link>http://lachlan.rogers.name/2009/09/converting-video-files-for-playback-on-android-google-phone/</link>
		<comments>http://lachlan.rogers.name/2009/09/converting-video-files-for-playback-on-android-google-phone/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 05:53:50 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[GNU/Linux]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=565</guid>
		<description><![CDATA[A few months ago I purchased a &#8220;Google Phone&#8221;: a HTC Magic running the Linux-based Android operating system. I am incredibly pleased with this device. Today I wanted to convert some video that I recorded on a Nikon Coolpix camera into a format that would play nicely on my Android phone. The resolution needed to [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago I purchased a &#8220;Google Phone&#8221;: a HTC Magic running the Linux-based Android operating system.  I am incredibly pleased with this device.</p>
<p>Today I wanted to convert some video that I recorded on a Nikon Coolpix camera into a format that would play nicely on my Android phone.  The resolution needed to be scaled down for the small screen, and I knew that h264 was the best video codec.  After some searching online, and a bit of experimenting, I found that this worked wonderfully:</p>
<p><code>ffmpeg -i input.avi -aspect 3:2 -s 400x300 -vcodec libx264 -b 480k -r 30 -acodec libfaac -ac 1 -ab 32k -padtop 10 -padbottom 10 -padleft 40 -padright 40 -sameq -pass 1 output.mp4</code></p>
<p><span id="more-565"></span>This is a two-pass process, and so this command should be repeated a second time with the last option changed to &#8220;-pass 2&#8243;.</p>
<p>The &#8220;pad&#8221; options are to make the geometry work.  The screen on the HTC Magic has a resolution of 480&#215;320 pixels, which is a 3:2 aspect ratio.  The video I was converting had an aspect ratio of 4:3, and so it conveniently scaled to 400&#215;300.  The paddings fill the video out to the full 480&#215;320, ensuring that the aspect ratio is right during playback.</p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2009/09/converting-video-files-for-playback-on-android-google-phone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Photo file-management with raw and jpg</title>
		<link>http://lachlan.rogers.name/2009/06/photo-file-management-with-raw-and-jpg/</link>
		<comments>http://lachlan.rogers.name/2009/06/photo-file-management-with-raw-and-jpg/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 11:58:12 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=524</guid>
		<description><![CDATA[Even when shooting images in raw format, it is typically easier to do simple sorting and sharing with jpg files. With Nikon *.nef raw files, it is possible to extract a full-resolution jpg image using the nefextract script. However, exif metadata is not automatically copied to this extracted jpg. The tool that I use to [...]]]></description>
			<content:encoded><![CDATA[<p>Even when shooting images in raw format, it is typically easier to do simple sorting and sharing with jpg files.  With Nikon *.nef raw files, it is possible to extract a full-resolution jpg image using the <code>nefextract</code> script.  However, exif metadata is not automatically copied to this extracted jpg.</p>
<p>The tool that I use to manipulate my images according to their exif metadata is <code><a href="http://www.exiv2.org/" title="Exiv2 - Image metadata library and tools">exiv2</a></code>, and I can quite simply copy metadata from raw files to their corresponding jpgs (matching filenames, and all in the one working directory) with:</p>
<p><code>exiv2 insert -l./ -S.nef *.jpg</code></p>
<p>After sorting through the jpgs and deleting all but those worth keeping, I wanted to automatically remove the raw files of those deleted images.  Sure enough, this is easily done with some bash shell magic:</p>
<p><code>for file in *??.jpg; do mv raw/${file%%.jpg}.nef 2> /dev/null rawKeep/ ; done</code></p>
<p>This command says &#8220;for each jpg file you find here, move the matching nef file from the subdirectory raw/ to the subdirectory rawKeep/&#8221;.  I can then delete any files left in the raw/ subdirectory, as they mustn&#8217;t have a matching jpg.</p>
<p>People often ask my why I persevere with the &#8220;command line&#8221; (more technically the &#8220;shell&#8221;).  It seems that they assume tools with graphical interfaces are more powerful and faster.  These two routine tasks demonstrate yet again that the shell really is the most efficient way to do many common jobs.</p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2009/06/photo-file-management-with-raw-and-jpg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pretty display fonts from Latex</title>
		<link>http://lachlan.rogers.name/2009/02/pretty-display-fonts-from-latex/</link>
		<comments>http://lachlan.rogers.name/2009/02/pretty-display-fonts-from-latex/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 06:35:00 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[Latex]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=503</guid>
		<description><![CDATA[The fonts that LaTeX uses by default (called &#8220;Computer Modern&#8221;) are very elegant, and are one of the great reasons to use LaTeX for typesetting documents. Frustratingly, I&#8217;ve been having difficulty lately with my pdfviewer (epdfview and sometimes xpdf) not displaying these fonts well in pdfs I&#8217;ve created using LaTeX. Adobe acroread has been able [...]]]></description>
			<content:encoded><![CDATA[<p>The fonts that LaTeX uses by default (called &#8220;Computer Modern&#8221;) are very elegant, and are one of the great reasons to use LaTeX for typesetting documents.  Frustratingly, I&#8217;ve been having difficulty lately with my pdfviewer (epdfview and sometimes xpdf) not displaying these fonts well in pdfs I&#8217;ve created using LaTeX.  </p>
<p>Adobe acroread has been able to do a better job, but who wants to use such a slow and bloated piece of software just to quickly view a pdf?  At least the pdfs have printed properly, so up till now I haven&#8217;t been too worried.</p>
<p>The solution, which I found at <a href="http://dsanta.users.ch/resources/type1.html" title="High quality PDF output from LaTeX and TeX">a page encouragingly called &#8220;High quality PDF output from LaTeX and TeX&#8221;</a>, is profoundly simple.  It simply involves telling LaTeX to use the scalable font rather than the older bitmap version.  Add these two lines to the preamble:<br />
<code><br />
\usepackage[T1]{fontenc}<br />
\usepackage{ae,aecompl}<br />
</code><br />
and you&#8217;re done.</p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2009/02/pretty-display-fonts-from-latex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Foray into geotagging photos</title>
		<link>http://lachlan.rogers.name/2009/02/foray-into-geotagging-photos/</link>
		<comments>http://lachlan.rogers.name/2009/02/foray-into-geotagging-photos/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 05:18:03 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[Photography]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=490</guid>
		<description><![CDATA[One of the really great things about storing photographs digitally is the ability to embed all sorts of information about the image in &#8220;metadata&#8221; within the file. When I shot film, I carried a notebook around with me that I tried to record exposure settings in (I was usually too lazy); I wanted to be [...]]]></description>
			<content:encoded><![CDATA[<p>One of the really great things about storing photographs digitally is the ability to embed all sorts of information about the image in &#8220;metadata&#8221; within the file.  When I shot film, I carried a notebook around with me that I tried to record exposure settings in (I was usually too lazy); I wanted to be able to learn from experience by looking at the settings I used to take a particular image.  Digital cameras have trivialised this process, as they embed the exposure settings within each photograph.</p>
<p>But digital metadata is able to store much more than just the camera settings.  In particular, it is becomming increasingly common to store location information (collected automatically by GPS).  This is not so much to remind the photographer where they took the photo (most of us are pretty good at remembering that with reasonable precision), but it allows entirely new methods of displaying and browsing sets of photos.</p>
<p>Over the last few months I have experimented with various data acquisition and image display techniques for geo-tagging.  This is a growing field, and so I&#8217;m sure there&#8217;s a lot more for me to learn.  However, here are my findings and a quick demonstration of the results.<span id="more-490"></span>  </p>
<h3>Data Acquisition</h3>
<p>Some newer cameras connect directly to GPS devices (or have them built in!) so that the geographic position information is saved directly to each image as it is recorded.  I do not have this luxury.</p>
<p>Instead, I collect the GPS information separately. If I carry my little Garmin Geko 201 GPS receiver with me, I can know my geographic coordinates when I take a photo.  Also, it can record my trail (as I&#8217;ve done on <a href="http://lachlan.rogers.name/tag/map/" title="Lachlan.Rogers.name - map">previously for certain trips</a>) in a tracklog which can be uploaded to my computer.</p>
<h3>Geotagging</h3>
<p>The simplest case is when I know the geographic coordinates that a photo was taken from.  I could write down the coordinates from the GPS, or simply take a photo of its display.  To embed these coordinates in a photo once its on my computer, I have found the <em>geoexif</em> script from <a href="http://www.sethoscope.net/geophoto/">here</a> to work well.  For example, I run</p>
<p><code>./geoexif.py --latitude -35.6279 --longitude 150.3213 *.jpg</code></p>
<p>to tag all the jpg files in that directory with a certain latitude and longitude.</p>
<p>This works well if a lot of photos were taken from the same point, but there is an even easier way!</p>
<p>GPS tracklogs are simply a list of positions with a timestamp.  Digital cameras also record (within each image) the time that a photo was taken.  Conceptually, it is straightforward to find the time an image was taken, then search along the points in the GPS tracklog for that time and find the position information.</p>
<p>Many software tools exist to perform this interpolation task, but I have found <em>gpsPhoto.pl</em> from <a title="carto:net - gpsPhoto.pl" href="http://www.carto.net/projects/photoTools/gpsPhoto/">here</a> to work really well.  For a GPS tracklog on my computer in gpx format, I run</p>
<p><code>~/scripts/gpsPhoto.pl --gpsfile &lt;filename&gt;.gpx --overwrite-geotagged --timeoffset -39600 --maxtimediff 7200 --dir ./</code></p>
<p>to tag all jpg files in the current directory.  This even embeds altitude data!</p>
<p>The &#8220;timeoffset&#8221; option gives my timezone (I&#8217;m in GMT+11 so the gps is 11 hours behind the jpg timestamps, converted to seconds).  The &#8220;maxtimediff&#8221; here is 2 hours, and this option means that if I set up camp and turned my GPS receiver off but still took photos for 2 hours they would get approximately correct geotags.</p>
<h3>Geo-display and Geo-browsing</h3>
<p>Flickr, the popular photo sharing site, has a very good &#8220;Map display&#8221; for browsing geotagged images.  Even better, with jpg files geotagged in the metadata as I&#8217;ve described, Flickr can automatically import the geo-information when you upload photos.</p>
<p>The really fun bit is browsing other people&#8217;s photos from similar locations to your own, to see what they noticed. <a href="http://www.flickr.com/photos/27603586@N07/2876937929/map" title="Flickr: Explore your photos on the map">Here is an example of exploring my Flickr Map</a> &#8211; and you&#8217;ll notice that in Canberra Flickr uses <a href="http://www.openstreetmap.org" title="OpenStreetMap">OpenStreetMap</a>!</p>
<p>The Flickr map is heaps of fun for browsing your own and other people&#8217;s photos geographically, but I wanted to find a good way to embed a map-browsable photo album here in my own website.  Here is a demonstration of the idea from <a title="How To: Embed Map with Geotagged Photos for Your Blog | The Nokia Blog" href="http://thenokiablog.com/2008/01/26/how-to-embed-map-with-geotagged-photos-for-your-blog/">this article</a> (I had to use gpsVisualiser to convert the gpx to a kmz file).  The images and tracklog are from a daywalk up to Blue Lake that I did during the SNSW Big Camp at Jindabyne a few weeks ago.</p>
<p><iframe width="570" height="500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;t=h&amp;s=AARTsJoLULPchhq79qEAjTySf2PO_Z0hfg&amp;msa=0&amp;msid=106261171747730840943.0004616b508b3d1b8c6d2&amp;ll=-36.417829,148.319721&amp;spn=0.034534,0.048923&amp;z=14&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;t=h&amp;msa=0&amp;msid=106261171747730840943.0004616b508b3d1b8c6d2&amp;ll=-36.417829,148.319721&amp;spn=0.034534,0.048923&amp;z=14&amp;source=embed" style="color:#0000FF;text-align:left">(View Larger Map)</a></small></p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2009/02/foray-into-geotagging-photos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Duplicating DVDs</title>
		<link>http://lachlan.rogers.name/2009/01/duplicating-dvds/</link>
		<comments>http://lachlan.rogers.name/2009/01/duplicating-dvds/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 01:32:48 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[GNU/Linux]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=501</guid>
		<description><![CDATA[Last week I had reason to duplicate some video DVDs.  Yes, it was legitimate; I wanted copies of personal video footage to share with family.  After fiddling around a bit I found a very straighforward way to do this task using simple GNU/Linux tools. The first step is to copy the DVD to the hard [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I had reason to duplicate some video DVDs.  Yes, it was legitimate; I wanted copies of personal video footage to share with family.  After fiddling around a bit I found a very straighforward way to do this task using simple GNU/Linux tools.</p>
<p>The first step is to copy the DVD to the hard drive (I only have one DVD drive).<br />
<code>cat /dev/sr0 &gt; dvd.iso</code><br />
where /dev/sr0 is my DVD device.</p>
<p>Then, after changing to a blank DVD, simply<br />
<code>growisofs -dvd-compat -Z /dev/dvd=dvd.iso</code><br />
and it worked.</p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2009/01/duplicating-dvds/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Un-deleting files on my ext3 &#8220;backup&#8221; partition</title>
		<link>http://lachlan.rogers.name/2008/08/un-deleting-files-on-my-ext3-backup-partition/</link>
		<comments>http://lachlan.rogers.name/2008/08/un-deleting-files-on-my-ext3-backup-partition/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 04:31:19 +0000</pubDate>
		<dc:creator>Lachlan</dc:creator>
				<category><![CDATA[Hacks and Tricks]]></category>
		<category><![CDATA[GNU/Linux]]></category>

		<guid isPermaLink="false">http://lachlan.rogers.name/?p=451</guid>
		<description><![CDATA[Last week I learnt a very important lesson: a &#8220;backup&#8221; is not actually a backup if it is the only copy you have, it is at most an archive. In the process of tidying up the files on my external &#8220;backup&#8221; hard disk I deleted a few directories of photos from the beginning of this [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I learnt a very important lesson: <span class="pullquote">a &#8220;backup&#8221; is not actually a <em>backup</em> if it is the only copy you have</span>, it is at most an archive.  In the process of tidying up the files on my external &#8220;backup&#8221; hard disk I deleted a few directories of photos from the beginning of this year.  As I pressed the Enter key I was sure that I had a copy of those photos still on my laptop; but fractions of a second later I experienced a piercing wave of doubt.  It was already too late.</p>
<p>After checking my laptop and finding that the doubt was justified, I remembered with relief that before <a title="Lachlan.Rogers.name &gt;&gt; At Sydney on the way to Germany" href="http://lachlan.rogers.name/2008/03/at-sydney-on-the-way-to-germany/">heading over to Europe</a> I had copied all my photos onto DVDs and left them in my office at uni (just in case something our house burnt down or something).  I went to sleep mostly certain that I my accidentally deleted files were safe on discs at uni.</p>
<p>As you probably suspect, I did not have a copy of the photos on DVD.  My DVD backups only went to the end of 2007, and I had deleted files from the first 2 months of 2008.</p>
<p>It is not a tragedy, as the main photos of consequence were from ASA Convention and I do have the best of my photos on the official DVD.  However, it provided me with significant incentive to learn about data recovery on ext3 formatted partitions.  I&#8217;ve included some of my discoveries below.<span id="more-451"></span></p>
<p>The first thing that I came across was not encouraging; the <a title="Ext3 FAQ" href="http://batleth.sapienti-sat.org/projects/FAQs/ext3-faq.html">official ext3 FAQ</a> says that it is impossible to un-delete files.  However, a number of people have defied this statement and I quickly found <a title="HOWTO recover deleted files on an ext3 file system" href="http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html">a tool called ext3grep</a>.</p>
<p>I have my external hard disk divided into 2 partitions and so I was able to use the empty half as a playground to store any recovered files.  This turned out to be very useful, because running the command <code>ext3grep /dev/sdb1 --restore-all --after=1218027000</code> did not &#8220;only process entries deleted on or after&#8221; Wed Aug  6 22:50:00 EST 2008, but seemed to &#8220;recover&#8221; every file on the partition.  It took all night.</p>
<p>Happily, the full directory structure of my deleted &#8220;2008&#8243; folder was recovered.  Unfortunately, not all of the jpeg files were found, but it was nice to have some of them back again.</p>
<p>Looking a little bit further I found <a title="Linux.com :: For those Oops moments: ext3undel" href="http://www.linux.com/feature/141074">an article on Linux.com about a tool called ext3undel</a>, which apparently uses <a title="Foremost homepage" href="http://foremost.sourceforge.net/">Foremost</a> and <a title="PhotoRec - CGSecurity" href="http://www.cgsecurity.org/wiki/PhotoRec">PhotoRec</a> to do the work.  This article also explained fairly clearly why data recovery on ext3 partitions is difficult.  I also stumbled across <a title="Recover Deleted Files with Foremost | Tombuntu" href="http://tombuntu.com/index.php/2008/04/09/recover-deleted-files-with-foremost/">a guide to using foremost</a>, and so decided to skip straight to this command-line utility.</p>
<p>I installed Foremost and gave it a try, and the results seemed impressive.<br />
<code><br />
52661:  388052408.jpg          1 MB      198682832896<br />
Foremost version 1.5.3 by Jesse Kornblum, Kris Kendall, and Nick Mikus<br />
Audit File</code></p>
<p><code>Foremost started at Fri Aug  8 18:23:52 2008<br />
Invocation: foremost -t jpeg -i /dev/sdb1<br />
Output directory: /mnt/tmp/output<br />
Configuration file: /etc/foremost.conf<br />
------------------------------------------------------------------<br />
File: /dev/sdb1<br />
Start: Fri Aug  8 18:23:52 2008<br />
Length: 186 GB (200005876224 bytes)</code></p>
<p><code>Num      Name (bs=512)         Size      File Offset     Comment</code></p>
<p><code>0:      00690176.jpg           1 MB       353370112<br />
1:      00692792.jpg           1 MB       354709504<br />
2:      00695328.jpg           1 MB       356007936<br />
.<br />
.<br />
.<br />
52662:  388055280.jpg          1 MB      198684303360<br />
52663:  388058248.jpg          1 MB      198685822976<br />
52664:  388061320.jpg        536 KB      198687395840<br />
Finish: Fri Aug  8 20:36:15 2008</code></p>
<p><code>52665 FILES EXTRACTED</code></p>
<p><code>jpg:= 52665<br />
------------------------------------------------------------------</code></p>
<p><code>Foremost finished at Fri Aug  8 20:36:16 2008</code></p>
<p>I&#8217;ve left out a <em>lot</em> of lines in the middle, but you can see the important details: about 2 and a quarter hours with a total of 52665 jpg files extracted (a total of 23 GB)!  Sadly, almost all of these files were not complete recoveries of the images.<img src="http://lachlan.rogers.name/wordpress/wp-content/uploads/2008/08/20080208_asa_convention_recovered_1854-40.jpg" alt="Group at ASA Convention" width="575" class="attachment wp-att-453 left" style="visibility: hidden" id="img1439660038" onclick="enlargerScaleImg('img1439660038', 120, 0)" onload="enlargerScaleImg('img1439660038', 120, 1)" /><noscript><img src="http://lachlan.rogers.name/wordpress/wp-content/uploads/2008/08/20080208_asa_convention_recovered_1854-40.jpg" alt="Group at ASA Convention" width="575" class="attachment wp-att-453 left" id="120" /></noscript><img src="http://lachlan.rogers.name/wordpress/wp-content/uploads/2008/08/20080208_asa_convention_recovered_1941-33.jpg" alt="Special item at ASA Convention" width="575" class="attachment wp-att-454 right " style="visibility: hidden" id="img917667765" onclick="enlargerScaleImg('img917667765', 120, 0)" onload="enlargerScaleImg('img917667765', 120, 1)"/><noscript><img src="http://lachlan.rogers.name/wordpress/wp-content/uploads/2008/08/20080208_asa_convention_recovered_1941-33.jpg" alt="Special item at ASA Convention" width="575" class="attachment wp-att-454 right " id="120"/></noscript>  The data corruption and partial recovery, however, did give rise to some very intriguing artistic effects, and I&#8217;ve included some samples here.  I couldn&#8217;t help thinking it was rather analogous to accidental light-damage back in the film era of photography.</p>
<p>I also gave PhotoRec a go, and it can also be told to only look for jpg files.  It found a lot of images, but most of them were merely thumbnails from what appeared to be web-caches hidden in my backed up directories.</p>
<p>So of the three I found ext3grep to give me the best results as far as un-deleting my jpg files, however it also took the longest and produced the most storage-consuming recovery output.  Its a bit disappointing that I have not yet been able to recover all the images I foolishly deleted, but I&#8217;ve certainly learnt about the value of true backups &#8211; storing files in at least 2 different places.</p>
<p>-----</p><br />
<p>(<em>This post was published on my <a href="http://lachlan.rogers.name">Lachlan.Rogers.name website</a>.  If you are reading this on Facebook Notes or Google Buzz or another RSS import, please consider commenting on the original post to keep the conversation accessible to everyone.</em>)</p>                  ]]></content:encoded>
			<wfw:commentRss>http://lachlan.rogers.name/2008/08/un-deleting-files-on-my-ext3-backup-partition/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

