<?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>international geographic</title>
	<atom:link href="http://www.chetanislazy.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chetanislazy.com/blog</link>
	<description>ooh, shiny!</description>
	<lastBuildDate>Thu, 19 May 2011 04:16:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Profiling Java programs on OS X</title>
		<link>http://www.chetanislazy.com/blog/2011/05/18/profiling-java-programs-on-os-x/</link>
		<comments>http://www.chetanislazy.com/blog/2011/05/18/profiling-java-programs-on-os-x/#comments</comments>
		<pubDate>Thu, 19 May 2011 04:15:01 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[computers suck]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[shark]]></category>
		<category><![CDATA[tptp]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=282</guid>
		<description><![CDATA[Sounds easy, doesn&#8217;t it? Well it actually is quite simple but the error messages along the way can really trip you up! My first attempt at profiling a bit of code was to use the full-boat Eclipse stack: Eclipse Test &#038; Performance Tools Platform Project! Well, what they don&#8217;t tell you anywhere on the project [...]]]></description>
			<content:encoded><![CDATA[<p>Sounds easy, doesn&#8217;t it? Well it actually is quite simple but the error messages along the way can really trip you up!</p>
<p>My first attempt at profiling a bit of code was to use the full-boat Eclipse stack: <a href="http://www.eclipse.org/tptp/">Eclipse Test &#038; Performance Tools Platform Project</a>! Well, what they don&#8217;t tell you anywhere on the project page is that it&#8217;s only supported on Windows and Linux. A Mac port was started sometime around 2004 and never completed. Yeah, it&#8217;s been that long!</p>
<p>And so this brings us to Apple&#8217;s <a href="http://developer.apple.com/tools/sharkoptimize.html">Shark</a>: an extremely barebones, no-frills profiler, but, what the heck, it&#8217;s free. For the basics on using this tool with your Java app, this <a href="http://ninjamonkeys.co.za/2008/02/21/java-performance-profiling-on-mac-for-free-using-shark/">great post</a> has all the details. There&#8217;s just one catch: 64-bit support. There is none. If you&#8217;re on a 64-bit stack and you try to run it, you&#8217;ll see something like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ java -agentlib:Shark -cp foo.jar com.foo.Bar
Error occurred during initialization of VM
Could not find agent library: libShark.jnilib (searched /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries:/System/Library/Java/Extensions:/Library/Java/Extensions:.)</pre></div></div>

<p>Er, what? Now let&#8217;s see here&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ ls -al /System/Library/Java/Extensions/libShark.jnilib 
-rwxr-xr-x 1 root wheel 50352 Oct 24  2010 /System/Library/Java/Extensions/libShark.jnilib</pre></div></div>

<p>Well, that&#8217;s odd. But it said it looked there, right?! Well, as it turns out, the Shark JNI library only supports 32-bit JVMs. So finally, we arrive at the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ java -d32 -agentlib:Shark -cp foo.jar com.foo.Bar
2011-05-18 23:05:20.756 java[84473:20f] Shark for Java enabled...</pre></div></div>

<p>Great sucess! And now, back to work, just a little less sane&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2011/05/18/profiling-java-programs-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling Q4M on OS X</title>
		<link>http://www.chetanislazy.com/blog/2011/05/11/compiling-q4m-on-os-x/</link>
		<comments>http://www.chetanislazy.com/blog/2011/05/11/compiling-q4m-on-os-x/#comments</comments>
		<pubDate>Thu, 12 May 2011 03:04:34 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[computers suck]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=274</guid>
		<description><![CDATA[I recently compiled Q4M on my Mac and I&#8217;m documenting it here now because it proved to be somewhat painful so hopefully you&#8217;ll avoid a bit of grief by reading this. First off, you need MySQL Server. I&#8217;ve been using MacPorts for some time now, so this is installed via ports. Unfortunately, it seems to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently compiled <a href="http://q4m.github.com/">Q4M</a> on my Mac and I&#8217;m documenting it here now because it proved to be somewhat painful so hopefully you&#8217;ll avoid a bit of grief by reading this. </p>
<p>First off, you need MySQL Server. I&#8217;ve been using MacPorts for some time now, so this is installed via ports. Unfortunately, it seems to be a pretty barebones config so I had to create a custom variant to add the necessary <code>--with-fast-mutexes</code> option. You can grab my modified Portfile <a href="https://github.com/chetan/ports">from github</a>. Just clone it into some directory and then add that path into <code>/opt/local/etc/macports/sources.conf</code> before the rsync line. Once you have that, go ahead and reinstall MySQL:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> mysql5 +fast_mutexes</pre></div></div>

<p>Q4M also requires access to the MySQL sources, so let&#8217;s get those unpacked:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>macports<span style="color: #000000; font-weight: bold;">/</span>distfiles<span style="color: #000000; font-weight: bold;">/</span>mysql5<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.57.tar.gz</pre></div></div>

<p>Once that&#8217;s done, follow these steps to get Q4M compiled:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> mysql5<span style="color: #000000; font-weight: bold;">/</span>mysql 
&nbsp;
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-mysql</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.57 \
    <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
$ <span style="color: #007800;">CPATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>mysql \
   <span style="color: #007800;">LIBRARY_PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql5<span style="color: #000000; font-weight: bold;">/</span>mysql \
   <span style="color: #c20cb9; font-weight: bold;">make</span>
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libqueue_engine.<span style="color: #000000; font-weight: bold;">*</span> \
   <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql5<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>plugin<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Final step, tell mysql to install the engine</span>
$ mysql <span style="color: #660033;">-uroot</span> <span style="color: #000000; font-weight: bold;">&lt;</span> support-files<span style="color: #000000; font-weight: bold;">/</span>install.sql</pre></div></div>

<p>If after all that you&#8217;re still having problems, maybe you&#8217;ll have better luck with these <a href="http://blog.yappo.jp/yappo/archives/000656.html">Japanese instructions</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2011/05/11/compiling-q4m-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting things done &#8211; DDG style</title>
		<link>http://www.chetanislazy.com/blog/2011/02/17/getting-things-done-ddg-style/</link>
		<comments>http://www.chetanislazy.com/blog/2011/02/17/getting-things-done-ddg-style/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 03:56:32 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[philosophy]]></category>
		<category><![CDATA[ddg]]></category>
		<category><![CDATA[duck duck go]]></category>
		<category><![CDATA[gabriel weinberg]]></category>
		<category><![CDATA[getting things done]]></category>
		<category><![CDATA[gtd]]></category>
		<category><![CDATA[yegg]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=267</guid>
		<description><![CDATA[I have no idea how Gabriel ever gets anything done, considering that he&#8217;s constantly responding to emails, tweets, forum posts, comments on various sites and IRC &#8212; just to name a few! Here&#8217;s a typical exchange from earlier today when I reported a poorly performing query on DDG: I used to be like that when [...]]]></description>
			<content:encoded><![CDATA[<p>I have no idea how <a href="http://ye.gg">Gabriel</a> ever gets anything done, considering that he&#8217;s constantly responding to emails, tweets, forum posts, comments on various sites and IRC &#8212; just to name a few!</p>
<p>Here&#8217;s a typical exchange from earlier today when I reported a poorly performing query on <a href="http://duckduckgo.com">DDG</a>:</p>
<p><img src="http://chetanislazy.com/images/blog/ddg-gtd.png" /></p>
<p>I used to be like that when I was at Operative but I don&#8217;t think I was anywhere near as productive as him. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2011/02/17/getting-things-done-ddg-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Relaunching lunchomizer.com</title>
		<link>http://www.chetanislazy.com/blog/2011/02/12/relaunching-lunchomizer/</link>
		<comments>http://www.chetanislazy.com/blog/2011/02/12/relaunching-lunchomizer/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 00:07:41 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[food]]></category>
		<category><![CDATA[lunch]]></category>
		<category><![CDATA[lunchomizer]]></category>
		<category><![CDATA[midtown lunch]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=257</guid>
		<description><![CDATA[I spent a bunch of time the last couple of days sprucing up a few of my personal projects. Today was mostly spent on the lunchomizer, which gives you random suggestions for lunch, based on your location. It still only works for Midtown Manhattan since the locations all come from Midtown Lunch and that&#8217;s also [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://lunchomizer.com"><img src="http://chetanislazy.com/images/blog/lunchomizer_v2.png" /></a></p>
<p>I spent a bunch of time the last couple of days sprucing up a few of my personal projects. Today was mostly spent on <a href="http://lunchomizer.com">the lunchomizer</a>, which gives you random suggestions for lunch, based on your location. It still only works for Midtown Manhattan since the locations all come from <a href="http://midtownlunch.com/">Midtown Lunch</a> and that&#8217;s also the neighborhood where I happen to work. </p>
<p>The biggest change today was fixing the HTML5 location support and a much better mobile experience via a separate Rails layout tailored for small screens. All in all, it was pretty easy, but one thing that surprised me was a noticeable lack of a de facto standard library for doing mobile, or really any, browser detection. I ended up using a gem called <a href="http://rubygems.org/gems/nomadic">Nomadic</a> and that worked well with the following controller code:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> LunchController <span style="color:#006600; font-weight:bold;">&lt;</span> ApplicationController
    layout <span style="color:#ff3333; font-weight:bold;">:choose_layout</span>
    <span style="color:#006600; font-weight:bold;">&#91;</span>...<span style="color:#006600; font-weight:bold;">&#93;</span>
    private
&nbsp;
    <span style="color:#008000; font-style:italic;"># use mobile layout for mobile clients (using browser detection)</span>
    <span style="color:#9966CC; font-weight:bold;">def</span> choose_layout
        Nomadic.<span style="color:#9900CC;">mobile</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#996600;">&quot;mobile&quot;</span> : <span style="color:#996600;">&quot;default&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>A fairly simplistic solution, but perfect for this app which has only a single controller and a single view :)</p>
<p>And for the curious, the full <a href="https://github.com/chetan/lunchomizer">source</a> is available on github. Fork away!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2011/02/12/relaunching-lunchomizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creepy voicemail</title>
		<link>http://www.chetanislazy.com/blog/2011/02/11/creepy-voicemail/</link>
		<comments>http://www.chetanislazy.com/blog/2011/02/11/creepy-voicemail/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 21:41:42 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[misc]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=248</guid>
		<description><![CDATA[I got this creepy voicemail today on an unused Vonage number that I have: Your browser does not support the new &#60;audio&#62; element. You can download the file instead. Vonage transcription: &#8220;Good morning and good morning and good more and then I&#8217;m. I&#8217;m alone. So in the shower. I am gonna be more than any [...]]]></description>
			<content:encoded><![CDATA[<p>I got this creepy voicemail today on an unused Vonage number that I have:</p>
<p><audio src="http://www.pixelcop.org/~chetan/files/cardboard-boat-races.mp3" controls="controls">Your browser does not support the new &lt;audio&gt; element. You can <a href="http://www.pixelcop.org/~chetan/files/cardboard-boat-races.mp3">download</a> the file instead.</audio></p>
<blockquote><p>Vonage transcription: &#8220;Good morning and good morning and good more and then I&#8217;m. I&#8217;m alone. So in the shower. I am gonna be more than any card board boat races in my dreams. Swimming in the lake trip the water&#8221;</p></blockquote>
<p><span style="font-size:smaller;">PS. this is just an excuse for me try out the new HTML5 &lt;audio&gt; tag, which apparently doesn&#8217;t work in Firefox 3.6.x.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2011/02/11/creepy-voicemail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.pixelcop.org/~chetan/files/cardboard-boat-races.mp3" length="131976" type="audio/mpeg" />
		</item>
		<item>
		<title>Stupid Windows Firewall</title>
		<link>http://www.chetanislazy.com/blog/2011/01/30/stupid-windows-firewall/</link>
		<comments>http://www.chetanislazy.com/blog/2011/01/30/stupid-windows-firewall/#comments</comments>
		<pubDate>Sun, 30 Jan 2011 21:28:54 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[computers suck]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=235</guid>
		<description><![CDATA[So it turns out that Windows Firewall, even in Windows 2008, still can&#8217;t accept a range of ports, either in the UI or via command line, most commonly when setting up PASV FTP transfers. The common workaround is to create one entry per port in your range like so: C:&#62; FOR /L %I IN (60000,1,60200) [...]]]></description>
			<content:encoded><![CDATA[<p>So it turns out that Windows Firewall, even in Windows 2008, still can&#8217;t accept a range of ports, either in the UI or via command line, most commonly when setting up PASV FTP transfers. The common workaround is to create one entry per port in your range like so:</p>
<p><code>C:&gt; FOR /L %I IN (60000,1,60200) DO netsh firewall add portopening TCP %I "Passive FTP"%I</code></p>
<p>While this does work, it&#8217;s slightly annoying that you have to create 200 individual entries in your config. My slightly better workaround is to just stick every port into the text entry field using this simple ruby helper:</p>
<p><code>puts (60000..60200).to_a.join(",")</code></p>
<p>You can run this either in IRB or directly on the command line using the following command:</p>
<p><code>$ ruby -e 'puts (60000..60200).to_a.join(",")'</code></p>
<p>This is great if your workstation has ruby on it, but sucks otherwise. So use this javascript version right here instead!</p>
<p>Start:<br />
<input type="text" id="start" value="60000" />
<p>End:<br />
<input type="text" id="end" value="60200" />
<input type="button" value="Submit" onclick="range();">
<p>Range:<br />
<textarea id="range"></textarea><br />
<script type="text/javascript">
function range() {
	var start = parseInt(jQuery("#start").val());
	var end = parseInt(jQuery("#end").val());
	var str = "";
	for (i = start; i <= end; i++) {
		if (str.length > 0) { str += "," }
		str += i;
	}
	jQuery("#range").val(str);
}
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2011/01/30/stupid-windows-firewall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best music of 2010</title>
		<link>http://www.chetanislazy.com/blog/2010/12/31/best-music-of-2010/</link>
		<comments>http://www.chetanislazy.com/blog/2010/12/31/best-music-of-2010/#comments</comments>
		<pubDate>Fri, 31 Dec 2010 23:47:51 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[music]]></category>
		<category><![CDATA[best of]]></category>
		<category><![CDATA[year end]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=229</guid>
		<description><![CDATA[Oh boy, here we go again. I actually managed to come up with a list of my top 3 this year, so let&#8217;s just cut to the chase, shall we? Kanye West &#8211; My Beautiful Dark Twisted Fantasy LCD Soundsystem &#8211; This is Happening Titus Andronicus &#8211; The Monitor And the runner-ups in alphabetical order: [...]]]></description>
			<content:encoded><![CDATA[<p>Oh boy, here we go again. I actually managed to come up with a list of my top 3 this year, so let&#8217;s just cut to the chase, shall we?</p>
<ol>
<li>Kanye West &#8211; My Beautiful Dark Twisted Fantasy</li>
<li>LCD Soundsystem &#8211; This is Happening</li>
<li>Titus Andronicus &#8211; The Monitor</li>
</ol>
<p>And the runner-ups in alphabetical order:</p>
<ul>
<li>Arcade Fire &#8211; The Suburbs</li>
<li>Beach House &#8211; Teen Dream</li>
<li>Best Coast &#8211; Crazy For You</li>
<li>Das Racist &#8211; Shut Up, Dude</li>
<li>Das Racist &#8211; Sit Down, Man</li>
<li>Robyn &#8211; Body Talk</li>
<li>The-Dream &#8211; Love King</li>
<li>Toro Y Moi &#8211; Causers Of This</li>
<li>Wavves &#8211; King of the Beach</li>
<li>Wild Nothing &#8211; Gemini</li>
<li>Xiu Xiu &#8211; Dear God, I Hate Myself</li>
</ul>
<p>Best EPs: </p>
<ul>
<li>Annuals &#8211; Sweet Sister EP</li>
<li>DEERPEOPLE &#8211; DEERPEOPLE EP</li>
<li>Girls &#8211; Broken Dreams Club EP</li>
</ul>
<p>Can&#8217;t wait for next year!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2010/12/31/best-music-of-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An easy way to browse HDFS clusters</title>
		<link>http://www.chetanislazy.com/blog/2010/12/30/an-easy-way-to-browse-hdfs-clusters/</link>
		<comments>http://www.chetanislazy.com/blog/2010/12/30/an-easy-way-to-browse-hdfs-clusters/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 15:05:21 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[hadoop]]></category>
		<category><![CDATA[hdfs]]></category>
		<category><![CDATA[mucommander]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=222</guid>
		<description><![CDATA[After spending the better part of a day trying to get HDFS to mount on my Mac, I finally gave up. Luckily, I was able to find MuCommander, a cross-platform Java port of the Norton Commander of old, and as luck would have it, it supports HDFS in the latest version! Very handy for quickly [...]]]></description>
			<content:encoded><![CDATA[<p>After spending the better part of a day trying to get <a href="http://wiki.apache.org/hadoop/MountableHDFS">HDFS to mount</a> on my Mac, I finally gave up. Luckily, I was able to find <a href="http://www.mucommander.com/">MuCommander</a>, a cross-platform Java port of the Norton Commander of old, and as luck would have it, it supports HDFS in the latest version! Very handy for quickly browsing your HDFS clusters if you can&#8217;t mount it or don&#8217;t have the Hadoop toolset installed. </p>
<p><img src="http://content.screencast.com/users/csarva/folders/Jing/media/c40b1b47-9965-464f-8caa-6366b3f57389/00000053.png" class="border" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2010/12/30/an-easy-way-to-browse-hdfs-clusters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Distributing JARs for Map/Reduce jobs via HDFS</title>
		<link>http://www.chetanislazy.com/blog/2010/12/29/distributing-jars-for-mapreduce-jobs-via-hdfs/</link>
		<comments>http://www.chetanislazy.com/blog/2010/12/29/distributing-jars-for-mapreduce-jobs-via-hdfs/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 02:59:27 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[hadoop]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=217</guid>
		<description><![CDATA[Hadoop has a built-in feature for easily distributing JARs to your worker nodes via HDFS but, unfortunately, it&#8217;s broken. There&#8217;s a couple of tickets open with a patch again 0.18 and 0.21 (trunk) but for some reason they still haven&#8217;t been committed yet. We&#8217;re currently running 0.20 so the patch does me no good anyway. [...]]]></description>
			<content:encoded><![CDATA[<p>Hadoop has a <a href="http://hadoop.apache.org/common/docs/r0.20.2/api/org/apache/hadoop/filecache/DistributedCache.html#addArchiveToClassPath(org.apache.hadoop.fs.Path,%20org.apache.hadoop.conf.Configuration)">built-in feature</a> for easily distributing JARs to your worker nodes via HDFS but, unfortunately, it&#8217;s <a href="https://issues.apache.org/jira/browse/MAPREDUCE-752">broken</a>. There&#8217;s a couple of tickets open with a patch again 0.18 and 0.21 (trunk) but for some reason they still haven&#8217;t been committed yet. We&#8217;re currently running 0.20 so the patch does me no good anyway. So here&#8217;s my simple solution:</p>
<p><script src="https://gist.github.com/759391.js"> </script></p>
<p>I essentially copied the technique used by ToolRunner when you pass a &#8220;libjars&#8221; argument on the command line. You simply pass the function the HDFS paths to the JAR files you want included and it&#8217;ll take care of the rest. </p>
<p>Example usage:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> run<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    JobConf job <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JobConf<span style="color: #009900;">&#40;</span>getConf<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// ... job setup ...</span>
&nbsp;
    NerfUtils.<span style="color: #006633;">addJarsToJobClasspath</span><span style="color: #009900;">&#40;</span>job, 
        <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> 
            <span style="color: #0000ff;">&quot;/libraries/java/solr-commons-csv-1.4.1.jar&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// ... more job setup ...</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">return</span> JobClient.<span style="color: #006633;">runJob</span><span style="color: #009900;">&#40;</span>job<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getJobState</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Might not be the prettiest or best solution but it works for me!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2010/12/29/distributing-jars-for-mapreduce-jobs-via-hdfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Hadoop&#8217;s DistributedCache</title>
		<link>http://www.chetanislazy.com/blog/2010/12/28/using-hadoops-distributedcache/</link>
		<comments>http://www.chetanislazy.com/blog/2010/12/28/using-hadoops-distributedcache/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 22:40:34 +0000</pubDate>
		<dc:creator>chetan</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[hadoop]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.chetanislazy.com/blog/?p=206</guid>
		<description><![CDATA[Using Hadoop&#8217;s DistributedCache mechanism is fairly straightforward, but as I&#8217;m finding is common with everything-Hadoop, not very well documented. Adding files When setting up your Job configuration: // Create symlinks in the job's working directory using the link name // provided below DistributedCache.createSymlink&#40;conf&#41;; &#160; // Add a file to the cache. It must already exist [...]]]></description>
			<content:encoded><![CDATA[<p>Using Hadoop&#8217;s DistributedCache mechanism is fairly straightforward, but as I&#8217;m finding is common with everything-Hadoop, not very well documented. </p>
<h3>Adding files</h3>
<p>When setting up your Job configuration:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Create symlinks in the job's working directory using the link name </span>
<span style="color: #666666; font-style: italic;">// provided below</span>
DistributedCache.<span style="color: #006633;">createSymlink</span><span style="color: #009900;">&#40;</span>conf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Add a file to the cache. It must already exist on HDFS. The text</span>
<span style="color: #666666; font-style: italic;">// after the hash is the link name.</span>
DistributedCache.<span style="color: #006633;">addCacheFile</span><span style="color: #009900;">&#40;</span>
    <span style="color: #000000; font-weight: bold;">new</span> URI<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hdfs://localhost:9000/foo/bar/baz.txt#baz.txt&quot;</span><span style="color: #009900;">&#41;</span>, conf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Accessing files</h3>
<p>Now that we&#8217;ve cached our file, let&#8217;s access it:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Direct access by name</span>
<span style="color: #003399;">File</span> baz <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;baz.txt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// prints &quot;true&quot; since the file was found in the working directory</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>baz.<span style="color: #006633;">exists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// We can also get a list of all cached files</span>
Path<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> cached <span style="color: #339933;">=</span> DistributedCache.<span style="color: #006633;">getLocalCacheFiles</span><span style="color: #009900;">&#40;</span>conf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> cached.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Path path <span style="color: #339933;">=</span> cached<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> filename <span style="color: #339933;">=</span> path.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.chetanislazy.com/blog/2010/12/28/using-hadoops-distributedcache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

