<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ben J. Christensen</title>
	<atom:link href="http://benjchristensen.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://benjchristensen.com</link>
	<description>Software Development and Other Random Stuff</description>
	<lastBuildDate>Tue, 17 Jan 2012 22:36:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='benjchristensen.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/a7bf6ab05bce6d423674b5a8bb676139?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Ben J. Christensen</title>
		<link>http://benjchristensen.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://benjchristensen.com/osd.xml" title="Ben J. Christensen" />
	<atom:link rel='hub' href='http://benjchristensen.com/?pushpress=hub'/>
		<item>
		<title>WebService Performance on EC2 Instances</title>
		<link>http://benjchristensen.com/2012/01/05/webservice-performance-on-ec2-instances/</link>
		<comments>http://benjchristensen.com/2012/01/05/webservice-performance-on-ec2-instances/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 03:24:50 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[amazon ec2]]></category>
		<category><![CDATA[performance efficiency]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=443</guid>
		<description><![CDATA[As part of a cost/performance analysis of Amazon EC2 instances I wrote a very simple Java webapp to allow simple comparison benchmarking. The webapp runs in Tomcat and has a servlet which returns a JSON response after looping to generate the JSON to cause CPU computation time as if the service were doing real work. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=443&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As part of a cost/performance analysis of <a href="http://aws.amazon.com/ec2/instance-types/">Amazon EC2 instances</a> I wrote a <a href="https://github.com/benjchristensen/WSPerformanceTest">very simple Java webapp</a> to allow simple comparison benchmarking.</p>
<p>The webapp runs in Tomcat and has a <a href="https://github.com/benjchristensen/WSPerformanceTest/blob/master/src/com/wsperformancetest/ComputationalSimulationService.java">servlet</a> which returns a JSON response after looping to generate the JSON to cause CPU computation time as if the service were doing real work. It results in a lot of iteration and string creation activity – things web services do a lot of.</p>
<p>ApacheBenchmark (ab) was used as the test client to simulate traffic and capture statistics.</p>
<p>The instance types tested were <a href="https://github.com/benjchristensen/WSPerformanceTest/blob/master/testResults/2012_January5_EC2_Testing/machine_information_ec2_m2.2xlarge.txt">m2.2xlarge</a>, <a href="https://github.com/benjchristensen/WSPerformanceTest/blob/master/testResults/2012_January5_EC2_Testing/machine_information_ec2_m2.4xlarge.txt">m2.4xlarge</a>, <a href="https://github.com/benjchristensen/WSPerformanceTest/blob/master/testResults/2012_January5_EC2_Testing/machine_information_ec2_cc1.4xlarge.txt">cc1.4xlarge</a>, and <a href="https://github.com/benjchristensen/WSPerformanceTest/blob/master/testResults/2012_January5_EC2_Testing/machine_information_ec2_cc2.8xlarge.txt">cc2.8xlarge</a>.</p>
<p>The tests determined that the cc2.8xlarge instance type – though the most expensive by unit – is potentially the most cost effective type to use when serving large volume traffic involving a cluster of servers.</p>
<p>The cost to serve 1000 requests/second at a response time of approximately 18ms for each instance type is:</p>
<ul>
<li>m2.2xlarge: $1.98</li>
<li>m2.4xlarge: $2.48</li>
<li>cc1.4xlarge: $1.36</li>
<li><strong>cc2.8xlarge: $1.19</strong></li>
</ul>
<p>Of course, this test is very simplistic and ignores a wide variety of variables, but it demonstrates that the cc1 and cc2 boxes are well worth the time to evaluate for production application usage for achieving cost/performance efficiency.</p>
<p>The following graphs show the test results that were used to calculate the above costs.</p>
<p><strong>Results per Second with Increasing Concurrency</strong></p>
<p>This demonstrates how the 32 CPU cores on the cc2.8xlarge enable significantly higher throughput.</p>
<p><img class="aligncenter size-full wp-image-446" title="requests_per_second_with_increasing_concurrency" src="http://benjchristensen.files.wordpress.com/2012/01/requests_per_second_with_increasing_concurrency.png?w=800&#038;h=386" alt="" width="800" height="386" /></p>
<p><strong>Time per Request (ms) with Increasing Concurrency</strong></p>
<p>This shows how the response time degrades with increasing thread counts and how the larger boxes (particularly the cc2) scale better.</p>
<p><img class="aligncenter size-full wp-image-447" title="time_per_request_with_increasing_concurrency" src="http://benjchristensen.files.wordpress.com/2012/01/time_per_request_with_increasing_concurrency.png?w=800&#038;h=372" alt="" width="800" height="372" /></p>
<p><strong>Spreadsheet</strong></p>
<p>This screenshot of the spreadsheet shows the cost calculations at each level of concurrency.</p>
<p>The hi-lighted green is considered the optimal &#8220;ceiling&#8221; beyond which performance degrades and throughput plateaus. This point is considered the high-water-mark that can be used to determine the number of machines in a cluster needed to serve a given amount of traffic and thus allow comparison of different machines.</p>
<p><img class="aligncenter size-full wp-image-444" title="ec2-performance-data" src="http://benjchristensen.files.wordpress.com/2012/01/ec2-performance-data.png?w=800&#038;h=607" alt="" width="800" height="607" /></p>
<p><strong>Price per 1000 Requests per Second with Increasing Concurrency</strong></p>
<p>This scatter chart shows the cost to serve 1000 requests per second at increasing levels of concurrency on each instance type.</p>
<p><img class="aligncenter size-full wp-image-445" title="price_with_increasing_concurrency" src="http://benjchristensen.files.wordpress.com/2012/01/price_with_increasing_concurrency.png?w=800" alt=""   /></p>
<p>Overall, the performance of the cc1 and cc2 boxes are impressive and their cost/performance appears to be far better than the m2 instances.</p>
<p>The raw results of the tests can be found on <a href="https://github.com/benjchristensen/WSPerformanceTest/tree/master/testResults/2012_January5_EC2_Testing">Github</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/443/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/443/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/443/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=443&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2012/01/05/webservice-performance-on-ec2-instances/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2012/01/requests_per_second_with_increasing_concurrency.png" medium="image">
			<media:title type="html">requests_per_second_with_increasing_concurrency</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2012/01/time_per_request_with_increasing_concurrency.png" medium="image">
			<media:title type="html">time_per_request_with_increasing_concurrency</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2012/01/ec2-performance-data.png" medium="image">
			<media:title type="html">ec2-performance-data</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2012/01/price_with_increasing_concurrency.png" medium="image">
			<media:title type="html">price_with_increasing_concurrency</media:title>
		</media:content>
	</item>
		<item>
		<title>Dynamic Stacked Bar Chart Using d3.js</title>
		<link>http://benjchristensen.com/2011/12/16/dynamic-stacked-bar-chart-using-d3-js/</link>
		<comments>http://benjchristensen.com/2011/12/16/dynamic-stacked-bar-chart-using-d3-js/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 23:03:16 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=437</guid>
		<description><![CDATA[A prototype of a stacked bar chart that can dynamically add/remove bars and update the data for each bar implemented using d3.js. It  represents data freshness (time since update) per bar using an opacity decay so a bar fades away if it doesn&#8217;t receive fresh data. The examples I found elsewhere represent static data, so my model [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=437&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A prototype of a stacked bar chart that can dynamically add/remove bars and update the data for each bar implemented using <a href="http://mbostock.github.com/d3/">d3.js</a>.</p>
<p>It  represents data freshness (time since update) per bar using an opacity decay so a bar fades away if it doesn&#8217;t receive fresh data.</p>
<p>The examples I <a href="http://mbostock.github.com/d3/ex/population.html">found</a> <a href="http://mbostock.github.com/d3/ex/stack.html">elsewhere</a> represent static data, so my model of implementation is different in that I don&#8217;t use data binding or d3.layout.stack() because I couldn&#8217;t figure out how to make those work with dynamic data (if someone can show me a better way, I&#8217;ll gladly accept the guidance). Thus, my implementation directly adds/removes the bars and determines the bar widths and x-position itself.</p>
<p>The use case I intend to apply this prototype for is to visualize a stream of realtime data.</p>
<p>Functionality not implemented in this prototype include things such as hover and click actions to show details of the data a bar represents.</p>
<p><img class="aligncenter size-full wp-image-438" title="barchart" src="http://benjchristensen.files.wordpress.com/2011/12/barchart.png?w=800" alt=""   /></p>
<p>Here are links to the code and working example:</p>
<p><a href="http://bl.ocks.org/1488375">http://bl.ocks.org/1488375</a><br />
<a href="https://gist.github.com/1488375"> https://gist.github.com/1488375</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/437/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=437&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/12/16/dynamic-stacked-bar-chart-using-d3-js/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/12/barchart.png" medium="image">
			<media:title type="html">barchart</media:title>
		</media:content>
	</item>
		<item>
		<title>Animated Circle Using d3.js</title>
		<link>http://benjchristensen.com/2011/12/13/animated-circle-using-d3-js/</link>
		<comments>http://benjchristensen.com/2011/12/13/animated-circle-using-d3-js/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 19:40:23 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=429</guid>
		<description><![CDATA[While working on visualizing data (application traffic) in realtime I used circles with size representing volume and color representing health. Here are basic examples of circles with varying sizes and colors and animating them to dynamically change that I used as building blocks. Here are links to the code and working example: http://bl.ocks.org/1473535 https://gist.github.com/1473535<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=429&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While working on visualizing data (application traffic) in realtime I used circles with size representing volume and color representing health.</p>
<p>Here are basic examples of circles with varying sizes and colors and animating them to dynamically change that I used as building blocks.</p>
<p><img class="aligncenter size-full wp-image-434" title="circles-screenshot" src="http://benjchristensen.files.wordpress.com/2011/12/circles-screenshot.png?w=800&#038;h=453" alt="" width="800" height="453" /></p>
<p>Here are links to the code and working example:</p>
<p><a href="http://bl.ocks.org/1473535">http://bl.ocks.org/1473535</a><br />
<a href="https://gist.github.com/1473535">https://gist.github.com/1473535</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/429/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/429/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/429/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=429&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/12/13/animated-circle-using-d3-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/12/circles-screenshot.png" medium="image">
			<media:title type="html">circles-screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>Making the Netflix API More Resilient</title>
		<link>http://benjchristensen.com/2011/12/09/making-the-netflix-api-more-resilient/</link>
		<comments>http://benjchristensen.com/2011/12/09/making-the-netflix-api-more-resilient/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 17:57:17 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Production]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=421</guid>
		<description><![CDATA[A new Netflix Tech Blog post by my manager (Ben Schmaus) discusses how we&#8217;ve been making the Netflix API more resilient through the use of circuit breakers, bounded thread-pools and realtime decision making: Here are some of the key principles that informed our thinking as we set out to make the API more resilient. A [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=421&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A new <a href="http://techblog.netflix.com/2011/12/making-netflix-api-more-resilient.html">Netflix Tech Blog post</a> by my manager (<a href="https://twitter.com/#!/schmaus">Ben Schmaus</a>) discusses how we&#8217;ve been making the Netflix API more resilient through the use of circuit breakers, bounded thread-pools and realtime decision making:</p>
<blockquote><p>Here are some of the key principles that informed our thinking as we set out to make the API more resilient.</p>
<ol>
<li>A failure in a service dependency should not break the user experience for members</li>
<li>The API should automatically take corrective action when one of its service dependencies fails</li>
<li>The API should be able to show us what’s happening right now, in addition to what was happening 15-30 minutes ago, yesterday, last week, etc.</li>
</ol>
</blockquote>
<p>A video showing the realtime monitoring dashboard is on Vimeo:</p>
<div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/33359539' width='400' height='300' frameborder='0'></iframe></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/421/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/421/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/421/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/421/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/421/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/421/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/421/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/421/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/421/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/421/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/421/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/421/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/421/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/421/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=421&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/12/09/making-the-netflix-api-more-resilient/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>
	</item>
		<item>
		<title>JUnit Tests as Inner Classes</title>
		<link>http://benjchristensen.com/2011/10/23/junit-tests-as-inner-classes/</link>
		<comments>http://benjchristensen.com/2011/10/23/junit-tests-as-inner-classes/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 07:44:30 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=416</guid>
		<description><![CDATA[For several years on multiple Java projects I have written my unit tests as inner classes of the class they are testing. I have never liked or bought into the idea of putting unit tests in a separate class in a separate source folder. I am fine with and like having functional and/or system tests [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=416&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For several years on multiple Java projects I have written my unit tests as inner classes of the class they are testing. I have never liked or bought into the idea of putting unit tests in a separate class in a separate source folder. I am fine with and like having functional and/or system tests off in that separate ./test/ source folder – just not the unit tests.</p>
<p>Following are my reasons why I find it so much more productive and beneficial to write the unit tests as inner classes.</p>
<p><em>Note on terminology: I will use &#8220;concrete class&#8221; to represent the class that needs to be tested.</em></p>
<p><strong>Low Friction</strong></p>
<p><a href="https://gist.github.com/1198069"><img class="alignright size-full wp-image-417" title="JSONUtilityUnitTests" src="http://benjchristensen.files.wordpress.com/2011/10/jsonutilityunittests.png?w=800" alt=""   /></a></p>
<p>Unit testing should not feel like a burden, if it does many will likely not do it. Sure, developers often agree on the surface that writing unit tests is &#8220;the right thing to do&#8221;, but in practice most developers don&#8217;t do it. There are many reasons, but I believe one of them is that the friction for doing it is too high in most cases. Partly this is because unit tests off in another source folder have no context to the concrete class being worked on and rely upon human memory and tedious process to find, manage and keep in sync with the concrete class through the development cycle &#8211; especially when it&#8217;s someone other than the original developer of the class and tests.</p>
<p>Putting the unit tests in an inner class greatly reduces the friction of writing and maintaining unit tests for the following reasons:</p>
<ul>
<li>I only have to deal with a single class in my file/package/class navigator instead of two</li>
<li>I don&#8217;t have to open and manage 2 editor windows/tabs for every class I want to edit (this is a big deal, especially when most developers have dozens of classes open at any given time)</li>
<li>When I use keyboard shortcuts to open that single class file, the unit tests are right there with them, I don&#8217;t have to do twice the work to open first the concrete file, then the second file</li>
<li>I don&#8217;t have to try and maintain the naming convention of 2 separate files, especially through refactorings (more on this below)</li>
<li>I can immediately execute the unit tests for the class I&#8217;m viewing without going off and searching for another class</li>
<li>All developers see the unit tests when they open the class, they don&#8217;t need to remember to go looking if there happens to be one (especially in code bases where most classes don&#8217;t have tests so they will almost certainly never bother to go looking after failing to find any the first several times).</li>
<li>Maintainability is improved because the non-original developers who open a class see the tests and are thereby reminded and encouraged to use and add to them as they edit the class</li>
</ul>
<p>In short, unit tests as inner classes are easy to find, run, work on and maintain. This in turn encourages adoption and maintenance of them.</p>
<p><strong>Context</strong></p>
<p>Another benefit is that the unit tests as an inner class are very contextual to what they are testing. Many of the points of the previous section related to &#8220;low friction&#8221; are due to the context an inner class has with the concrete class. The tests are &#8220;in your face&#8221; and can&#8217;t be missed. They are obviously intended for testing the class currently being viewed and immediately prompt the developer to use them as part of their development process.</p>
<p>This in turn enforces them being &#8220;unit tests&#8221; and not becoming system tests by developers starting to test multiple concrete classes from a single test class just because it&#8217;s easier to keep adding tests to an existing test class than to create a new test class for every concrete class. Tests in a separate source folder have a very loose relationship to the concrete class, thus it&#8217;s very easy for the context to be lost and have it start testing interaction between classes, rather than only unit testing the class it was originally intended to test.</p>
<p>The mental model of unit tests in an inner class is very clear – these tests are for this class and only this class.</p>
<p><strong>Encapsulation</strong></p>
<p>Unit testing should not result in the weakening of encapsulation. This easily starts to happen when the tests are in a separate class and trying to gain full access to a non-trivial concrete class to setup mocks and perform assertions.</p>
<p>Methods and constructors start being made public or package accessible that should have remained private just so that hooks can be provided for the test class.</p>
<p>Arguments are plentiful about whether private methods and inner classes should be unit tested, and in many cases the arguments are valid that only public methods should need to be tested and they will internally exercise the private members.</p>
<p>Unfortunately there are plenty of use cases I have come across where this ideal is not a reality on non-trivial classes due to a desire to keep things encapsulate and hide implementation details.</p>
<p>Here are 2 examples:</p>
<ul>
<li>Example of &#8216;wanting&#8217; to test privates: lots of internal logic in private methods where building the class via test-driven-development (TDD) is easier by testing the private methods as you go (like building blocks with simple progressive tests), rather than trying to write all the code then test only the public methods at the end. <em>(Yes, it can theoretically all be done via TDD by only going via the public method, and yes I understand the theory of it. In practice however I have found it beneficial to have some types of private methods tested so they are covered as &#8220;building blocks&#8221; rather than relying on the top level public method test failing and digging into what internal private method failed.)</em></li>
<li>Example of &#8216;needing&#8217; to test privates: an inner class which runs a daemon thread to perform background cache refreshes. This is something I want fully encapsulated and not exposed in any way, but I need to test that it correctly runs, does what it&#8217;s supposed to do and mock it out for other unit tests.</li>
</ul>
<p>Specifically on the second example of an inner class and background thread, these could easily be made testable by an external class by exposing things via publics or package private methods or variables, or even by pulling the inner class for the thread into a separate class – but all of those break the encapsulation I was striving for. I do not want the package structure or javadocs to know anything about the implementation details. I want it all private, not package private and certainly not public.</p>
<p>Thus, the only way to get access without breaking encapsulation and good object design is to put the tests inside the concrete class.</p>
<p>Unit tests as inner classes allow for testing without opening member variables or methods to package or public access which then leak the implementation details.</p>
<p><strong>Refactoring</strong></p>
<p>If and when the the concrete class has its name or package refactored the unit tests as an inner class just go along for the ride.</p>
<p>No one needs to remember to go find the associated unit tests and also rename them.</p>
<p>This is particularly important in large codebases maintained by many developers where the person working on the code likely is not the one who originally wrote it.</p>
<p>Otherwise, the unit tests becomes an orphan, in the wrong package with the wrong name. Yes, the tests likely will still work (unless they depend on package access, in which case a compilation error would have flagged it) but they are now less maintainable than ever since the naming convention that was holding them together is gone and nobody will know to go looking for it in future edits to the concrete class.</p>
<p>In short, when unit tests are done as an inner class, everything is fully contained and goes along for the ride regardless of where the concrete class goes or how it&#8217;s named.</p>
<p><strong>Self-documenting</strong></p>
<p>When a class has all of its tests as an inner class they act as built-in documentation of what the class is supposed to do, regardless of whether the person looking for the code knows or cares to go looking for unit tests.</p>
<p>They can&#8217;t be missed – they are staring the developer in the face at the bottom of the class and in the outline as &#8220;UnitTest&#8221; with a bunch of methods declaring the functionality that is expected.</p>
<p><strong>Arguments Against This Approach</strong></p>
<p>Unfortunately the use of inner classes for unit testing is not more common so I sometimes get opposition when I work with new teams and they see my tests as inner classes.</p>
<p>Here are the common questions/concerns and my perspective on them:</p>
<p><strong>What About Shipping Test Code to Production?</strong></p>
<p>The small amount of byte code that will get shipped is negligible compared to the amount of 3rd party JARs in most deployments so it hardly dents the size of WAR files being shipped around, and since the classes are never referenced or invoked in production they are never loaded into the class loaders and thus never take up permgen space on the heap.</p>
<p>And if there is a philosophical or actual real reason to not ship test code they can simply be stripped by a build process since they all compile to $UnitTest.class (if that naming convention is used, which I follow and recommend) and can then be easily filtered before building the JAR files.</p>
<p><strong>Apache Doesn&#8217;t Do It This Way</strong></p>
<p>Or otherwise said: &#8216;Why would you put test classes there!?&#8217;.</p>
<p>Apache/Maven <a href="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html">advocates</a> having a ./src/main and ./src/test folder and they have enough clout in the industry to have made it the most known place of putting test classes.</p>
<p>Just because it works for them doesn&#8217;t mean it&#8217;s the best way of doing it and in practice I have found it to be detrimental. I agree that in a theoretical &#8220;standard directory layout&#8221; it makes sense, but in practice the lack of context, increased friction, maintainability issues and impacts on encapsulation make it less-than-ideal for the developers writing the tests.</p>
<p><strong>Summary</strong></p>
<p>Inner classes are a great home for unit tests when writing Java.</p>
<p>This pattern reduces friction of both writing and maintaining unit tests which in turn increases code coverage, speeds up development, improves maintainability, increases velocity and enables adopting practices such as continuous deployment.</p>
<p>&nbsp;</p>
<p>Update (Jan 17 2012):</p>
<p>One drawback of unit tests as inner classes is that they show up in Javadocs. The solution is to filter them out using a custom &#8216;Doclet&#8217; implementation.</p>
<p>Example can be found here: <a href="https://gist.github.com/1410681">https://gist.github.com/1410681</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/416/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/416/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/416/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=416&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/10/23/junit-tests-as-inner-classes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/10/jsonutilityunittests.png" medium="image">
			<media:title type="html">JSONUtilityUnitTests</media:title>
		</media:content>
	</item>
		<item>
		<title>AtomicCircularArray Wins My Concurrency Throughput Test</title>
		<link>http://benjchristensen.com/2011/10/08/atomiccirculararray/</link>
		<comments>http://benjchristensen.com/2011/10/08/atomiccirculararray/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 05:42:41 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=399</guid>
		<description><![CDATA[I recently made several implementations of a RollingNumber (allowing a sum to be calculated over a 10 second period with 1 second increments with continual updates) to determine what would perform best under high-concurrency. In my case, concurrency means 4-8000 writes/second from hundreds of threads on an 8-core machine and only a handful of reads [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=399&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently made several implementations of a RollingNumber (allowing a sum to be calculated over a 10 second period with 1 second increments with continual updates) to determine what would perform best under high-concurrency.</p>
<p>In my case, concurrency means 4-8000 writes/second from hundreds of threads on an 8-core machine and only a handful of reads per second.</p>
<p>In the end, a circular-array (using AtomicReferenceArray internally) won my throughput tests and also achieved my side goal of being non-blocking.</p>
<p>The <a href="https://github.com/benjchristensen/RollingNumberConcurrencyTesting">code is on GitHub</a> and the winning implementation is <a href="https://github.com/benjchristensen/RollingNumberConcurrencyTesting/blob/master/src/RollingNumberViaTryLockWithAtomicCircularArray.java">RollingNumberViaTryLockWithAtomicCircularArray</a>.</p>
<p>Note that this code is NOT what I would deploy in production, since I forced each implementation to comply to the same interface so they could all be run by my test-harness.</p>
<p>However, a modified version of RollingNumberViaTryLockWithAtomicCircularArray is being run in production processing billions of writes per day.</p>
<p>Another aspect of the test is the use of ReentrantLock.tryLock() instead of a synchronized block. The tryLock() works well in this use-case, allowing only 1 thread to get the lock and routing all others around it instead of blocking them.</p>
<p><strong>Test Results</strong></p>
<p>Here are charts (higher is better) showing the differences in performance between implementations on two different machines:</p>
<p><strong>MacBook Pro 2.2GHz Intel Core i7, 8GB Memory, SSD Drive, OSX Lion 10.7.1</strong></p>
<pre>$ uname -a
Darwin 11.1.0 Darwin Kernel Version 11.1.0: Tue Jul 26 16:07:11 PDT 2011; root:xnu-1699.22.81~1/RELEASE_X86_64 x86_64

$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)</pre>
<p>The winner is the blue bar which is the highest.</p>
<p><a href="http://benjchristensen.files.wordpress.com/2011/10/concurrent_throughput_rollingnumber_macbookpro.png"><img class="aligncenter size-full wp-image-400" title="concurrent_throughput_rollingnumber_macbookpro" src="http://benjchristensen.files.wordpress.com/2011/10/concurrent_throughput_rollingnumber_macbookpro.png?w=800&#038;h=599" alt="" width="800" height="599" /></a></p>
<p><strong>Amazon EC2 m2.4xlarge</strong><br />
High-Memory Quadruple Extra Large Instance 68.4 GB of memory, 26 EC2 Compute Units (8 virtual cores with 3.25 EC2 Compute Units each), 1690 GB of local instance storage, 64-bit platform</p>
<pre>$ uname -a
Linux 2.6.21.7-2.ec2.v1.3.fc8xen #1 SMP Sat Sep 25 01:16:50 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

$ /usr/java/latest/bin/java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)</pre>
<p>The winner is the orange bar which is the highest.</p>
<p><a href="http://benjchristensen.files.wordpress.com/2011/10/concurrent_throughput_rollingnumber_ec2.png"><img class="aligncenter size-full wp-image-404" title="concurrent_throughput_rollingnumber_ec2" src="http://benjchristensen.files.wordpress.com/2011/10/concurrent_throughput_rollingnumber_ec2.png?w=800&#038;h=548" alt="" width="800" height="548" /></a></p>
<p><strong>Running the Test</strong></p>
<p>You can run the test using an <a href="https://github.com/downloads/benjchristensen/RollingNumberConcurrencyTesting/RollingNumberThroughputTest.jar">executable JAR</a> with the command:</p>
<pre>
java -Xmx1g -jar RollingNumberThroughputTest.jar
</pre>
<p>The test also validates that the code does what it should and is able to find non-thread-safe implementations by looking for incorrect math caused by concurrency bugs.</p>
<p><strong>Conclusion</strong></p>
<p>I found it very interesting how differently the results were on the 2 machines (operating systems and CPUs are very different, the JVM implementations are also different). In both cases though the AtomicCircularArray performed better, far better on the EC2 instance running the Sun JVM.</p>
<p>These tests provided me with the data to choose AtomicCircularArray and as mentioned above it is similar to what I&#8217;m now using in production.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/399/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/399/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/399/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/399/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/399/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/399/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/399/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=399&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/10/08/atomiccirculararray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/10/concurrent_throughput_rollingnumber_macbookpro.png" medium="image">
			<media:title type="html">concurrent_throughput_rollingnumber_macbookpro</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/10/concurrent_throughput_rollingnumber_ec2.png" medium="image">
			<media:title type="html">concurrent_throughput_rollingnumber_ec2</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple Sparkline using SVG Path and D3.js</title>
		<link>http://benjchristensen.com/2011/08/08/simple-sparkline-using-svg-path-and-d3-js/</link>
		<comments>http://benjchristensen.com/2011/08/08/simple-sparkline-using-svg-path-and-d3-js/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 05:52:24 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=388</guid>
		<description><![CDATA[I&#8217;ve been playing with SVG visualization and the d3.js library (replacement to Protovis). As a starting point this is a simple line chart used as a sparkline. The HTML and Javascript provide a boiler plate from which more complex visualizations and charts can be built. Here are links to the code and working example: http://bl.ocks.org/1133472 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=388&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with SVG visualization and the <a href="http://mbostock.github.com/d3/">d3.js</a> library (replacement to <a href="http://mbostock.github.com/protovis/">Protovis</a>).</p>
<p>As a starting point this is a simple line chart used as a sparkline. The HTML and Javascript provide a boiler plate from which more complex visualizations and charts can be built.</p>
<p><img class="aligncenter size-full wp-image-389" style="border-color:initial;border-style:initial;border-width:0;" src="http://benjchristensen.files.wordpress.com/2011/08/screen-shot-2011-08-08-at-10-47-16-pm.png?w=800" alt=""   /></p>
<p>Here are links to the code and working example:</p>
<p><a href="http://bl.ocks.org/1133472">http://bl.ocks.org/1133472</a><br />
<a href="https://gist.github.com/1133472"> https://gist.github.com/1133472</a></p>
<p>To make the size more applicable to inline <img style="position:relative;top:10px;border-color:initial;border-style:initial;border-width:0;" src="http://benjchristensen.files.wordpress.com/2011/08/screen-shot-2011-08-08-at-11-00-18-pm.png?w=113&#038;h=21" alt="" width="113" height="21" /> use as a sparkline decrease the ranges:<br />
<code><br />
var x = d3.scale.linear().domain([0, 10]).range([0, 20]);<br />
var y = d3.scale.linear().domain([0, 10]).range([0, 10]);<br />
</code></p>
<p>&nbsp;</p>
<p>UPDATE: I added another version that shows animations with transformations and transitions.</p>
<p><a href="http://bl.ocks.org/1148374">http://bl.ocks.org/1148374</a><br />
<a href="https://gist.github.com/1148374">https://gist.github.com/1148374</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/388/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/388/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/388/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=388&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/08/08/simple-sparkline-using-svg-path-and-d3-js/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/08/screen-shot-2011-08-08-at-10-47-16-pm.png" medium="image" />

		<media:content url="http://benjchristensen.files.wordpress.com/2011/08/screen-shot-2011-08-08-at-11-00-18-pm.png" medium="image" />
	</item>
		<item>
		<title>Automount AFP via autofs in Mac OSX (Snow Leopard)</title>
		<link>http://benjchristensen.com/2011/06/21/automount-afp-via-autofs-in-mac-osx-snow-leopard/</link>
		<comments>http://benjchristensen.com/2011/06/21/automount-afp-via-autofs-in-mac-osx-snow-leopard/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 20:51:34 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=380</guid>
		<description><![CDATA[I wanted a mount point that was automatic from my desktop to laptop and didn&#8217;t need me to manually re-connect each time I came back to it. After a bit of research, trial and error I figured out the correct incantation: Edit the /etc/fstab (create if not there) to be: HOSTNAME:MOUNTPOINT /PATH_ON_MACHINE_TO_USE_AS_MOUNT url automounted,url==afp://USERNAME:PASSWORD@HOSTNAME/MOUNTPOINT 0 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=380&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I wanted a mount point that was automatic from my desktop to laptop and didn&#8217;t need me to manually re-connect each time I came back to it.</p>
<p>After a bit of research, trial and error I figured out the correct incantation:</p>
<p>Edit the /etc/fstab (create if not there) to be:<br />
<code><br />
HOSTNAME:MOUNTPOINT /PATH_ON_MACHINE_TO_USE_AS_MOUNT url automounted,url==afp://USERNAME:PASSWORD@HOSTNAME/MOUNTPOINT 0 0<br />
</code></p>
<p>Note that &#8220;MOUNTPOINT&#8221; on Mac for a users directory is NOT &#8220;/Users/username&#8221;, it is just &#8220;username&#8221;.</p>
<p>To restart the automounter type:<br />
<code><br />
automount -vc<br />
</code></p>
<p>It will mount the newly defined mountpoint and create the folder defined with PATH_ON_MACHINE_TO_USE_AS_MOUNT.</p>
<p>Some links I found useful while researching:</p>
<p><a href="http://forums.plexapp.com/index.php/topic/14201-howto-automount-afpsmb-shares-using-autofs/">http://forums.plexapp.com/index.php/topic/14201-howto-automount-afpsmb-shares-using-autofs/</a><br />
<a href="http://rajeev.name/2007/11/23/autofs-goodness-in-apples-leopard-105-part-ii/">http://rajeev.name/2007/11/23/autofs-goodness-in-apples-leopard-105-part-ii/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/380/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/380/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/380/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=380&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/06/21/automount-afp-via-autofs-in-mac-osx-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>
	</item>
		<item>
		<title>Tweet Archiver</title>
		<link>http://benjchristensen.com/2011/05/29/tweet-archiver/</link>
		<comments>http://benjchristensen.com/2011/05/29/tweet-archiver/#comments</comments>
		<pubDate>Sun, 29 May 2011 06:53:09 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=374</guid>
		<description><![CDATA[I wanted to learn Ruby so wrote a script to do something I&#8217;ve wanted for a while &#8211; a simple mechanism to retrieve all of my Tweets using the Twitter API. https://github.com/benjchristensen/TweetArchiver Eventually I&#8217;ll add the functionality I want that will expand all shortened links and perhaps even download pictures that I&#8217;ve linked to or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=374&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I wanted to learn Ruby so wrote a script to do something I&#8217;ve wanted for a while &#8211; a simple mechanism to retrieve all of my Tweets using the Twitter API.</p>
<p><a href="https://github.com/benjchristensen/TweetArchiver">https://github.com/benjchristensen/TweetArchiver</a></p>
<p>Eventually I&#8217;ll add the functionality I want that will expand all shortened links and perhaps even download pictures that I&#8217;ve linked to or posted via services such as TwitPic.</p>
<p>Anyway, Ruby is kind of perfect for this type of hacking it seems and now I can archive my Twitter history easily (and yes I know there are lots of other people who have done this before &#8230; don&#8217;t bother telling me, I just needed something more than &#8220;Hello World&#8221;).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/374/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=374&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/05/29/tweet-archiver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>
	</item>
		<item>
		<title>Dynamic Directory of Jar Files in Classpath via Eclipse Plugin</title>
		<link>http://benjchristensen.com/2011/05/26/dynamic-directory-of-jar-files-in-classpath-via-eclipse-plugin/</link>
		<comments>http://benjchristensen.com/2011/05/26/dynamic-directory-of-jar-files-in-classpath-via-eclipse-plugin/#comments</comments>
		<pubDate>Fri, 27 May 2011 04:34:24 +0000</pubDate>
		<dc:creator>Ben Christensen</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://benjchristensen.com/?p=364</guid>
		<description><![CDATA[I came across a scenario where I needed Eclipse to dynamically add a folder of jar files to the classpath and found out that Eclipse doesn&#8217;t support this out of the box (no idea why &#8230; IntelliJ does). So I began Googling and found &#8220;how&#8221; to solve it by writing a classpath container but could [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=364&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I came across a scenario where I needed Eclipse to dynamically add a folder of jar files to the classpath and found out that Eclipse doesn&#8217;t support this out of the box (no idea why &#8230; IntelliJ does).</p>
<p>So I began Googling and found &#8220;how&#8221; to solve it by writing a classpath container but could find a pre-packaged solution.</p>
<p>The how was explained here: <a href="https://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-classpath/">https://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-classpath/</a></p>
<p>I took that example and tweaked it into a working plugin. It now lives at <a href="https://github.com/benjchristensen/SimpleDirectoryContainer_EclipsePlugin">GitHub</a> where the plugin and source can be downloaded.</p>
<p>Once the plugin is installed in Eclipse, edit the &#8220;Java Build Path&#8221; on a project and click &#8220;Add Library&#8221; and choose &#8220;Directory Container&#8221;:</p>
<p><a href="http://benjchristensen.files.wordpress.com/2011/05/add-library.png"><img src="http://benjchristensen.files.wordpress.com/2011/05/add-library.png?w=800&#038;h=543" alt="" title="add-library" width="800" height="543" class="aligncenter size-full wp-image-368" /></a></p>
<p>Then choose the folder (a subfolder of the project so it&#8217;s relative) and defines what file extensions it should include:</p>
<p><a href="http://benjchristensen.files.wordpress.com/2011/05/creating-library.png"><img src="http://benjchristensen.files.wordpress.com/2011/05/creating-library.png?w=800" alt="" title="creating-library"   class="aligncenter size-full wp-image-365" /></a></p>
<p>Once saved this library will show up like any other Eclipse classpath library and show all Jar files from the selected folder &#8230; and most importantly will dynamically update the classpath when refreshed to whatever is in that folder.<br />
<a href="http://benjchristensen.files.wordpress.com/2011/05/directory-classpath.png"><img src="http://benjchristensen.files.wordpress.com/2011/05/directory-classpath.png?w=800" alt="" title="directory-classpath"   class="aligncenter size-full wp-image-371" /></a></p>
<p>I hope this helps someone else needing the same behavior in Eclipse!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/benjchristensen.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/benjchristensen.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/benjchristensen.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/benjchristensen.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/benjchristensen.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/benjchristensen.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/benjchristensen.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/benjchristensen.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/benjchristensen.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/benjchristensen.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/benjchristensen.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/benjchristensen.wordpress.com/364/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/benjchristensen.wordpress.com/364/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/benjchristensen.wordpress.com/364/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=benjchristensen.com&amp;blog=859104&amp;post=364&amp;subd=benjchristensen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://benjchristensen.com/2011/05/26/dynamic-directory-of-jar-files-in-classpath-via-eclipse-plugin/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/25a69d1e333ff36b77cf01b84b764182?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">benjchristensen</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/05/add-library.png" medium="image">
			<media:title type="html">add-library</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/05/creating-library.png" medium="image">
			<media:title type="html">creating-library</media:title>
		</media:content>

		<media:content url="http://benjchristensen.files.wordpress.com/2011/05/directory-classpath.png" medium="image">
			<media:title type="html">directory-classpath</media:title>
		</media:content>
	</item>
	</channel>
</rss>
