<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Eric Hauser's Blog</title>
	
	<link>http://erichauser.net</link>
	<description>J2EE, .NET, and general technology</description>
	<pubDate>Tue, 19 May 2009 03:28:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/EricHausersBlog" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>NHibernate Profiler now supports Hibernate</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/cAWSb1TqtAM/</link>
		<comments>http://erichauser.net/2009/05/18/nhibernate-profiler-now-supports-hibernate/#comments</comments>
		<pubDate>Tue, 19 May 2009 03:28:59 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://erichauser.net/2009/05/18/nhibernate-profiler-now-supports-hibernate/</guid>
		<description><![CDATA[I have had the privilege of doing some work for Ayende for the past month to add support for Hibernate to his excellent NHibernate Profiler.&#160; What does this mean exactly?&#160; Well, Hibernate is now supported as a first class citizen in the profiler.&#160; We have tried to make sure that there is a 1:1 feature [...]]]></description>
			<content:encoded><![CDATA[<p>I have had the privilege of doing some work for <a href="http://ayende.com/blog/">Ayende</a> for the past month to add support for Hibernate to his excellent <a href="http://nhprof.com/">NHibernate Profiler</a>.&#160; What does this mean exactly?&#160; Well, Hibernate is now supported as a first class citizen in the profiler.&#160; We have tried to make sure that there is a 1:1 feature mapping between the NHibernate and Hibernate support.&#160; I am happy to report that all applicable warnings and information that you receive for NHibernate is also displayed for Hibernate.&#160; There are of course differences between NHibernate and Hibernate &#8212; such as Hibernate does not support statement level batching options, multiquery, or future queries – which is reflected in the documentation.</p>
<p>Since many developers use Hiberante with Spring, we have tried to make Spring integration as seamless as possible.&#160; If you are using&#160; Hibernate with Spring, configuring your application to be profiled is as simple adding a JAR and a custom attribute to your Spring configuration.&#160; Here you can see where I have added support for profiling to an Appfuse demo project:</p>
<div id="codeSnippetWrapper">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum1" style="color: #606060">   1:</span> <span style="color: #008000">&lt;!-- Hibernate SessionFactory --&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum2" style="color: #606060">   2:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">bean</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&quot;sessionFactory&quot;</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum3" style="color: #606060">   3:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;dataSource&quot;</span> <span style="color: #ff0000">ref</span><span style="color: #0000ff">=&quot;dataSource&quot;</span><span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum4" style="color: #606060">   4:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;configLocation&quot;</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;classpath:hibernate.cfg.xml&quot;</span><span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum5" style="color: #606060">   5:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">property</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;hibernateProperties&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum6" style="color: #606060">   6:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">value</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum7" style="color: #606060">   7:</span>             hibernate.dialect=${hibernate.dialect}</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum8" style="color: #606060">   8:</span>             hibernate.query.substitutions=true 'Y', false 'N'</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum9" style="color: #606060">   9:</span>             hibernate.cache.use_second_level_cache=true</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum10" style="color: #606060">  10:</span>             hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum11" style="color: #606060">  11:</span>         <span style="color: #0000ff">&lt;/</span><span style="color: #800000">value</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum12" style="color: #606060">  12:</span>         <span style="color: #008000">&lt;!-- Turn batching off for better error messages under PostgreSQL --&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum13" style="color: #606060">  13:</span>         <span style="color: #008000">&lt;!-- hibernate.jdbc.batch_size=0 --&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum14" style="color: #606060">  14:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">property</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span id="lnum15" style="color: #606060">  15:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">hprof:profiler</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span id="lnum16" style="color: #606060">  16:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">bean</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>&#160;</p>
<p>This, of course, is just one of the many different ways that you can <a href="http://www.nhprof.com/Learn/GettingStartedHibernate">configure the profiler</a>.&#160; Here is a screenshot of me profiling an Appfuse application.&#160; The top few sessions are profiling unit tests and the remaining sessions (with the URLs) are profiling the web application:</p>
<p><a href="http://erichauser.net/wp-content/uploads/nhprofappfuse.jpg"><img title="nhprof-appfuse" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="427" alt="nhprof-appfuse" src="http://erichauser.net/wp-content/uploads/nhprofappfuse-thumb.jpg" width="644" border="0" /></a>&#160;</p>
<p>Currently, the product is in closed beta and we are looking for beta testers.&#160; If you are interested, then please contact either Ayende through his blog and he will get you all setup.&#160; Other places you can provide feedback are the <a href="http://groups.google.com/group/nhprof">user group</a> and the <a href="http://nhprof.uservoice.com/">feedback site</a>.&#160; Although I may be a little biased, I think this application can add a lot of value for anyone who is using NHibernate and Hibernate.</p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2009/05/18/nhibernate-profiler-now-supports-hibernate/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2009/05/18/nhibernate-profiler-now-supports-hibernate/</feedburner:origLink></item>
		<item>
		<title>Unit tests are production code</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/1szF5wz3qJI/</link>
		<comments>http://erichauser.net/2009/05/16/unit-tests-are-production-code/#comments</comments>
		<pubDate>Sat, 16 May 2009 16:21:14 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://erichauser.net/2009/05/16/unit-tests-are-production-code/</guid>
		<description><![CDATA[I was recently talking with a coworker who said that they write their unit tests in Groovy because unit tests are not production code so the language does not matter.&#160; Of course, I think Groovy is a fine choice for producation applications, but I am ignoring that point for the purposes of this post.&#160; I [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently talking with a coworker who said that they write their unit tests in Groovy because unit tests are not production code so the language does not matter.&#160; Of course, I think Groovy is a fine choice for producation applications, but I am ignoring that point for the purposes of this post.&#160; I could not disagree with my coworkers comments more.&#160; Unit tests are as important as your code itself.&#160; I do not think that comment needs more explanation than that, only that I find it interesting that many people still see unit tests as a second class citizen in a code base.</p>
<p>The other interesting thing is that the current goal is to get 80% unit tests passing on all projects (the projects that I work on have 100% all the time, otherwise I would lose my mind).&#160; This is a strategy I disagree with.&#160; Let’s say that over time your project has gotten to a state where you only have 50% of the unit tests passing.&#160; As far as I am concerned, this is equivalent to having 0% of the tests passing.&#160; Why?&#160; Because developers see tests in two colors: red and green.&#160; You will quickly find that the 50% will continue to down because no one is actually noticing that they are breaking tests as they are making code changes.&#160; On a few large projects I have worked on, I have seen where a single failing unit test quickly becomes 20.&#160; </p>
<p>Assuming that because of business goals and quantity of tests to fix, that just fixing all of the tests immediately is not an option.&#160; A much better strategy, in my opinion, would be to ignore the tests that are failing and say that all projects must have 100% unit tests passing.&#160; Then, make your goal to be to work your way down from 50% ignored tests to 0% ignored tests over a reasonable period of time.&#160; </p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2009/05/16/unit-tests-are-production-code/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2009/05/16/unit-tests-are-production-code/</feedburner:origLink></item>
		<item>
		<title>Ultimate Developer Rig 2009</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/mEjEpuGrtDQ/</link>
		<comments>http://erichauser.net/2009/02/05/ultimate-developer-rig-2009/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 02:58:13 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://erichauser.net/2009/02/05/ultimate-developer-rig-2009/</guid>
		<description><![CDATA[&#160;
My company has decided to close its facility here in Indianapolis, so I am currently job hunting.&#160; Its turns out that suddenly finding a bunch of free time on your hands is bad for the wallet.&#160; It also does not help that a large number of engineers in our office now have very little to [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>My company has decided to close its facility here in Indianapolis, so I am currently job hunting.&#160; Its turns out that suddenly finding a bunch of free time on your hands is bad for the wallet.&#160; It also does not help that a large number of engineers in our office now have very little to do for the next 60 days but talk about things like computer hardware (in between interviews of course).&#160; My machine at home is close to being three years old, so I have decided that it is fully depreciated.&#160; Inspired by the likes of <a href="http://www.hanselman.com/blog/TheCodingHorrorUltimateDeveloperRigThrowdownPart2.aspx">Scott Hanselmann</a> and <a href="http://www.jameskovacs.com/blog/UltimateDeveloperRigKovacsEdition.aspx">James Kovacs</a> I have decided to build my own Ultimate Devloper Rig and write about it.</p>
<h3>The System</h3>
<p>&#160;</p>
<p><strong>Case - Antec P182</strong></p>
<p>Pretty original choice, huh?&#160; I really wanted to buy the <a href="http://www.techspot.com/review/133-coolermaster-haf-932/">Cooler Master HAF 932</a> after reading the review, but then I went to Fry&#8217;s.&#160; Here is the size comparison between the P182 and the 932:</p>
<p>&#160;<img title="p182_vs_haf392" height="800" alt="p182_vs_haf392" src="http://erichauser.net/wp-content/uploads/p182_vs_haf392.jpg" width="600" /></p>
<p>&#160;</p>
<p>I was a little concerned that the 932 might not fit under my desk so I went with the P182.&#160; My other concern was that the the amount of fans in the Cooler Master would&#160; make the noise level of the case unacceptable, but a coworker of mine has one and he says that it is not that bad.&#160; If you are not overclocking your machine, you probably do not even need to hook all of the fans in that case up.</p>
<p>&#160;<strong>Processor - Intel Core i7 920 </strong></p>
<p><strong></strong></p>
<p>When I first starting looking, I assumed that I would be going with a Core 2 Quad system.&#160; If you go Core i7, you are going to pay a lot more for the motherboard, processor, and RAM, right?&#160; Turns out that you won’t be paying quite the premium you would have paid 3 months ago.&#160; My office is located right across the street from Fry&#8217;s and they had an great deal on the Core i7 920 - $229.&#160; NewEgg&#8217;s current price for a i7 920 is $289.99 and an entry level quad core processor, the Q8300, is currently running $189.99.&#160; If you look at the <a href="http://www.techspot.com/review/124-intel-core-i7-920-940-965/">benchmarks </a>for the Core i7 920 vs. say the Core 2 Quad Q9650 (currently $339), the 920 performs significantly better in a lot of benchmarks and slightly better in some others.&#160; Also, the i7 is a quad core processor with hyper threading (2 threads per core) which means that the operating system will think that the processor has 8 cores.</p>
<p>&#160;<strong>Motherboard - ASUS P6T Deluxe LGA 1366 Intel X58 ATX</strong></p>
<p> The motherboard is definately the place where going with the i7 will hurt you on price.&#160; On average, X58 motherboards are about twice as expensive as their comparable P45 counterparts.&#160; In fact, some of the prices for the Core 2 boards are moving closer to 3 times cheaper.&#160; If you think of your machine as a one time sunk cost, then saving $150-$200 on a motherboard is fairly significant.&#160; However, if you are planning on upgraded your processor and RAM a couple of years down the road, you definately do not want to be stuck with a motherboard that only supports Core 2 processors and DDR2 RAM.</p>
<p> After reading some reviews on the current choices for i7 motherboards, I decided to go with the ASUS board.&#160; The board has features such as dual Gigabit LAN, power on bios, 8 SATA ports, 6 DIMM slots, and 3 PCI express slots.&#160; This board supports both Crossfire and SLI &#8212; so you have flexibility in which video card manufacturer you go with.&#160; My choice really came down between this board and the Gigabyte GA-EX58-UD4P.&#160; You could probably save yourself an extra $50-$75 bucks by going with this board or the cheaper ASUS if you don&#8217;t want all the bells and whistles of the P6T Deluxe.</p>
<p>&#160;<strong>Power Supply - CORSAIR 650TX 650W</strong></p>
<p> After picking my motherboard, I moved on to the power supply.&#160; It is important to make sure that your PSU is certified for both SLI and Crossfire, and this one is.&#160; It has connectors for eight SATA drives.&#160; NewEgg had a really good deal on this particular PSU after instant and mail-in rebates ($79), and I could not find anyone with anything bad to say about it when searching.&#160; </p>
<p>&#160;<strong>RAM - G.SKILL 6GB (3xGB) DDR3 1333 Triple Channel Memory</strong></p>
<p> Since there are so many different options for RAM, I decided to use the poll the audience approach for choosing.&#160; I searched for &quot;DDR3 1333 triple channel 6GB&quot; on NewEgg and looked at the results.&#160; There about 10 options, all within $20-$30 of each other.&#160; I decided to go with the G.SKILL because it was inexpensive, had the most reviews, and had a 84% excellent rating.</p>
<p>&#160;<strong>Boot Drive - Western Digital VelociRaptor WD3000HLFS 3000 GB 10,000 RPM</strong></p>
<p> This is the item that I thought about the most.&#160; It is probably going to be a few months before there is some good data on reliability and performance for SSDs.&#160; I was actually reading a <a href="http://www.anandtech.com/guides/showdoc.aspx?i=3510">i7 builder&#8217;s guide</a> on AnandTech this morning (which incidentally came out after I made my purchases) and it says that they are working on reviewing the latest cheaper SSD drives.&#160; You can get a 64GB GSKILL SSD for $139 or a 128GB for $234.&#160; Even a 64 GB drive would give you plenty of room as a boot drive.&#160; The Intel X25-M SSDs currently boost much higher read times than the cheaper SSDs and they are significantly more expensive, 80 GB for $339, than the cheaper models.&#160; So, I decided to go with the tried and true VelociRaptor &#8230; for now.</p>
<p>&#160;<strong>Storage Drive - Samsung Spinpoint F1 HD103UJ 1TB 7200 RPM</strong></p>
<p> Again, I spent some time thinking about what to do for storage and I considered setting up a RAID array for data drives.&#160; However, I did not want to put a huge investment into storage in case we see SSD drives that significantly outperform HDD (and are affordable) in the near future, in which case my VelociRaptor would be fine for holding my data.</p>
<p> I do image backups of all of my drives, so data loss is not a real concern for me.&#160;&#160; 7200 RPM drives are a dime a dozen, so brand does not really matter that much here.</p>
<p>&#160;<strong>Video Card - EVGA 512-P3-N975-AR GeForce 9800GT 512 MB</strong>&#160;</p>
<p>This is one area where you will probably want to do differently than what I did.&#160; I am not really into playing games on my computer so I do not really care about the video card that much.&#160; The previous generation video card will do just fine for Visual Studio so I am skimping on this item to save about $100.&#160; In reality, I could probably go with a cheaper card that works just as good, but I couldn&#8217;t bring myself to buy the cheapest cards available.&#160; </p>
<p>For anyone who plays games, I would recommend the MSI R4870-T2D1G Radeon HD 4870 1GB per the AnandTech guide.&#160; For about a hundred dollars more than my card, you get a card with a 1GB of RAM that is based on the newer chipset from ATI.&#160; With most 4870 X2 boards costing about double what that card will cost you, that card is definately a better buy.&#160; One video card will do fine for me since it has dual DVI for my two Dell 2407WFP (24&quot; widescreen) monitors.</p>
<p><strong>CPU Cooler – Stock</strong></p>
<p> Really?&#160; No after market cooler you say?&#160; I am not planning on overclocking the system so I don&#8217;t see a need for the after market cooler.&#160; I am planning on doing some testing when I get the system setup, so I will let you know what the temperatures are like.&#160; Using this same thought process, I am going to go with the stock case fans and see what happen as well.&#160; Maybe I will be wrong and find out that the temperatures are unacceptable; and I&#8217;ll have to get a shiny aftermarket cooler and some new case fans.&#160; But nobody ever really discusses what happens with the stock gear, so I think it will be an interesting experiment.</p>
<h3>Totals</h3>
<p>&#160;</p>
<table cellspacing="0" cellpadding="2" width="764" border="1">
<tbody>
<tr>
<td valign="top" width="127">
<p><strong>Component</strong></p>
</td>
<td valign="top" width="527">
<p><strong>Item</strong></p>
</td>
<td valign="top" width="108">
<p><strong>Price</strong></p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>Case</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16811129025">Antec P182 Gun Metal Black 0.8mm cold rolled steel ATX Mid Tower Computer Case - Retail</a></p>
</td>
<td valign="top" width="151">
<p>$129.99</p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>CPU</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16819115202">Intel Core i7 920 Nehalem 2.66GHz 4 x 256KB L2 Cache 8MB L3 Cache LGA 1366 130W Quad-Core Processor - Retail</a></p>
</td>
<td valign="top" width="151">
<p>$229.99</p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>Motherboard</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16813131346">ASUS P6T Deluxe LGA 1366 Intel X58 ATX Intel Motherboard - Retail</a></p>
</td>
<td valign="top" width="151">
<p>$299.99</p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>RAM</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16820231230">G.SKILL 6GB (3 x 2GB) 240-Pin DDR3 SDRAM DDR3 1333 (PC3 10666) Triple Channel Kit Desktop Memory - Retail</a></p>
</td>
<td valign="top" width="151">
<p>$139.99</p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>Video Card</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16814130380">EVGA 512-P3-N975-AR GeForce 9800 GT 512MB 256-bit GDDR3 PCI Express 2.0 x16 HDCP Ready SLI Supported Video Card - Retail</a></p>
</td>
<td valign="top" width="151">
<p>$129.99</p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>PSU</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16817139005">CORSAIR CMPSU-650TX 650W ATX12V / EPS12V SLI Ready CrossFire Ready 80 PLUS Certified Active PFC Compatible with Core i7 Power Supply - Retail</a></p>
</td>
<td valign="top" width="151">
<p>$94.99</p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>Boot drive</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16822136322">Western Digital VelociRaptor WD3000HLFS 300GB 10000 RPM 16MB Cache SATA 3.0GB/s Hard Drive - OEM</a></p>
</td>
<td valign="top" width="151">
<p>$229.99</p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>Secondary drive</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16822152102">SAMSUNG Spinpoint F1 HD103UJ 1TB 7200 RPM 32MB Cache SATA 3.0Gb/s Hard Drive - OEM</a><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16822152102"></a></p>
</td>
<td valign="top" width="151">
<p>$99.99</p>
</td>
</tr>
<tr>
<td valign="top" width="127">
<p>DVD Drive</p>
</td>
<td valign="top" width="527">
<p><a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16827106228">LITE-ON Black 20X DVD+R 8X DVD+RW 8X DVD+R DL 20X DVD-R 6X DVD-RW 12X DVD-RAM 16X DVD-ROM 48X CD-R 32X CD-RW 48X CD-ROM 2MB Cache IDE 20X DVD±R DVD Burner - OEM</a></p>
<h4></h4>
<dl>
<dd></dd>
</dl>
<dl></dl>
</td>
<td valign="top" width="151">
<p>$21.99</p>
</td>
</tr>
<tr>
<td valign="top" width="527" colspan="2">
<p style="text-align: right">Subtotal:</p>
</td>
<td valign="top" width="151">
<p>$1376.91</p>
</td>
</tr>
<tr>
<td valign="top" width="527" colspan="2">
<p style="text-align: right">Mail-in Rebates:</p>
</td>
<td valign="top" width="151">
<p>$65.00</p>
</td>
</tr>
<tr>
<td valign="top" width="527" colspan="2">
<p style="text-align: right">Total:</p>
</td>
<td valign="top" width="151">
<p>$1311.91</p>
</td>
</tr>
</tbody>
</table>
<p>About $1300 for the system is not a bad price at all.&#160; You could probably get a very similar system for around $1000 if you go with a Core 2 Quad system.</p>
<h3>Benchmarks</h3>
<p>&#160;</p>
<p>Assuming I get all the components in the mail, get the system built, and everything works properly; I will post some benchmarks next week.&#160; I will probably get some stats on how long it takes to build and run the unit tests for Castle, but I would also like to find a big project that uses MSBuild so that I can test some times using its parallel build support (NAnt does not support this).&#160; If there are any suggestions on some other pointless benchmarks, let me know. =)</p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2009/02/05/ultimate-developer-rig-2009/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2009/02/05/ultimate-developer-rig-2009/</feedburner:origLink></item>
		<item>
		<title>Javascript compression for Monorail</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/9QpvG7I1enw/</link>
		<comments>http://erichauser.net/2009/01/27/javascript-compression-for-monorail/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 20:56:43 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Castle]]></category>

		<guid isPermaLink="false">http://erichauser.net/2009/01/27/javascript-compression-for-monorail/</guid>
		<description><![CDATA[Last year, Hammett posted a blog entry on combining Javascript files into a single file using Monorail.  I was looking to enhance the code so that it would minify Javascript and CSS files on the fly, so I took his original code and enhanced it.  Alex Henderson was also looking for the same functionality, so [...]]]></description>
			<content:encoded><![CDATA[<p>Last year, Hammett posted a <a href="http://hammett.castleproject.org/?p=310">blog entry</a> on combining Javascript files into a single file using Monorail.  I was looking to enhance the code so that it would minify Javascript and CSS files on the fly, so I took his original code and enhanced it.  <a href="http://blog.bittercoder.com/">Alex Henderson</a> was also looking for the same functionality, so he contributed to the patch as well.  You can download it here:  <a href="http://support.castleproject.org/projects/MR/issues/view/MR-ISSUE-457">http://support.castleproject.org/projects/MR/issues/view/MR-ISSUE-457</a></p>
<p>The new component uses a <a href="http://www.codeplex.com/YUICompressor/">.NET port of the Yahoo! UI Library Compressor that is available on Codeplex</a>.  The component worked great, but they did not have a strongly signed version of the library release.  I made a request and they quickly turned out a release that same day, which was awesome response time.</p>
<p>You can now have all of your Javascript and CSS combined for you on the fly by using the component:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> #blockcomponent(BuildJS with <span style="color: #006080">"key=layout"</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span>     $jsBuilder.Add(<span style="color: #006080">"Content/css/main.css"</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span>     $jsBuilder.Add(<span style="color: #006080">"Content/css/someOther.css"</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span>     $jsBuilder.Add(<span style="color: #006080">"Content/js/prototype.js"</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span>     $jsBuilder.Add(<span style="color: #006080">"Content/js/someOther.js"</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span> #end</pre>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2009/01/27/javascript-compression-for-monorail/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2009/01/27/javascript-compression-for-monorail/</feedburner:origLink></item>
		<item>
		<title>Automatic assembly versioning with TeamCity</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/gQc7w8cXKOE/</link>
		<comments>http://erichauser.net/2009/01/27/automatic-build-numbers-with-teamcity/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 20:56:28 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[TeamCity]]></category>

		<guid isPermaLink="false">http://erichauser.net/2009/01/27/automatic-build-numbers-with-teamcity/</guid>
		<description><![CDATA[Although there are a number of good continuous integration servers out there, TeamCity is one of my favorites.  It has great support for .NET &#8212; supporting MSBuild, NAnt, Solution builds, NUnit, MSTest, and FxCop.  The price is right if you have less than 20 users and 20 build configurations – free.  I was also able [...]]]></description>
			<content:encoded><![CDATA[<p>Although there are a number of good continuous integration servers out there, TeamCity is one of my favorites.  It has great support for .NET &#8212; supporting MSBuild, NAnt, Solution builds, NUnit, MSTest, and FxCop.  The price is right if you have less than 20 users and 20 build configurations – free.  I was also able to a plugin to integrate with our issue tracking systems in a couple of hours timespan (my Spring MVC experience definately helped though).</p>
<p>One of thing that you want to do with a release build is automatically increment your version numbers.  Most approaches to this problem recommend using MSBuild to autogenerate the AssemblyInfo.cs file.  Although that certainly works, I prefer not to have to do that for every project.  Instead, each of our projects references a single CommonAssemblyInfo.cs file.</p>
<p>When TeamCity builds a release build, it is configured to the IncrementVersion task:</p>
<div>
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">Project</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">="http://schemas.microsoft.com/developer/msbuild/2003"</span><span style="color: #0000ff">&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span>     ...</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">Target</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">="UnrestrictedExecutionPolicy"</span><span style="color: #0000ff">&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">Exec</span> <span style="color: #ff0000">Command</span><span style="color: #0000ff">="powershell set-executionPolicy unrestricted&amp;quot;"</span> <span style="color: #0000ff">/&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Target</span><span style="color: #0000ff">&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">Target</span> <span style="color: #ff0000">Name</span><span style="color: #0000ff">="IncrementVersion"</span> <span style="color: #ff0000">DependsOnTargets</span><span style="color: #0000ff">="UnrestrictedExecutionPolicy"</span><span style="color: #0000ff">&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   7:</span>         <span style="color: #0000ff">&lt;</span><span style="color: #800000">Exec</span> <span style="color: #ff0000">Command</span><span style="color: #0000ff">="PowerShell .\incrementVersion.ps1 $(build_vcs_number_1)"</span> <span style="color: #0000ff">/&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   8:</span>     <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Target</span><span style="color: #0000ff">&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   9:</span>     ...</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  10:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">Project</span><span style="color: #0000ff">&gt;</span></pre>
</div>
</div>
<p>The $(build_vcs_number_1) property tells TeamCity to the current revision number from the first source repository attached – in my case SVN &#8212; to the project (most projects will only have one repository attached).  Then, we execute a simple Powershell script to replace the file version number:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> $buildNumber = $args[0]</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span> (Get-Content ..\src\CommonAssemblyInfo.cs) | Foreach-Object {$_ -replace <span style="color: #006080">"(\d\.\d\.\d)\.\d*"</span>, <span style="color: #006080">"`$1.$buildNumber"</span>} | Set-Content ..\src\CommonAssemblyInfo.cs</pre>
</div>
</div>
<p>If you are more comfortable using a MSBuild task for regex replacement, there is a RegexReplace task that is part of the <a href="http://msbuildtasks.tigris.org/">MSBuild Community Tasks</a>.  For my build, we do not need any other custom tasks, so it was preferable to just use a simple PS script.</p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2009/01/27/automatic-build-numbers-with-teamcity/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2009/01/27/automatic-build-numbers-with-teamcity/</feedburner:origLink></item>
		<item>
		<title>ActiveRecord Flush Control</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/OR9IoQ9j-ZM/</link>
		<comments>http://erichauser.net/2009/01/27/activerecord-flush-control/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 20:56:18 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Active Record]]></category>

		<category><![CDATA[Castle]]></category>

		<category><![CDATA[ActiveRecord]]></category>

		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://erichauser.net/2009/01/27/activerecord-flush-control/</guid>
		<description><![CDATA[There are a lot of times in your application where you will load a lot of entities in a single session (to display a lot of data on a page, build a report, etc).  Since you are not planning on doing a mutable operation on an entity, there is a big saving that you can [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of times in your application where you will load a lot of entities in a single session (to display a lot of data on a page, build a report, etc).  Since you are not planning on doing a mutable operation on an entity, there is a big saving that you can get from not flushing the session.  To get an idea on everything that happens when you do a flush, check out the <a href="https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate/src/NHibernate/Event/Default/AbstractFlushingEventListener.cs">AbstractionFlushingEventListener</a> from the NHibernate source.</p>
<p>If you are using explicit SessionScope’s, not flushing the session is trivial:</p>
<div>
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> <span style="color: #0000ff">using</span> (<span style="color: #0000ff">new</span> SessionScope(FlushAction.Never))</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span>     repository.DoSomeReadOperation();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span> }</pre>
</div>
</div>
<p>This will execute the operation without flushing the session at the end.</p>
<p>Another way to control this behavior is by using an interceptor.  For example, if you are using the Castle’s Automated Transaction Facility, you probably already have a way of determining whether or not your methods do mutable operations by their transaction attributes.  You can then use an interceptor to control flushing:</p>
<div>
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> UnitOfWorkInterceptor : IInterceptor</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   2:</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">private</span> <span style="color: #0000ff">readonly</span> ITransactionManager transactionManager;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   4:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   5:</span>     <span style="color: #008000">/// &lt;summary&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   6:</span>     <span style="color: #008000">/// Initializes a new instance of the &lt;see cref="UnitOfWorkInterceptor"/&gt; class.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   7:</span>     <span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">   8:</span>     <span style="color: #008000">/// &lt;param name="transactionManager"&gt;The transaction manager.&lt;/param&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">   9:</span>     <span style="color: #0000ff">public</span> UnitOfWorkInterceptor(ITransactionManager transactionManager)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  10:</span>     {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  11:</span>         <span style="color: #0000ff">this</span>.transactionManager = transactionManager;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  12:</span>     }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  13:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  14:</span>     <span style="color: #cc6633">#region</span> Implementation of IInterceptor</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  15:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  16:</span>     <span style="color: #008000">/// &lt;summary&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  17:</span>     <span style="color: #008000">/// Intercepts the specified invocation.</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  18:</span>     <span style="color: #008000">/// &lt;/summary&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  19:</span>     <span style="color: #008000">/// &lt;param name="invocation"&gt;The invocation.&lt;/param&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  20:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Intercept(IInvocation invocation)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  21:</span>     {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  22:</span>         ITransaction transaction = transactionManager.CurrentTransaction;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  23:</span>         FlushAction flushAction = transaction == <span style="color: #0000ff">null</span> ? FlushAction.Never : FlushAction.Config;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  24:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  25:</span>         ActiveRecordUnitOfWork.Before(flushAction);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  26:</span>         invocation.Proceed();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  27:</span>         ActiveRecordUnitOfWork.After();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  28:</span>     }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  29:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #606060">  30:</span>     <span style="color: #cc6633">#endregion</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #606060">  31:</span> }</pre>
</div>
</div>
<p>Note that in this example, interceptor ordering is important.  If you register the unit of work interceptor before the transaction interceptor in the ATM facility, then transactionManager.CurrentTransaction will always return null.  (The ActiveRecordUnitOfWork class in the above example is just a facade for controlling the session in a thread local as discussed in this post <a href="http://erichauser.net/2008/08/06/activerecord-session-scope-and-wcf-redux/">http://erichauser.net/2008/08/06/activerecord-session-scope-and-wcf-redux/</a>).  If you do not want to tie your flushing to transactions, then you can always create your own metadata and read that metadata at runtime in the interceptor.  The ATM facility code is a great example of how to inspect metadata on initialization and use that metadata in your interceptor.</p>
<p>Hopefully, this little trick will some increased performance for your queries that return a lot of results.</p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2009/01/27/activerecord-flush-control/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2009/01/27/activerecord-flush-control/</feedburner:origLink></item>
		<item>
		<title>Validating method parameters with Castle Validator</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/3wlqo_Ekokg/</link>
		<comments>http://erichauser.net/2008/09/18/validating-method-parameters-with-castle-validator/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 02:09:25 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Castle]]></category>

		<guid isPermaLink="false">http://erichauser.net/?p=80</guid>
		<description><![CDATA[Been pretty busy at work, so short post. 
I&#8217;ve added a facility in Castle contrib for validating method parameters using Castle Validator.  The goal is to eventually allow have this used for validate parameters in Monorail, but right now I&#8217;m using it to do input validation for web service parameters.  I wrote up a brief blurb [...]]]></description>
			<content:encoded><![CDATA[<p>Been pretty busy at work, so short post. </p>
<p>I&#8217;ve added a facility in Castle contrib for validating method parameters using Castle Validator.  The goal is to eventually allow have this used for validate parameters in Monorail, but right now I&#8217;m using it to do input validation for web service parameters.  I wrote up a brief blurb on how to use it here: <a href="http://using.castleproject.org/display/Contrib/Castle.Facilities.MethodValidator">http://using.castleproject.org/display/Contrib/Castle.Facilities.MethodValidator</a>.  Should be pretty self explanatory.</p>
<p>If anyone finds any issues, let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2008/09/18/validating-method-parameters-with-castle-validator/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2008/09/18/validating-method-parameters-with-castle-validator/</feedburner:origLink></item>
		<item>
		<title>Castle Validator Enhancements</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/r31FrlKSpFM/</link>
		<comments>http://erichauser.net/2008/08/28/castle-validator-enhancements/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 00:30:57 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Castle]]></category>

		<category><![CDATA[Validator]]></category>

		<guid isPermaLink="false">http://erichauser.net/?p=75</guid>
		<description><![CDATA[I have contributed a couple of enhancements to Castle.Components.Validator that have been committed to the trunk.  Besides using attributes, validations can now be supplied in code using the [ValidateSelf] attribute:

Each of the above validations *could* be done by using an attribute and a custom validator, but expressing validations in code is much simpler for these [...]]]></description>
			<content:encoded><![CDATA[<p>I have contributed a couple of enhancements to Castle.Components.Validator that have been committed to the trunk.  Besides using attributes, validations can now be supplied in code using the [ValidateSelf] attribute:</p>
<p><a href="http://erichauser.net/wp-content/uploads/validateself.jpg"><img class="alignnone size-full wp-image-76" title="validateself" src="http://erichauser.net/wp-content/uploads/validateself.jpg" alt="" /></a></p>
<p>Each of the above validations *could* be done by using an attribute and a custom validator, but expressing validations in code is much simpler for these types of one off validations.  You can have as many methods decorated with [ValidateSelf] on an object you want as long as they have the above method signature (void return and one ErrorSummary parameter).  You can also specify the RunWhen and ExecutionOrder just like regular validators.</p>
<p>The second enhancement is the IValidationContributor interface.  This allows you contribute to the validation of an object beyond the default validation.  The interface is fairly simplistic:</p>
<p><a href="http://erichauser.net/wp-content/uploads/ivalidatorcontributor.jpg"><img class="alignnone size-full wp-image-77" title="ivalidatorcontributor" src="http://erichauser.net/wp-content/uploads/ivalidatorcontributor.jpg" alt="" /></a></p>
<p>You can extend AbstractValidationContributor so that you can perform initialization for a given type.  The SelfValidationContributor implements the logic for recognizing and executing the self validation feature above.  You can write custom contributors that can be injected into the DefaultValidatorRunner for things like retrieving validations from the container and invoking them on the object. </p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2008/08/28/castle-validator-enhancements/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2008/08/28/castle-validator-enhancements/</feedburner:origLink></item>
		<item>
		<title>NServiceBus Facility Enhancements</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/Usz4ZAt0zSo/</link>
		<comments>http://erichauser.net/2008/08/23/nservicebus-facility-enhancements/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 14:59:41 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Castle]]></category>

		<category><![CDATA[Idempotent]]></category>

		<category><![CDATA[NServiceBus]]></category>

		<guid isPermaLink="false">http://erichauser.net/?p=62</guid>
		<description><![CDATA[I have added a couple of additions to Ayende&#8217;s NServiceBus Facility:

Message handlers and sagas are automatically registered with the container for the defined assemblies
Message handlers are proxied
You can register IHandlerFilter instances with the kernel that allow for interception of messages as they are processed
Using my replay strategy implementation, you can decorate a message handler as [Idempotent(Attemps = 5, [...]]]></description>
			<content:encoded><![CDATA[<p>I have added a couple of additions to <a title="NServiceBus Facility" href="http://www.ayende.com/Blog/archive/2008/07/13/Putting-the-container-to-work-Refactoring-NServiceBus-configuration.aspx">Ayende&#8217;s NServiceBus Facility</a>:</p>
<ul>
<li>Message handlers and sagas are automatically registered with the container for the defined assemblies</li>
<li>Message handlers are proxied</li>
<li>You can register IHandlerFilter instances with the kernel that allow for interception of messages as they are processed</li>
<li>Using my replay strategy implementation, you can decorate a message handler as [Idempotent(Attemps = 5, Delay = 2000)].  That means that a message will be retried when an exception is thrown processing the message 5 times, delaying 2 seconds between each retry.  This could also be extended so that depending on the type of exception that is being thrown, a default retry strategy is applied.</li>
</ul>
<p><a href="http://erichauser.net/wp-content/uploads/idempotent_attribute1.jpg"><img class="alignnone size-full wp-image-71" title="idempotent_attribute1" src="http://erichauser.net/wp-content/uploads/idempotent_attribute1.jpg" alt="" /></a></p>
<ul>
<li>The bus is started automatically once all handler dependencies have been satisfied</li>
</ul>
<p>There were a couple of interesting things that I found when implementing this.  One, NServiceBus retrieives handlers from the kernel using the concrete class instance (looking back Ayende noted this as &#8220;yuck&#8221;).  That means that we cannot proxy the interface, but instead have to create a class proxy for our message handlers.  That means that when we the message handlers, we have to verify that the message handler methods are virtual and give a nice error if they are not:</p>
<p><a href="http://erichauser.net/wp-content/uploads/registerhandlers.jpg"><img class="alignnone size-full wp-image-65" title="registerhandlers" src="http://erichauser.net/wp-content/uploads/registerhandlers.jpg" alt="" /></a></p>
<p>Very easy to do with Castle&#8217;s fluent interface for registration.  Sagas, on the other hand, have to be registered in the container by each of their interfaces because saga instances are retrieve by calling builder.Build&lt;ISaga&lt;SomeMessage&gt;&gt;().</p>
<p>Out of the box, the way to do message interception with NSB is to have message handlers chained in a specified order.  The IHandlerFilter provides another method for message interception.  If you have a new filter to add, all you have to do is register the IHandlerFilter instance with the container:</p>
<p><a href="http://erichauser.net/wp-content/uploads/handlerfilter1.jpg"><img class="alignnone size-full wp-image-67" title="handlerfilter1" src="http://erichauser.net/wp-content/uploads/handlerfilter1.jpg" alt="" /></a></p>
<p>The filters follow the chain of responsibility pattern, so they can be short circuited &#8212; which is the same as calling bus.DoNotContinueDispatchingCurrentMessageToHandlers().</p>
<p>I have attached the updates to the post: <a href="http://erichauser.net/wp-content/uploads/nservicebus-fullduplex-xml-update.zip">nservicebus-fullduplex-xml-update</a>.  Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2008/08/23/nservicebus-facility-enhancements/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2008/08/23/nservicebus-facility-enhancements/</feedburner:origLink></item>
		<item>
		<title>Profiling MSTest (and why I had to do it)</title>
		<link>http://feedproxy.google.com/~r/EricHausersBlog/~3/KaxCd0UbMMM/</link>
		<comments>http://erichauser.net/2008/08/22/profiling-mstest-and-why-i-had-to-do-it/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 21:04:46 +0000</pubDate>
		<dc:creator>ehauser</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://erichauser.net/?p=55</guid>
		<description><![CDATA[I got an email earlier this week from a member of our team saying that they had noticed odd behavior in our unit tests.  They said when the ran the tests from Visual Studio, the memory allocation increased by about 500MB.  When they ran the tests again, the memory increased another 500MB, and so forth.  [...]]]></description>
			<content:encoded><![CDATA[<p>I got an email earlier this week from a member of our team saying that they had noticed odd behavior in our unit tests.  They said when the ran the tests from Visual Studio, the memory allocation increased by about 500MB.  When they ran the tests again, the memory increased another 500MB, and so forth.  The system component that developer was working on had the most tests out of all of our components, so he was noticing this before others did. </p>
<p>First of all, it seemed odd that unit tests would cause Visual Studio&#8217;s memory to increase since the tests are run in another process.  I knew it would probably be impossible to profile Visual Studio itself, so I profiled out tests from the command line to see what if anything I could figure out.  A couple of tricks to profiling MSTest.exe:</p>
<ul>
<li>Launch mstest.exe with the /noisolation option so that the tests are run in process</li>
<li>When you use the /noisolation option, you have to replace \Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe.config with the App.config for your tests.  You also need to add the this:</li>
</ul>
<p>    &lt;runtime&gt;<br />
        &lt;assemblyBinding xmlns=&#8221;urn:schemas-microsoft-com:asm.v1&#8243;&gt;<br />
            &lt;probing privatePath=&#8221;PrivateAssemblies;PublicAssemblies&#8221;/&gt;<br />
        &lt;/assemblyBinding&gt;<br />
    &lt;/runtime&gt;</p>
<p>The first thing I noticed after all of the tests ran was that 98% of the memory was being held by System.String.  When I looked to see what objects were referencing System.String, one thing blaringly stood out:</p>
<p> <br />
<a href="http://erichauser.net/wp-content/uploads/dottrace1.jpg"><img class="alignnone size-full wp-image-57" title="dottrace1" src="http://erichauser.net/wp-content/uploads/dottrace1.jpg" alt="" width="500" height="160" /></a></p>
<p>All of the standard out was being held in a single member variable from the whole test run.  Since I was not sure if Visual Studio was doing the same thing, I turned off logging in our application and ran the tests again.  Surprise, that worked.  Visual Studio no longer was increasing in memory usage.</p>
<p>Yes, I realize 800 MB of log output is a lot but that is not really the issue &#8211; I&#8217;m not sure why VS keeps that output in memory.  Once it has the test results, I believe it writes it out to a file so why keep it around?</p>
]]></content:encoded>
			<wfw:commentRss>http://erichauser.net/2008/08/22/profiling-mstest-and-why-i-had-to-do-it/feed/</wfw:commentRss>
		<feedburner:origLink>http://erichauser.net/2008/08/22/profiling-mstest-and-why-i-had-to-do-it/</feedburner:origLink></item>
	</channel>
</rss>
