<?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>Xor News &#187; Computers</title>
	<atom:link href="http://www.flester.com/blog/category/computers/feed" rel="self" type="application/rss+xml" />
	<link>http://www.flester.com/blog</link>
	<description>You can't have it both ways</description>
	<lastBuildDate>Wed, 18 Aug 2010 03:51:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Best Single Line of Code Ever</title>
		<link>http://www.flester.com/blog/2010/05/29/best-single-line-of-code-ever</link>
		<comments>http://www.flester.com/blog/2010/05/29/best-single-line-of-code-ever#comments</comments>
		<pubDate>Sat, 29 May 2010 13:39:57 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/?p=288</guid>
		<description><![CDATA[Quite possibly my best single line of code ever. Certainly my best single line of Java ever.
And it&#8217;s in a unit test.

     private static String W = "Президент Буш";

What&#8217;s yours?
]]></description>
			<content:encoded><![CDATA[<p>Quite possibly my best single line of code ever. Certainly my best single line of Java ever.<br />
And it&#8217;s in a unit test.</p>
<p><code><br />
     <span style="color:#a020f0">private static</span> <span style="color:#228b22">String</span> <span style="color:#b8860b">W</span> = <span style="color:#bc8f8f">"Президент Буш"</span>;<br />
</code></p>
<p>What&#8217;s yours?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2010/05/29/best-single-line-of-code-ever/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>User Interface Design</title>
		<link>http://www.flester.com/blog/2009/12/01/user-interface-design</link>
		<comments>http://www.flester.com/blog/2009/12/01/user-interface-design#comments</comments>
		<pubDate>Tue, 01 Dec 2009 02:30:33 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/?p=244</guid>
		<description><![CDATA[Here are some that are noteworthy and funny:

Is it Christmas &#8211; http://isitchristmas.com &#8211; Funny as it tracks the timezones across the globe, really only has much to do on one day per year though. But that one day is coming up soon, so start checking in daily.
Is it Dark Outside &#8211; http://isitdarkoutside.com &#8211; Whopping funny. [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some that are noteworthy and funny:</p>
<ul>
<li>Is it Christmas &#8211; <a href="http://isitchristmas.com/">http://isitchristmas.com</a> &#8211; Funny as it tracks the timezones across the globe, really only has much to do on one day per year though. But that one day is coming up soon, so start checking in daily.</li>
<li>Is it Dark Outside &#8211; <a href="http://isitdarkoutside.com/">http://isitdarkoutside.com</a> &#8211; Whopping funny. Works every day of the year.</li>
<li>Umbrella Today &#8211; <a href="http://umbrellatoday.com/">http://umbrellatoday.com</a> &#8211; I guess they are hawking an iPhone app, but I really enjoyed how the interface pulls you in a little bit at a time. And if you visit for the first time on a rainy day (or just put in a Seattle, Washington zip code), that rainy-day graphic is stunning.</li>
</ul>
<p>It&#8217;s all about hiding the complexity. Do something hard with your software but don&#8217;t make the users suffer just you did.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/12/01/user-interface-design/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Special error codes</title>
		<link>http://www.flester.com/blog/2009/10/17/special-error-codes</link>
		<comments>http://www.flester.com/blog/2009/10/17/special-error-codes#comments</comments>
		<pubDate>Sat, 17 Oct 2009 19:03:43 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/?p=237</guid>
		<description><![CDATA[A recent tweet from my pal #eknock complaining about some juicy ORA-06550: line 1, column 7 reminded me of these error codes that an old-cgi script of min produces:

Bad disktype code ORA-99xxx
CTXUSER not enabled ORA-010xxx
Flagellular misfire ORA-910xxx
Nascent order lost code: ORA-82xxx
Ferrule injector not found: ORA-14xxx

Of course it&#8217;s just a perl script and the system had [...]]]></description>
			<content:encoded><![CDATA[<p>A recent tweet from my pal #eknock complaining about some juicy <strong>ORA-06550: line 1, column 7</strong> reminded me of these error codes that an old-cgi script of min produces:</p>
<ul>
<li>Bad disktype code ORA-99xxx</li>
<li>CTXUSER not enabled ORA-010xxx</li>
<li>Flagellular misfire ORA-910xxx</li>
<li>Nascent order lost code: ORA-82xxx</li>
<li>Ferrule injector not found: ORA-14xxx</li>
</ul>
<p>Of course it&#8217;s just a perl script and the system had nothing to do with Oracle. Just one of those little things that can be done to throw snoopers off the trail. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/10/17/special-error-codes/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hadoop World 2009</title>
		<link>http://www.flester.com/blog/2009/10/04/hadoop-world-2009</link>
		<comments>http://www.flester.com/blog/2009/10/04/hadoop-world-2009#comments</comments>
		<pubDate>Sun, 04 Oct 2009 02:59:09 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/?p=230</guid>
		<description><![CDATA[Yesterday I attended the first-ever Hadoop World, sponsored by Cloudera and held in The Roosevelt Hotel in New York City. I took an early Amtrak train up to the big city and a late train back that same night. The conference was well attended, over 500 big-data heads were there and the organizers did a [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I attended the first-ever <a href="http://hadoop.apache.org/">Hadoop</a> World, sponsored by <a href="http://cloudera.com/">Cloudera</a> and held in <a href="http://theroosevelthotel.com/">The Roosevelt Hotel</a> in New York City. I took an early Amtrak train up to the big city and a late train back that same night. The conference was well attended, over 500 big-data heads were there and the organizers did a fantastic job.</p>
<p>Some of the best stuff was just hearing about how other folks are using Hadoop. I also enjoyed hearing about the sizes of other people&#8217;s big-data problems. There were three tracks, so I only heard 1/3 of what took place, but here are some notes on what I did hear after the break.</p>
<p>It was a great day, a long day, glad I went.<span id="more-230"></span></p>
<h2>Yahoo and Hadoop &#8211; Eric14</h2>
<p> Yahoo search assist is now build with Hadoop based on 3 years of log data. It is a 20 step map-reduce job and it runs in about 20 minutes on their production cluster. This is down from a 26 day run (did I get that right?) in the pre-Hadoop days. Wow. Y! has several Hadoop clusters and the biggest is 4K nodes, 16Pb disk, 64 Tb RAM, 32K cores running Hadoop 18.3. Wow. I&#8217;m drooling over that. </p>
<p>Yahoo! folks are the biggest Hadoop committers and Y! sounds solidly behind the thing just like they have been since its inception. That was great to hear. Just about every zone of the Yahoo! home page has some contribution from a map-reduce job at some point.</p>
<p>Some stuff to keep an eye out for</p>
<ul>
<li>Zebra &#8211; a column oriented data store on hdfs</li>
<li>Ooozie &#8211; a workflow and scheduling piece for map-reduce</li>
<li>Mumak simulator &#8211; need to look that one up</li>
</ul>
<h2>Facebook &#8211; Ashish Thusoo</h2>
<p>Fb gets 4Tb of compressed data per day with a 6-7x compression factor. That&#8217;s a lot of data. They separate production and ad-hoc jobs on to different clusters and use hive-replication to get the data in both places. This is something that is not publicly available yet but they have plans to open-source it when it is ready. Their big cluster is 4800 cores, 5.5 Pb disk, 12Tb disk per node. They run 7500 hive jobs per day, 95% of all jobs are hive, and this cluster runs 80,000 compute hours per day. </p>
<h2>Visa &#8211; Joe Cunningham</h2>
<p>Visa has had Hadoop in their research department for about 9 months and is doing some interesting things with it.  They certainly have a big-data problem: 28 million merchants, 1.4 million ATM machines, 500 million accounts, 100-130 million transactions per day (8k per second). The Visa Net portion of a transaction approval happens in 50 ms and Visa Net has 2 seconds downtime per year.</p>
<p>Visa uses lots of FOSS in the enterprise so their interest in Hadoop came about in a perfectly natural way.  One of the things the current research does is to produce fraud models that can be used in the real-time system. These models are produced off-line and it currently takes about 1 month to generate a fully-functional model. This involves sampling data, moving data, compressing data, etc. With Hadoop a fully-functional model can be generated in 13 minutes. Lots of the research happens on synthetic data and Visa has created map jobs to generate synthetic transaction data at the rate of 2 years of synthetic transactions in 6 hours.</p>
<h2>Rackspace &#8211; Stu Hood</h2>
<p>Stu talked most about the email and app hosting division of Rackspace but there are a lot of interesting things happening in Rackspace, both in the mail hosting division and in other divisions. The mail hosting division generates a lot of logs and needs to be very proactive in finding and surfacing delivery problems and dealing with spam and malware. They generate 300Gb/day of logs and have a 6 month window for analysis. There was some interesting talk of using map-reduce to generate a Lucene intermediate index format and then using Solr to merge it up into a searchable index. The time window target is to be able to query on data within 15 minutes of the event and to query on any dimension. </p>
<p>They either are or will be using Scribe to ingest data (syslog data?) directly into HDFS. I need to look into Scribe more as I had sort of forgotten about it. It could help solve some pressing issues.</p>
<h2> JP Morgan Chase</h2>
<p>One very interesting point the speakers brought out is that once your transactional data gets to be over 1 day old it is usually entirely static. But still it sits there provisioned and protected in your enterprise RDBMS transactional data store &#8212; read only. We can do better than that!</p>
<h2>HDFS Security &#8211; Owen O&#8217;Malley, Yahoo!</h2>
<p>There is lots of work going on to secure Hadoop Namenode, Jobtracker and Datanode. This is super important to our clients too and so we are very interested in seeing this succeed. Some of the major points:</p>
<ul>
<li>Namenode will give the user a Kerberos token to access blocks on a data node</li>
<li>Only the user of a map-reduce job will be able to modify or kill it</li>
<li>Map-reduce jobs run as the user</li>
<li>Task working directory visibility limited to the user</li>
<li>Only the right reduce tasks can see teh map outputs (secure shuffle)</li>
<li>Encryption optional</li>
<li>SPNEGO = permissions everywhere</li>
</ul>
<p>In addition to the security work Owen talked some about how to make backward compatible APIs and how to mark them as such. The need for this grows as the project grows larger ecosystems. File system compatibility is also important. We know this right well as we got stuck on the bogus Hadoop 0.19 version that no one even mentions in public. We couldn&#8217;t go back to 0.18 and 0.20 wasn&#8217;t stable yet. Stuck stuck stuck.</p>
<h2>VAIDYA</h2>
<p>There are 165+ tunable parameters in Hadoop. Changing one usually has impact on the others. Vaidya uses a set of rules to analyze map-reduce history (after a job has run) using the user history and the job conf. It can measure things like reducer balance, check for compressed intermediate data, determine whether a combiner would be likely to help, and many other things. This is a lot of the stuff we do by hand when evaluating a map-reduce job. You could see something like this being used as a part of the certification that a job is ready to run on your production cluster.<a href="https://issues.apache.org/jira/browse/HADOOP-4179"> JIRA 4179</a>.</p>
<h2>eBay Streaming Architecture &#8211; Neel Sundaresan</h2>
<p>eBay users spend $1400 per second. A vehicle is sold every 2 minutes. There are about 10 million new listings per day and 250 million users. The typical item on eBay is not catalogable (is that a word?) as most items are one-of-a-kind. So as compared to a Netflix type recommender system where you might need a 100k x 100k matrix, the eBay recommender  would be an extremely large, sparse array. Neel called this a &#8220;long-tail&#8221; type system. There are terabytes of new transaction and user session data per day. eBay Research Labs studies this data to determine behavior in a number of dimensions, figures out how to perform A/B testing experiments, and  does trending analysis. </p>
<p>The streaming architecture (Mobius) has a query language (MQL) that gives an SQL like interface but adds a <b>start</b> and <b>end</b> section to the query to give the window of data to operate on. </p>
<h2>High Availability Hadoop &#8211; webContext</h2>
<p>I had some problems understanding this talk at the beginning, but warmed up to it as it went along. There were lots of interesting products and tools mentioned that I should look into more.</p>
<ul>
<li>Hotslice to monitor job exit status</li>
<li>Network bonding with LACP</li>
<li>DRBD for disk mirroring</li>
<li>Linux HA from linux-ha.org</li>
<li>Spacewalk &#8211; an open source system like RedHat Satellite server</li>
</ul>
<p>These guys have two machines running the Namenode using LinuxHA and DRBD on a virtual IP address. In addition to that they use the REST interface to the NameNode to /getimage and /getedit once per hour and make additional backups. They have had 6 NN failures in the last 18 months, 3 planned, 3 unplanned and have about a 15 second rollover to the backup. That is intense. Read more about <a href="http://www.cloudera.com/blog/2009/07/22/hadoop-ha-configuration/">this configuration</a> on the cloudera blog.</p>
<h2>RADFS</h2>
<p>This is a set of patches in progress to make a low-latency HDFS. This is important work for things like hBase. There are some huge inefficiencies in sockets, file handles, and network usage for small positioned reads. There is still a lot of work to do on these patches before it could reasonably take over for the current HDFS approach. Interesting things to think about. <a href="https://issues.apache.org/jira/browse/HDFS-516">JIRA HDFS-516</a>.</p>
<h2>Automatic Problem Diagnosis &#8211; CMU Team</h2>
<p>The CMU team is using the M45 cluster that Y! has made available to several universities. They have some really nice visualizations of problems occurring in the cluster that come from looking at 64 different metrics in collected log files. One metric I thought especially interesting was heartbeat date skew between the master and slave.  This work is being tracked in<a href="https://issues.apache.org/jira/browse/CHUKWA-94"> JIRA Chukwa &#8211; 94</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/10/04/hadoop-world-2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP 2.8 and 2.8.1 comments permalinks problem</title>
		<link>http://www.flester.com/blog/2009/07/11/wp-2-8-and-2-8-1-comments-permalinks-problem</link>
		<comments>http://www.flester.com/blog/2009/07/11/wp-2-8-and-2-8-1-comments-permalinks-problem#comments</comments>
		<pubDate>Sat, 11 Jul 2009 03:16:27 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/2009/07/11/wp-2-8-and-2-8-1-comments-permalinks-problem</guid>
		<description><![CDATA[Upgrade to WP 2.8 broke the comments permalinks, 2.8.1 didn&#8217;t help. The user would get an error page after posting a comment (comment was posted) and clicking on any of the links to a comment went to the-url-for-the-post/comments-page-1#comment-id which would get you a 404. In the admin settings discussion area there is a (new?) setting [...]]]></description>
			<content:encoded><![CDATA[<p>Upgrade to WP 2.8 broke the comments permalinks, 2.8.1 didn&#8217;t help. The user would get an error page after posting a comment (comment was posted) and clicking on any of the links to a comment went to the-url-for-the-post/comments-page-1#comment-id which would get you a 404. In the admin settings discussion area there is a (new?) setting to break comments up into pages of 50. Turning this off fixed the problem. I&#8217;ve never had 50 non-spam comments so that shouldn&#8217;t hurt too much. Plus I don&#8217;t think I ever turned it on in the first place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/07/11/wp-2-8-and-2-8-1-comments-permalinks-problem/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scaling Rails Screencast</title>
		<link>http://www.flester.com/blog/2009/06/13/scaling-rails-screencast</link>
		<comments>http://www.flester.com/blog/2009/06/13/scaling-rails-screencast#comments</comments>
		<pubDate>Sat, 13 Jun 2009 16:38:41 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/2009/06/13/scaling-rails-screencast</guid>
		<description><![CDATA[This screen cast covers Scaling Rails apps using Rack and Metal and is an execellent tutorial on both subjects. Jason Pollack, one of the Rails Envy guys, does a superb job explaining how rack and metal work in Rails 2.3. 
]]></description>
			<content:encoded><![CDATA[<p>This screen cast covers <a href="http://nr-content.s3.amazonaws.com/railslab/videos/14-ScalingRails-Rack-and-Metal.mp4">Scaling Rails apps using Rack and Metal</a> and is an execellent tutorial on both subjects. Jason Pollack, one of the Rails Envy guys, does a superb job explaining how rack and metal work in Rails 2.3. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/06/13/scaling-rails-screencast/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://nr-content.s3.amazonaws.com/railslab/videos/14-ScalingRails-Rack-and-Metal.mp4" length="49733893" type="video/mp4" />
		</item>
		<item>
		<title>d-Left Hashing</title>
		<link>http://www.flester.com/blog/2009/06/13/d-left-hashing</link>
		<comments>http://www.flester.com/blog/2009/06/13/d-left-hashing#comments</comments>
		<pubDate>Sat, 13 Jun 2009 02:16:30 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/?p=161</guid>
		<description><![CDATA[Reading an interesting paper on d-Left Hashing (pdf link) by Bonomi, Mitzenmacher, et. al. This is a space and effeciency improvement on Bloom filters. Wondering how it could be incorporated into a Hadoop mapfile to avoid scanning compressed blocks for keys that aren&#8217;t present. Maybe the work in hbase on o.a.h.hbase.io.BloomFilterMapFile would provide good clues. [...]]]></description>
			<content:encoded><![CDATA[<p>Reading an interesting paper on <a href="http://www.csl.uiuc.edu/allerton/archives/allerton06/PDFs/papers/0183.pdf">d-Left Hashing (pdf link)</a> by Bonomi, Mitzenmacher, et. al. This is a space and effeciency improvement on Bloom filters. Wondering how it could be incorporated into a <a href="http://hadoop.apache.org/core">Hadoop</a> <a href="http://hadoop.apache.org/core/docs/r0.18.3/api/org/apache/hadoop/io/MapFile.html">mapfile</a> to avoid scanning compressed blocks for keys that aren&#8217;t present. Maybe the work in hbase on o.a.h.hbase.io.BloomFilterMapFile would provide good clues. Need to understand the dynamic bit reassignment stuff first though.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/06/13/d-left-hashing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ext3 Filesystems do not have &#8216;undelete&#8217;</title>
		<link>http://www.flester.com/blog/2009/05/26/ext3-filesystems-do-not-have-undelete</link>
		<comments>http://www.flester.com/blog/2009/05/26/ext3-filesystems-do-not-have-undelete#comments</comments>
		<pubDate>Tue, 26 May 2009 02:23:13 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/?p=159</guid>
		<description><![CDATA[I lost the entire blog today with a carelessly placed argument to
&#8216;rm -rf&#8217;. Ironically I was trying to delete some old backups of
this blog. It turned out I deleted everything. 
Most of it was restored from backup. Some few pictures are still
missing though. 
]]></description>
			<content:encoded><![CDATA[<p>I lost the entire blog today with a carelessly placed argument to<br />
&#8216;rm -rf&#8217;. Ironically I was trying to delete some old backups of<br />
this blog. It turned out I deleted everything. </p>
<p>Most of it was restored from backup. Some few pictures are still<br />
missing though. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/05/26/ext3-filesystems-do-not-have-undelete/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Posting from Emacs</title>
		<link>http://www.flester.com/blog/2009/05/25/posting-from-emacs</link>
		<comments>http://www.flester.com/blog/2009/05/25/posting-from-emacs#comments</comments>
		<pubDate>Mon, 25 May 2009 03:07:38 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/2009/05/25/posting-from-emacs</guid>
		<description><![CDATA[I am an Emacs weenie. I really can&#8217;t get much work done without emacs. I
have tried other things.
 * vi/vim &#8211; I can use it and I try to learn a new command every once in a
   while
 * Textmate &#8211; mkay. But I like Emacs. Plus Emacs is free.
 * Visual Slick [...]]]></description>
			<content:encoded><![CDATA[<p>I am an Emacs weenie. I really can&#8217;t get much work done without emacs. I<br />
have tried other things.</p>
<p> * vi/vim &#8211; I can use it and I try to learn a new command every once in a<br />
   while<br />
 * Textmate &#8211; mkay. But I like Emacs. Plus Emacs is free.<br />
 * Visual Slick Edit &#8211; The parts that are like Emacs are nice. Emacs is<br />
   free.<br />
 * Netbeans &#8211; Almost can be configured to work like Emacs.<br />
 * Eclipse &#8211; No. I. Just. Can&#8217;t. Do. It. Very. Sorry.</p>
<p>So I am making this post from Emacs. Carbon Emacs 22.1 on Mac OS X.<br />
Using weblogger mode. It turned out to be easy. The hard part was<br />
figuring out what the &#8220;endpoint URL&#8221; was supposed to be<br />
(/blog/xmlrpc.php for this Wordpress blog). And enabling the Markdown<br />
plugin. Yeah, that was tricky &#8212; had to click a checkbox.</p>
<p>See ya later lame textarea edit box and lame wordpress markup style. We<br />
hardly knew ye.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/05/25/posting-from-emacs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using thrift from ant</title>
		<link>http://www.flester.com/blog/2009/04/26/using-thrift-from-ant</link>
		<comments>http://www.flester.com/blog/2009/04/26/using-thrift-from-ant#comments</comments>
		<pubDate>Sun, 26 Apr 2009 20:13:31 +0000</pubDate>
		<dc:creator>mike</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Food]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.flester.com/blog/?p=139</guid>
		<description><![CDATA[We are starting to use thrift and needed an ant build recipe. Here&#8217;s what we came up with. It works good and the only thing that looks like an abstraction leakage to me is that I needed to know the package, the java namespace, for the resultant generated thrift code and the name of one [...]]]></description>
			<content:encoded><![CDATA[<p>We are starting to use <a href="http://incubator.apache.org/thrift/">thrift</a> and needed an ant build recipe. Here&#8217;s what we came up with. It works good and the only thing that looks like an abstraction leakage to me is that I needed to know the package, the java namespace, for the resultant generated thrift code and the name of one of the thrift generated files. The primary goal was to eliminate running the thrift generator when the generated code is newer than the .thrift files. There isn&#8217;t a one to one mapping between .thrift files and generated output so if any of the generated stuff is newer than any of the thrift then it all gets recreated.</p>
<p>I also didn&#8217;t want to have to copy the thrift output to someplace else, so a javac target was added to just treat the &#8220;gen-java&#8221; thrift output as a new source directory for direct java compilation. The normal ant target to compile the java code can now just depend on &#8220;thrift-gen&#8221;.</p>
<pre>
<textarea name="code" class="xml">
  &lt;property name="thrift.dir" value="${basedir}/src/thrift"/&gt;
  &lt;property name="thrift.out.dir" value="${basedir}/src/gen-java"/&gt;
  &lt;property name="thrift.package" value="your/package/name"/&gt;

  &lt;!-- thrift files --&gt;
  &lt;fileset id="thrift.files" dir="${thrift.dir}"&gt;
    &lt;include name="**/*.thrift"/&gt;
  &lt;/fileset&gt;
  &lt;!-- Determint if thrift generated java is up to date --&gt;
  &lt;target name="thrift-init"&gt;
    &lt;dependset&gt;
      &lt;srcfileset refid="thrift.files"/&gt;
      &lt;targetfileset dir = "${thrift.out.dir}/${thrift.package}"&gt;
        &lt;include name="**/*.java"/&gt;
      &lt;/targetfileset&gt;
    &lt;/dependset&gt;
    &lt;available file="${thrift.out.dir}/${thrift.package}/Foo.java"
               property="thrift.uptodate"/&gt;
  &lt;/target&gt;

  &lt;!-- Generate thrift java --&gt;
  &lt;target name="thrift-gen" depends="thrift-init" unless="thrift.uptodate"&gt;
    &lt;pathconvert property="thrift.file.list" refid="thrift.files"
               pathsep=" " dirsep="/"&gt;
    &lt;/pathconvert&gt;
    &lt;echo message="Running thrift generator on ${thrift.file.list}"/&gt;
    &lt;exec executable="thrift" dir="${basedir}" failonerror="true"&gt;
      &lt;arg line="--strict --gen java -o src ${thrift.file.list}"/&gt;
    &lt;/exec&gt;
  &lt;/target&gt;
</textarea></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.flester.com/blog/2009/04/26/using-thrift-from-ant/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
