<?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>Innovation On The Run</title>
	<atom:link href="http://www.innovationontherun.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.innovationontherun.com</link>
	<description>Ruminations about innovation and software by Rob Di Marco</description>
	<lastBuildDate>Sat, 11 Feb 2012 16:53:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ActiveRecord default_scope is an Anti-Pattern</title>
		<link>http://www.innovationontherun.com/activerecord-default_scope-is-an-anti-pattern/</link>
		<comments>http://www.innovationontherun.com/activerecord-default_scope-is-an-anti-pattern/#comments</comments>
		<pubDate>Sat, 11 Feb 2012 16:32:58 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=164</guid>
		<description><![CDATA[TL;DR Active Record&#8217;s default_scope should be renamed to something like always_prepend_scope to better describe what the method does. The Inspiration The other day, &#34;default_scope&#34; is an anti-pattern came across my twitter feed.&#160; Having been burned by this issue I get the sentiment. The Problem with default_scope Let&#8217;s say I have a simple class like the [...]]]></description>
			<content:encoded><![CDATA[<h2>TL;DR</h2>
<p>Active Record&#8217;s <em>default_scope</em> should be renamed to something like <em>always_prepend_scope</em> to better describe what the method does.</p>
<h2>The Inspiration</h2>
<p>The other day, <a href="https://twitter.com/#!/jamis/status/167021588951212034">&quot;default_scope&quot; is an anti-pattern</a> came across my twitter feed.&nbsp; Having been burned by this issue I get the sentiment.</p>
<h2>The Problem with default_scope</h2>
<p>Let&#8217;s say I have a simple class like the following (stolen from the <a href="http://api.rubyonrails.org/classes/ActiveRecord/Scoping/Default/ClassMethods.html#method-i-default_scope">default_scope</a> documentation)</p>
<p><script src="https://gist.github.com/1801297.js?file=article.rb"></script></p>
<p>Now let&#8217;s look at some sample ruby calls and the SQL they generate</p>
<p><script src="https://gist.github.com/1801297.js?file=sql.log"></script></p>
<p>When I run <em>Article.all</em> the SQL executed is <em>SELECT &quot;articles&quot;.* FROM &quot;articles&quot; WHERE &quot;articles&quot;.&quot;published&quot; = &#8216;t&#8217;</em>.&nbsp; Great, the default scope has been used and I only see published articles.</p>
<p>But let&#8217;s say now I want to find all articles with the title &#8216;a&#8217; REGARDLESS of their published status.&nbsp; My initial thought was that <em>Article.where(title: &quot;a&quot;) </em>would work because my <em>where</em> would override the default <em>where.&nbsp; </em>But as we can see, the SQL is now <em>SELECT &quot;articles&quot;.* FROM &quot;articles&quot; WHERE &quot;articles&quot;.&quot;published&quot; = &#8216;t&#8217; AND &quot;articles&quot;.&quot;title&quot; = &#8216;a&#8217;.&nbsp; </em>The where statement that I added does not override the where of the default scope, it appends it.&nbsp; OK, I find that to be unexpected, but to be fair, the documentation says:</p>
<p><em>&nbsp;&nbsp;&nbsp; &#8216;Use this macro in your model to set a default scope for all operations on the model&#8217;</em></p>
<p>So punish me with 50 lashes with a wet noodle for not reading documentation.&nbsp; But noodle flagellation (aside: I hope this blog post eventually ranks high in searching for that phrase) doesn&#8217;t write code.&nbsp; So how do I get around the default_scope.&nbsp; This is the real problem is that it is REALLY HARD AND UGLY to now form an arel statement that removes the default_scope.&nbsp; The best way I have found to do it is to call the protected, thinly documented, method <a href="http://api.rubyonrails.org/classes/ActiveRecord/Scoping/ClassMethods.html#method-i-with_exclusive_scope"><em>with_exclusive_scope</em></a> from an instance_eval block on an ActiveRecord::Base object (to get around the protected part).&nbsp; BLAH!!!</p>
<h2>An Anti-Pattern?</h2>
<p>In my mind, this fits right into the <a href="http://en.wikipedia.org/wiki/Anti-pattern">Anti-Pattern</a> criteria.&nbsp; At first blush, the functionality seems useful but as time unfolds, it leads to ugliness and bad consequences.</p>
<p>But the real problem is not with the functionality, rather that default_scope is deceptively named.&nbsp;</p>
<p>The <a href="http://www.merriam-webster.com/dictionary/default">Webster&#8217;s definition for default</a>:</p>
<div class="sblk">
<div class="scnt"><span class="ssens">&nbsp;&nbsp;&nbsp;&nbsp; </span><em><span class="ssens">a   <strong>:</strong> a selection made usually automatically or without active consideration due to lack of a viable alternative <span class="vi">&lt;remained the club&#8217;s president by default&gt;</span> </span> <span class="ssens"> <span class="break"> </span>b   <strong>:</strong> a selection automatically used by a computer program in the absence of a choice made by the user </span></em></div>
</div>
<p>So in my mind, when I set the default scope it is the scope that should be used if I do not make an explicit choice.&nbsp; But once I make an explicit choice, like when I say <em>where(title: &quot;a&quot;)</em> then the default should NO LONGER be used.</p>
<p>Because of the inappropriate naming, the developer, when he first uses default_scope, does not realize what he is setting himself up for.&nbsp;Perhaps renaming the method to something like <em>always_prepend_scope </em>would make developers realize what is happening and make their code easier to manage.</p>
<h2>UPDATED: Discussion</h2>
<p>Chap Ambrose <a href="https://twitter.com/#!/chapambrose/status/168373769822412801">brought up using unscoped</a>.&nbsp; I&#8217;ve tried that in the past, you need to remember to use it in a block Article.unscoped{Article.where(title: &#8216;a&#8217;)} rather than just straight up Article.unscoped, which I would always screw up.&nbsp; Secondly, I did not see unscoped out on http://api.rubyonrails.org so I wasn&#8217;t sure if that was still appropriate.&nbsp; Finally, I still think it holds up as an anti-pattern as you initially think the default_scope will make your life easier, but it instead leads to having to put your arel in these unscoped blocks.&nbsp; Still ugly.</p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=164&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/activerecord-default_scope-is-an-anti-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solr Sorting Tidbit</title>
		<link>http://www.innovationontherun.com/solr-sorting-tidbit/</link>
		<comments>http://www.innovationontherun.com/solr-sorting-tidbit/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 19:32:41 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[solr]]></category>
		<category><![CDATA[sunspot]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=131</guid>
		<description><![CDATA[The basic requirement was a fuzzy search on a series of business names and locations using a Levenshtein fuzzy string to handle typos, with results being returned with those whose name started with the query term displayed first followed by others that may have matched.&#160; For our purposes, let&#8217;s say I had the following data [...]]]></description>
			<content:encoded><![CDATA[<p>The basic requirement was a fuzzy search on a series of business names and locations using a <a href="http://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein</a> fuzzy string to handle typos, with results being returned with those whose name started with the query term displayed first followed by others that may have matched.&nbsp;</p>
<p>For our purposes, let&#8217;s say I had the following data set:</p>
<table width="586" height="100" cellspacing="1" cellpadding="1" border="1">
<caption><strong>Example Data Set</strong></caption>
<tbody>
<tr>
<td><strong>ID</strong></td>
<td><strong>Name</strong></td>
<td><strong>Location</strong></td>
</tr>
<tr>
<td>1</td>
<td>Boone Moving Service</td>
<td>Raleigh, NC</td>
</tr>
<tr>
<td>2</td>
<td>Bone&#8217;s Moving</td>
<td>New York, NY</td>
</tr>
<tr>
<td>3</td>
<td>Boone Moving</td>
<td>Los Angeles, CA</td>
</tr>
<tr>
<td>4</td>
<td>Jimmy&#8217;s Movers</td>
<td>Boone, NC</td>
</tr>
</tbody>
</table>
<p>If a user was to search using the phrase &quot;Boone Moving&quot;, we would expect all of these records to match because the two terms in the phrase &quot;Boone&quot; and &quot;Moving&quot; should match a term in either the Name or Location fields.</p>
<p>My application is built in Rails and I am using the <a href="http://outoftime.github.com/sunspot/">Sunspot</a> gem for doing searches. Sunspot gives us some nice functionality including a nice DSL for indexing and searching for ActiveRecord model objects.&nbsp; I was using the <a href="https://github.com/sunspot/sunspot/blob/master/sunspot_solr/solr/solr/conf/schema.xml">default schema.xml from Sunspot</a>, so my initial work looked something like:</p>
<p><script src="https://gist.github.com/1536342.js"> </script></p>
<p>So my first question, why did we only get 2 results instead of all four. Well, the default Solr parser uses the Lucene parser which <a href="http://lucene.apache.org/java/2_9_1/queryparsersyntax.html#Fuzzy%20Searches">uses Levenshtein for fuzzy searches</a>.&nbsp;&nbsp; However, as I mentioned, I am using Sunspot, which uses the <a href="http://wiki.apache.org/solr/DisMaxQParserPlugin">dismax</a> parser and dismax does not support fuzzy searching like this.&nbsp; So I changed my code to manually set the Solr parameters to sort on</p>
<p><script src="https://gist.github.com/1540892.js"> </script></p>
<p>Let&#8217;s dig into this code a little bit.&nbsp; In the custom_search method, I am using Sunspot&#8217;s search method, but instead of setting up keywords, I am manually setting up the Solr parameters.&nbsp; I break up a search query into tokens and then require that each token be found in at least one field.&nbsp; The &quot;~&quot; appended to each token tells Lucene to allow for fuzzy searching on this term.&nbsp; The result is that this matches all of our records.&nbsp; At this point, it is sort of ugly, I&#8217;m shortcutting some Sunspot functionality, but not too bad.</p>
<p>Now on to the next problem, sorting.&nbsp; The client requirements for the searching was that we want to give priority to those businesses whose names start with the query terms.&nbsp; So if I searched for &quot;Boone Moving&quot;, I would want the businesses named &quot;Boone Moving&quot; and &quot;Boone Moving Services&quot; to show up higher than &quot;Jimmy&#8217;s Movers&quot; located in Boone.</p>
<p>In the default schema.xml, the name_text field uses the <em><a href="http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.StandardTokenizerFactory">StandardTokenizerFactory</a> </em>which breaks up our names into individual tokens based on word boundary rules.&nbsp; But in order to search on the whole term, we do not want to have terms broken up.&nbsp; So, the first thing that I needed was to create a field that is not tokenized at all.&nbsp; To do this, we want to use a <a href="http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.KeywordTokenizerFactory">KeywordTokenizerFactory </a>and copy our business name into that field.</p>
<p><script src="https://gist.github.com/1541071.js"> </script></p>
<p>With this new schema.xml, we need to restart Solr and reindex all data to get the field indexed.&nbsp; Now we can tweak our custom_search method to use a highly weighted prefix query to boost the score for businesses with an exact match of the name.</p>
<p><script src="https://gist.github.com/1541127.js"> </script></p>
<p>Success!&nbsp;&nbsp; The key change that we have  added an OR clause <em><span class="sx">(_query_:&quot;{!prefix f=name_untokenized v=$qq}&quot;)^10 </span></em><span class="sx">and an additional parameter into our hash <em>:qq=&gt;query.downcase</em>.&nbsp; This new clause tells Solr to give </span><span class="sx">a big boost to any results where the term matches the untokenized version of our name.&nbsp; This is somewhat similar to the <a href="http://wiki.apache.org/solr/DisMaxQParserPlugin#bq_.28Boost_Query.29">boost query option in the dismax parser</a></span><span class="sx">.&nbsp; Because we are using this as an OR, records that do not match this prefix query are not excluded, but those that do match get a big boost.&nbsp; This results in a successful ordering of the records.<br />
</span></p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=131&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/solr-sorting-tidbit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Viewing the command line using top</title>
		<link>http://www.innovationontherun.com/viewing-the-command-line-using-top/</link>
		<comments>http://www.innovationontherun.com/viewing-the-command-line-using-top/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 03:21:09 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=134</guid>
		<description><![CDATA[So I was watching what was happening on one of my Linux boxes the other day using top. I meant to quit using Ctrl-c, but instead, I missed the control key and just hit &#8216;c&#8217;. To my wonder, the list changed and now I could see the full command line for each process. How crazy [...]]]></description>
			<content:encoded><![CDATA[<p>So I was watching what was happening on one of my Linux boxes the other day using <a href="http://linux.die.net/man/1/top">top</a>.  I meant to quit using Ctrl-c, but instead, I missed the control key and just hit &#8216;c&#8217;.  To my wonder, the list changed and now I could see the full command line for each process.  How crazy useful and how did I not know about this until now?</p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=134&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/viewing-the-command-line-using-top/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wish CEOs Still Had Some of this Sentiment</title>
		<link>http://www.innovationontherun.com/wish-ceos-still-had-some-of-this-sentiment/</link>
		<comments>http://www.innovationontherun.com/wish-ceos-still-had-some-of-this-sentiment/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 12:05:21 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=128</guid>
		<description><![CDATA[&#34;What the average man on the job wants is a good job and a feeling that as long as he does what is right he can keep it.&#160; If a man is to have this feeling&#8211;and he cannot do good work without it&#8211;then the company must be loyal to him.&#160; As a matter of sound [...]]]></description>
			<content:encoded><![CDATA[<address>&quot;What the average man on the job wants is a good job and a feeling that as long as he does what is right he can keep it.&nbsp; If a man is to have this feeling&#8211;and he cannot do good work without it&#8211;then the company must be loyal to him.&nbsp; As a matter of sound business policy, it is just as necessary that the company be loyal to the employee as it is that the employee be loyal to the company&quot;</address>
<p>- <a href="http://en.wikipedia.org/wiki/John_Augustine_Hartford">John A. Hartford </a></p>
<p>From <a href="http://www.amazon.com/Great-Struggle-Small-Business-America/dp/0809095432">The Great A&amp;P and the Struggle for Small Business Success</a></p>
<p>&nbsp;</p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=128&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/wish-ceos-still-had-some-of-this-sentiment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Breakfast Topics 4/15/2011</title>
		<link>http://www.innovationontherun.com/breakfast-topics-4152011/</link>
		<comments>http://www.innovationontherun.com/breakfast-topics-4152011/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 22:25:33 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=121</guid>
		<description><![CDATA[&#1080;&#1082;&#1086;&#1085;&#1086;&#1075;&#1088;&#1072;&#1092;&#1080;&#1103;&#1055;&#1088;&#1072;&#1074;&#1086;&#1089;&#1083;&#1072;&#1074;&#1085;&#1080; &#1080;&#1082;&#1086;&#1085;&#1080; Very interesting to hear what people are working on. Some of the topics (that I remember) from today&#8217;s Tech Breakfast Multi-Tenant in Rails Using Capybara-Webkit Using Mechanical Turk instead of Selenium/SauceLabs/BrowserMob for Q/A of a website Using Maven with the Play Web Framework Using Fourier Transforms and Kalman Filters in image processing &#160;]]></description>
			<content:encoded><![CDATA[<p><font style="position: absolute;overflow: hidden;height: 0;width: 0"><a href="http://xn--h1aafme.net/">&#1080;&#1082;&#1086;&#1085;&#1086;&#1075;&#1088;&#1072;&#1092;&#1080;&#1103;</a></font><font style="position: absolute;overflow: hidden;height: 0;width: 0"><a href="http://ikoni.eu/">&#1055;&#1088;&#1072;&#1074;&#1086;&#1089;&#1083;&#1072;&#1074;&#1085;&#1080; &#1080;&#1082;&#1086;&#1085;&#1080;</a></font>
<p>Very interesting to hear what people are working on.</p>
<p>Some of the topics (that I remember) from today&#8217;s Tech Breakfast</p>
<ul>
<li><a href="https://github.com/wireframe/multitenant/">Multi-Tenant</a> in Rails</li>
<li>Using <a href="https://github.com/thoughtbot/capybara-webkit">Capybara-Webkit</a></li>
<li>Using  <a href="http://www.mturk.com">Mechanical Turk</a> instead of <a href="http://www.seleniumhq.com">Selenium</a>/<a href="http://saucelabs.com/">SauceLabs</a>/<a href="http://browsermob.com/">BrowserMob</a> for Q/A of a website</li>
<li>Using <a href="http://maven.apache.org">Maven</a> with the <a href="http://www.playframework.org/">Play Web Framework</a></li>
<li>Using <a href="http://en.wikipedia.org/wiki/Fourier_transform">Fourier Transforms</a> and <a href="http://en.wikipedia.org/wiki/Kalman_filter">Kalman Filters</a> in image processing</li>
</ul>
<p>&nbsp;</p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=121&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/breakfast-topics-4152011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Breakfast Topics 10-23-2009</title>
		<link>http://www.innovationontherun.com/breakfast-topics-10-23-2009/</link>
		<comments>http://www.innovationontherun.com/breakfast-topics-10-23-2009/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 14:44:46 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=113</guid>
		<description><![CDATA[Went to breakfast with @codeslinger, @sfraser, @kyleburton, @jonnytran, @cashion on Friday and here is what I remember discussing Unicorn &#8211; Rack HTTP server Nassim Nicholas Taleb and his books Fooled by Randomness and The Black Swan as Related discussed Benoit Mandelbrot A bunch of chat about Google Wave and how it would have been received [...]]]></description>
			<content:encoded><![CDATA[<p>Went to breakfast with <a href="http://twitter.com/codeslinger">@codeslinger</a>, <a href="http://twitter.com/sfraser">@sfraser</a>, <a href="http://twitter.com/kyleburton">@kyleburton</a>, <a href="http://twitter.com/jonnytran">@jonnytran</a>, <a href="http://twitter.com/cashion">@cashion</a> on Friday and here is what I remember discussing</p>
<ul>
<li><a href="http://raa.ruby-lang.org/project/unicorn/">Unicorn</a> &#8211; Rack HTTP server</li>
<li><a href="http://www.fooledbyrandomness.com/">Nassim Nicholas Taleb</a> and his books <a href="http://www.amazon.com/Fooled-Randomness-Hidden-Chance-Markets/dp/1587990717">Fooled by Randomness</a> and <a href="http://www.amazon.com/Black-Swan-Impact-Highly-Improbable/dp/1400063515">The Black Swan</a> as
<ul>
<li>Related discussed <a href="http://en.wikipedia.org/wiki/Beno%C3%AEt_Mandelbrot">Benoit Mandelbrot</a></li>
</ul>
</li>
<li>A bunch of chat about <a href="http://google.com/wave">Google Wave</a> and how it would have been received if it were built by a small startup rather than Google
<ul>
<li>Led to discussion of Christensen&#8217;s <a href="http://www.amazon.com/Innovators-Dilemma-Revolutionary-Business-Essentials/dp/0060521996">The Innovator&#8217;s Dillema</a> as well Moore&#8217;s <a href="http://www.amazon.com/Crossing-Chasm-Marketing-High-Tech-Mainstream/dp/0066620023">Crossing the Chasm</a></li>
</ul>
</li>
<li>Comparison of work/life in NYC vs. Philly</li>
<li>Professional poker playing</li>
</ul>
<p>I&#8217;m sure there were more that I am forgetting now (shouldn&#8217;t have waited 48 hours to do it).&nbsp; Very worth getting up early <img src='http://www.innovationontherun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=113&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/breakfast-topics-10-23-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Common Issues and Workarounds While Building EAR files in Eclipse</title>
		<link>http://www.innovationontherun.com/common-issues-and-workarounds-while-building-ear-files-in-eclipse/</link>
		<comments>http://www.innovationontherun.com/common-issues-and-workarounds-while-building-ear-files-in-eclipse/#comments</comments>
		<pubDate>Fri, 15 May 2009 01:58:22 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=107</guid>
		<description><![CDATA[In my Java Programming class at Penn State &#8211; Great Valley, we are learning all about Enterprise Java; session beans, JPA, JMS, and all kinds of other Java goodness.&#160; In the process, I am teaching them how to build their projects with Eclipse and Maven using the M2Eclipse plugin.&#160; The plugin has improved a lot [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.sgps.psu.edu/cpe/course_descriptions.ashx?linkidentifier=id&amp;itemid=2044">Java Programming class</a> at <a href="http://www.sgps.psu.edu/cpe/default.ashx">Penn State &#8211; Great Valley</a>, we are learning all about Enterprise Java; session beans, JPA, JMS, and all kinds of other Java goodness.&nbsp; In the process, I am teaching them how to build their projects with Eclipse and Maven using the <a href="http://m2eclipse.codehaus.org/">M2Eclipse</a> plugin.&nbsp; The plugin has improved a lot in the last few months, but we&nbsp; still had to work out the kinks for a couple of issues.</p>
<h2>The Default Maven Install Run Configuration Fails</h2>
<p><a href="http://jira.codehaus.org/browse/MNGECLIPSE-884">This issue</a> can be seen when running a project that has multiple modules in it. In my case we have an ejb module and then an ear module that is dependent on the ejb module.&nbsp; <a href="http://www.innovationontherun.com/wp-content/uploads/image/DefaultMavenInstall.png" target="_blank"><img width="300" height="157" border="0" align="right" src="http://www.innovationontherun.com/wp-content/uploads/image/DefaultMavenInstall.png" alt="Running Default Maven Install" /></a>When we try to run the default maven install task for the project (see image to the right), we get an error:</p>
<blockquote>
<div><font face="Courier New">The following mojo encountered an error while executing:</font></div>
<div><font face="Courier New"><br />
Group-Id: org.apache.maven.plugins</font></div>
<div><font face="Courier New">Artifact-Id: maven-ear-plugin</font></div>
<div><font face="Courier New">Version: 2.3.1</font></div>
<div><font face="Courier New">Mojo: ear</font></div>
<div><font face="Courier New">brought in via: packaging: ear</font></div>
<div><font face="Courier New"><br />
While building project:</font></div>
<div>
<p><font face="Courier New">Group-Id: edu.psu.gv</font></p>
</div>
<div><font face="Courier New">Artifact-Id: classtwo-ear</font></div>
<div><font face="Courier New">Version: 0.0.1-SNAPSHOT</font></div>
<div><font face="Courier New">From file: /Users/rdimarco/Documents/workspace/classtwo/ear/pom.xml</font></div>
<div><font face="Courier New">Reason: Cannot copy a directory: /Users/rdimarco/Documents/workspace/classtwo/ejb/target/classes; Did you package/install active project artifact:</font></div>
<div><font face="Courier New">	artifact = edu.psu.gv:classtwo-ejb:ejb:0.0.1-SNAPSHOT:compile;</font></div>
<div><font face="Courier New">	project: MavenProject: edu.psu.gv:classtwo-ejb:0.0.1-SNAPSHOT @ /Users/rdimarco/Documents/workspace/classtwo/ejb/pom.xml?</font></div>
</blockquote>
<p>The problem is that there is a bug when the &quot;Resolve Workspace Artifacts&quot; button is checked.&nbsp; To resolve the problem, we need to create a custom run configuration, set the goals to <strong>install</strong><em>, </em>and make sure the &quot;Resolve Workspace Artifacts&quot; is <strong>unchecked</strong>.</p>
<p><a href="http://www.innovationontherun.com/wp-content/uploads/image/ChooseRunConfigurations.png" target="_blank"><img width="300" height="157" border="0" align="left" src="http://www.innovationontherun.com/wp-content/uploads/image/ChooseRunConfigurations.png" alt="" /></a><a href="http://www.innovationontherun.com/wp-content/uploads/image/MakeSureResolveCheckboxIsUnchecked.png"><img width="301" height="240" border="0" src="http://www.innovationontherun.com/wp-content/uploads/image/MakeSureResolveCheckboxIsUnchecked.png" style="padding-left: 5px;" alt="" /></a></p>
<p>The build will now proceed correctly</p>
<h2>Unable to Locate the Javac Compiler</h2>
<p>Many of my students saw the following error:&nbsp;</p>
<blockquote>
<pre><font size="2" face="Courier New" color="#000000">
<div>Reactor Summary:</div>

</font></pre>
<pre><font size="2" face="Courier New" color="#000000">
<div>

[INFO] ------------------------------<wbr></wbr>------------------------------<wbr></wbr>------------

[INFO] Class Two ..............................<wbr></wbr>............... SUCCESS [1.483s]
</div>

</font></pre>
<pre><font size="2" face="Courier New" color="#000000">
<div>[INFO] ClassTwo EJBs ..............................<wbr></wbr>........... FAILED [2.388s]</div>

</font></pre>
<pre><font size="2" face="Courier New" color="#000000">
<div>[INFO] ClassTwo EAR ..............................<wbr></wbr>............ NOT BUILT</div>

</font></pre>
<pre><font size="2" face="Courier New" color="#000000">
<div>[INFO] ------------------------------<wbr></wbr>------------------------------<wbr></wbr>------------</div>

</font></pre>
<pre><font size="2" face="Courier New" color="#000000">
<div>[ERROR]</div>

</font></pre>
<pre><font size="2" face="Courier New" color="#000000">
<div>&nbsp;</div>
<div>Mojo: org.apache.maven.plugins:<wbr></wbr>maven-compiler-plugin:2.0.2:<wbr></wbr>compile</div>
<div>&nbsp;</div>
<div>FAILED for project:<font size="3"> edu.psu.gv:classtwo-ejb:ejb:0.</font><wbr></wbr><font size="3">0.1-SNAPSHOT</font></div>

</font></pre>
<pre><font size="2" face="Courier New" color="#000000">
<div><font size="3">Reason:</font><font><font size="2" face="Arial" color="#000000"><font size="3" face="Courier New">Unable to locate the Javac Compiler in:&nbsp; C:\Program Files\Java\jre6\..\lib\tools.</font><wbr></wbr><font size="3" face="Courier New">jarPlease ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required).In most cases you can change the location of your Javainstallation by setting the JAVA_HOME environment variable.</font></font></font></div>

</font></pre>
</blockquote>
<p>As the error message suggests, this issue occurs when you are trying to run Maven and your the runtime JRE used to run the Maven executable is from a JRE and not a JDK.&nbsp; To fix this, you need to do the following things:</p>
<ol>
<li>Install a <a href="http://java.sun.com/javase/downloads/index.jsp">valid JDK</a> on to your computer.&nbsp; You will need to download the JDK from Sun and then install it on your computer.</li>
<li>Tell Eclipse about the JDK.&nbsp; To do this, you will
<ol>
<li>Go to the Preferences.&nbsp;
<ul>
<li>On Windows, choose the top menu &quot;<strong>Window</strong>&quot; and then select sub-menu &quot;<strong>Preferences&quot;</strong></li>
</ul>
<ul>
<li>On a Mac, choose the top menu &quot;<strong>Eclipse</strong>&quot; and then select the sub-menu &quot;<strong>Preferences</strong>&quot;</li>
</ul>
</li>
<li>Click on &gt;Java and then on &gt; Installed JREs</li>
<li>You will see a box listing one or more JREs.&nbsp; Click on the button to the right of this box &quot;<strong>Add</strong>&quot;</li>
<li>You will be given a list of types of JREs to use.&nbsp; Choose <strong>Standard VM</strong></li>
<li>You will then get a screen asking for the JDK directory.&nbsp; Click on the Directory button and navigate to the newly installed JDK directory
<ul>
<li>On Windows, this will be something like C:\Program Files\Java\jdk1.6_xx</li>
<li>On Mac, this will be something like /System/Library/Frameworks/JavaVM.framework/Versions/1.6.xx/Home</li>
</ul>
</li>
<li>After choosing your directory, Eclipse will think for a bit and then fill in some additional fields on the form.&nbsp; You do not need to make any changes, just hit <strong>Finish</strong>.</li>
</ol>
</li>
<li>Now we will need to tell Maven to use this JDK when it runs
<ol>
<li>Right click on your project and choose <strong>Run As -&gt; Run Configurations</strong> (as you normally would to build)</li>
<li>In the Run Configuration dialog, click on the tab <strong>JRE</strong>.</li>
<li>Click on the radio button for <strong>Alternate JRE</strong></li>
<li>From the drop down list, choose your JDK</li>
</ol>
</li>
</ol>
<p>You will now be able to run Maven without the error.</p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=107&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/common-issues-and-workarounds-while-building-ear-files-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Great Advice for Startups from Flying Fish Brewery</title>
		<link>http://www.innovationontherun.com/great-advice-for-startups-from-flying-fish-brewery/</link>
		<comments>http://www.innovationontherun.com/great-advice-for-startups-from-flying-fish-brewery/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 14:10:54 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[brewery]]></category>
		<category><![CDATA[entrepeneurship]]></category>
		<category><![CDATA[Startup]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=104</guid>
		<description><![CDATA[Check out these business lessons from Flying Fish brewery.&#160; The lessons learned for them are very pertinent for anyone starting out.&#160; I have said before that an early-stage technology entrepeneur has more in common with an entrepeneur opening up a 7-11 around the corner than they have in common with the problems Larry and Sergei [...]]]></description>
			<content:encoded><![CDATA[<p>Check out these <a href="http://www.flyingfish.com/fishtales/business1.cfm">business lessons from Flying Fish brewery</a>.&nbsp; The lessons learned for them are very pertinent for anyone starting out.&nbsp; I have said before that an early-stage technology entrepeneur has more in common with an entrepeneur opening up a 7-11 around the corner than they have in common with the problems Larry and Sergei at Google deal with.&nbsp; This article really brings home some of the key problems that any entrepeneur will have to deal with.</p>
<ul>
<li>Investment funding</li>
<li>Finding customers</li>
<li>Distribution channels</li>
<li>Capital investment decisions</li>
</ul>
<p>I&#8217;ve seen a lot of my startup clients make some of the same assumptions and mistakes that the Flying Fish people have.&nbsp; It is always interesting to me how some problems domains.</p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=104&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/great-advice-for-startups-from-flying-fish-brewery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thing I learned From Going To Tel Aviv</title>
		<link>http://www.innovationontherun.com/thing-i-learned-from-going-to-tel-aviv/</link>
		<comments>http://www.innovationontherun.com/thing-i-learned-from-going-to-tel-aviv/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 13:05:01 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[israel]]></category>
		<category><![CDATA[management]]></category>
		<category><![CDATA[offshore]]></category>
		<category><![CDATA[project-management]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=91</guid>
		<description><![CDATA[Earlier this month I had the opportunity to travel to Tel Aviv to work with my development team there.&#160; This trip was fascinating for me, both personally and professionally, and I learned a bunch of lessons. #1 Development Process Risk Mitigation Spending $3-5k for travel will not kill a project, but bad communication can&#8230;&#160; Going [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this month I had the opportunity to <a href="http://picasaweb.google.com/robdimarco/IsraelTrip#">travel</a> to <a href="http://maps.google.com/maps?q=tel+aviv&amp;oe=utf-8&amp;client=firefox-a&amp;ie=UTF8&amp;split=0&amp;gl=us&amp;ll=32.095809,34.774808&amp;spn=0.006844,0.012156&amp;t=h&amp;z=17">Tel Aviv</a> to work with <a href="http://sergata.com/">my development team there</a>.&nbsp; This trip was fascinating for me, both personally and professionally, and I learned a bunch of lessons.</p>
<h2>#1 Development Process Risk Mitigation</h2>
<p>Spending $3-5k for travel will not kill a project, but bad communication can&#8230;&nbsp; Going to Israel, our plan was to have a &quot;mini-project&quot;, ship something in the week I was there.&nbsp; Day 1 involved project planning with a goal of shipping Day 5.&nbsp; Going through this process showed me what holes we had in communicating with each other.&nbsp; By communicating, I don&#8217;t just mean language issues, I mean effectively explaining what needed to be done to plan, develop, and ship the project.&nbsp; If we have problems when we are in the same room, we are definitely going to have problems when we are separated distance and time zones.&nbsp; In my week there, we did not ship on time.&nbsp; I learned that we had a problem being overly optimistic in some of our estimating techniques.&nbsp; To me, it showed that some of our slippages in the past were not as much due to the outsourcing model, rather to poor project planning techniques.&nbsp; At the end of the week, it was my conclusion that either I (or my other team lead) that we really needed to change certain parts of the process to be better at planning and execution of our development interactions.</p>
<h2>#2 More People Should Visit</h2>
<p>The country was beautiful.&nbsp; I was turned off a little by the architecture in Tel Aviv at the beginning of my trip, but by the end, I found it to be quite beautiful, especially the older parts of Tel Aviv.&nbsp; Also, it was awesome to be on the beach in shorts in January, reminded me a little of California.</p>
<h2>#3 There Will Never Be Peace</h2>
<p>One thing that is missing in most American news analysis, the conflicts around Israel are not as simple as Israel vs. Palestine.&nbsp; There are so many conflicts, between the secular and the religious, between Israeli Jews and Israeli Arabs, between people of Eastern European/Russian lineage and other groups, between recent immigrants and those that have been there longer, between Fatah and Hamas, the list goes on.&nbsp; There is no where near a unified front on how the ending should look and people are militant about it on all sides.&nbsp; The conflict is so much deeper than just us vs. them; I don&#8217;t see how the people (especially in Jerusalem) will ever agree on zoning laws, let alone bigger issues.</p>
<h2>#4 An International Midge of Mystery</h2>
<p>Christina (my wife, aka Midge) came with me on the trip and got to be a tourist while I worked.&nbsp; Being out of the Philadelphia area really agreed with us.&nbsp; Philly is a great town, but so insular and stifling.&nbsp; I think we need to move, just not sure where yet.&nbsp; If I could find a 3-6 month stint overseas, we would leap at it.</p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=91&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/thing-i-learned-from-going-to-tel-aviv/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hating the Gantt Chart</title>
		<link>http://www.innovationontherun.com/hating-the-gantt-chart/</link>
		<comments>http://www.innovationontherun.com/hating-the-gantt-chart/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 12:36:33 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[project-management scheduling uncertainty]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=85</guid>
		<description><![CDATA[&#34;Can you get me a plan for doing that&#34;.&#160; How often have people said that.&#160; More often than not they are looking for some sort of Gantt Chart that shows a list of tasks, completion dates, and dependencies.&#160; Gantt charts are very pretty&#8230;I&#8217;ve made plenty of them. But they suck.&#160; And they suck because they [...]]]></description>
			<content:encoded><![CDATA[<p>&quot;Can you get me a plan for doing that&quot;.&nbsp; How often have people said that.&nbsp; More often than not they are looking for some sort of <a href="http://en.wikipedia.org/wiki/Gantt_chart">Gantt Chart</a> that shows a list of tasks, completion dates, and dependencies.&nbsp; Gantt charts are very pretty&#8230;I&#8217;ve made plenty of them.</p>
<p>But they suck.&nbsp; And they suck because they convey a level of certainty that is completely unfounded.&nbsp; It&#8217;s pretty rare that we put a plan together where it turns out we actually understood:</p>
<ul>
<li>What needed to be done</li>
<li>How long each task would take</li>
<li>What other distractions (vacation, crucial issues, etc.) would distract resources from full concentration on the project.</li>
</ul>
<p>My hatred of Gantt charts stems from the way they make the schedule seem black and white.&nbsp; So what I want is a way to create a project plan that shows the levels of gray in the timing.&nbsp; So a task would not take 3 days, it would perhaps have the highest probability of being complete in 3 days, but there are non-zero probabilities that it would take 4, 5, 6 days to complete.&nbsp; I&#8217;d also say that the more tasks in the project and the more resources involved the higher the likelihood of missing tasks, pushing out the schedule even more.</p>
<p>The closest I have found to this is <a href="http://www.fogbugz.com">FogBugz</a>&#8216;s <a href="http://www.fogcreek.com/FogBugz/docs/60/topics/schedules/Evidence-BasedScheduling.html">Evidence Based Scheduling</a> that shows a probability of a release shipping.&nbsp; I like that it is based on data from developers, but I want to find a generalized way to represent this schedule outside of entering every task into Fogbugz.&nbsp;</p>
<p>Maybe there&#8217;s a product development idea in here somewhere&#8230;</p>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=85&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/hating-the-gantt-chart/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>

