<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Stuart Thompson's Tech Blog</title>
	<atom:link href="http://stuartthompsontech.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuartthompsontech.wordpress.com</link>
	<description>Web 2.0 &#38; Quality Development</description>
	<lastBuildDate>Fri, 23 Jan 2009 17:33:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='stuartthompsontech.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Stuart Thompson's Tech Blog</title>
		<link>http://stuartthompsontech.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://stuartthompsontech.wordpress.com/osd.xml" title="Stuart Thompson&#039;s Tech Blog" />
	<atom:link rel='hub' href='http://stuartthompsontech.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Practical Silverlight: More than just Flash</title>
		<link>http://stuartthompsontech.wordpress.com/2009/01/23/practical-silverlight-more-than-just-flash/</link>
		<comments>http://stuartthompsontech.wordpress.com/2009/01/23/practical-silverlight-more-than-just-flash/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 17:32:29 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Portland]]></category>
		<category><![CDATA[SoftSource]]></category>
		<category><![CDATA[Training]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=104</guid>
		<description><![CDATA[Register here to learn how to use Silverlight to build next-generation applications in half the time it would take with traditional web development technologies. SoftSource provides you with a competitive advantage in application development, delivering the highest quality of software on time and within your budget. Now learn the secrets from our trainers about how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=104&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Register here to learn how to use Silverlight to build next-generation applications in half the time it would take with traditional web development technologies.  SoftSource provides you with a competitive advantage in application development, delivering the highest quality of software on time and within your budget.  Now learn the secrets from our trainers about how to leverage this cutting edge technology to deliver the same results yourself.  &#8220;Until now, the standard for user experience for browser-hosted applications has been defined by AJAX and JavaScript. However, the powerful and rich user experience provided by these applications has come at a significant cost in development. Silverlight allows us to deliver an even more compelling user experience while simultaneously simplifying the programming model and leveraging our existing .NET skills. During this session we will cover the foundational concepts and technologies you will need to know to jumpstart your transition to Silverlight development. Several highlights include:      * Silverlight Architecture     * Dependency and Attached properties     * XAML resources     * How to access your code in XAML.&#8221;  Registration for the Portland event can be found here: https://registration.sftsrc.com/Register.aspx?EventId=1 There is also a Bellevue event you can attend here: https://registration.sftsrc.com/Register.aspx?EventId=382  Spots are limited, so sign up early to ensure that you get yours.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=104&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2009/01/23/practical-silverlight-more-than-just-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>
	</item>
		<item>
		<title>The Secret to Organizational Agility</title>
		<link>http://stuartthompsontech.wordpress.com/2008/12/08/the-secret-to-organizational-agility/</link>
		<comments>http://stuartthompsontech.wordpress.com/2008/12/08/the-secret-to-organizational-agility/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 21:25:32 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[Agile]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=99</guid>
		<description><![CDATA[Mike Cottmeyer wrote an excellent article about the importance of eliminating dependencies in agile projects: http://www.leadingagile.com/2008/12/secret-to-organizational-agility.html How many times have the following been true: &#8220;Many teams are trying to sprint through product development using a traditional MRD or PRD.&#8221; &#8220;Many teams are working with traditional project managers who are doing their best to be agile, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=99&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Mike Cottmeyer wrote an excellent article about the importance of eliminating dependencies in agile projects:<br />
<a href="void(0);/*1228771232703*/">http://www.leadingagile.com/2008/12/secret-to-organizational-agility.html</a></p>
<p style="text-align:justify;">How many times have the following been true:</p>
<ul style="font-style:italic;text-align:justify;">
<li>&#8220;Many teams are trying to sprint through product development using a traditional MRD or PRD.&#8221;</li>
<li>&#8220;Many teams are working with traditional project managers who are doing their best to be agile, but have been trained to manage dependencies and tell people what to do.&#8221;</li>
<li>&#8220;Teams are trying to be agile with tightly coupled software architectures, insufficient test coverage, legacy code bases, and unable to do a daily build.&#8221;</li>
</ul>
<p style="text-align:justify;">Removing dependencies is a key step that can be taken towards a truly agile development environment.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=99&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2008/12/08/the-secret-to-organizational-agility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>
	</item>
		<item>
		<title>Be careful with your online brand&#8230;</title>
		<link>http://stuartthompsontech.wordpress.com/2008/12/08/be-careful-with-your-online-brand/</link>
		<comments>http://stuartthompsontech.wordpress.com/2008/12/08/be-careful-with-your-online-brand/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 21:24:43 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=97</guid>
		<description><![CDATA[As the popularity of Web 2.0 is growing, so is the ability for others to observe and evaluate your story and your personal online brand.  This article from JASE marketing reports that a &#8220;survey of 500 top colleges found that 10 percent of admissions officers said they look at MySpace and Facebook to evaluate applicants.&#8221; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=97&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">As the popularity of Web 2.0 is growing, so is the ability for others to observe and evaluate your story and your personal online brand.  <a href="void(0);/*1228762305907*/">This article from</a> JASE marketing reports that a <span style="font-style:italic;">&#8220;survey of 500 top colleges found that 10 percent of admissions officers said they look at </span><a title="JASE Group MySpace" href="http://www.myspace.com/" target="_blank">MySpace</a><span style="font-style:italic;"> and </span><a title="JASE Group Facebook" href="http://www.facebook.com/" target="_blank">Facebook</a><span style="font-style:italic;"> to evaluate applicants.&#8221;</span></p>
<p style="text-align:justify;">I&#8217;ve always lived by two golden rules with regards to blogging:<br />
1) Blog only something you would wish to see printed and cited at any time in the future.<br />
2) Do not edit or update a blog assuming that a printed/archived/cached copy of the original does not exist.</p>
<p style="text-align:justify;">It&#8217;s a general faux pas to update a blog post for any reason.  The web is alive with caches and indexes so the chances are that the original is still out there for people to compare.  Spelling errors are generally ok, but if the content of an article is to be updated it is good form to list at <span style="font-style:italic;">Updated: [description of update]</span> at the top or bottom of the post.  If an opinion is being revised, be clear about why there is a change in stance.  Comments are a great way to revise an opinion after learning new information as it allows readers to see the thought processes and perhaps benefit from the same line of thinking that provoked your own turn around.</p>
<p style="text-align:justify;">Web 2.0 means we are all ultra-connected.  This can be great not only for staying in touch with friends but also for business networking and establishing a reputation and a brand in the online world.  However, remember that this &#8220;permanent record&#8221; can go both ways: and this one is for the world to see.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/97/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/97/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/97/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=97&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2008/12/08/be-careful-with-your-online-brand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby on Rails Setup with DreamHost</title>
		<link>http://stuartthompsontech.wordpress.com/2008/10/28/ruby-on-rails-setup-with-dreamhost/</link>
		<comments>http://stuartthompsontech.wordpress.com/2008/10/28/ruby-on-rails-setup-with-dreamhost/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 21:11:43 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[DreamHost]]></category>
		<category><![CDATA[Instructions]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Setup]]></category>
		<category><![CDATA[The Experiment]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=54</guid>
		<description><![CDATA[As step 1 of my latest experiment, I&#8217;ve started by configuring a Ruby on Rails site with DreamHost.  This actually involved quite a bit of setup work, which is not unusual when remotely hosting a new website.  I have documented the steps as fully as I can for anyone else curious about trying development in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=54&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As step 1 of <a href="http://stuartthompsontech.wordpress.com/2008/10/27/the-aspnet-silverlight-php-rails-experiment/" target="_blank">my latest experiment</a>, I&#8217;ve started by configuring a <a href="http://www.rubyonrails.org" target="_blank">Ruby on Rails</a> site with <a href="http://www.dreamhost.com" target="_blank">DreamHost</a>.  This actually involved quite a bit of setup work, which is not unusual when remotely hosting a new website.  I have documented the steps as fully as I can for anyone else curious about trying development in Rails.</p>
<p><strong>Step 1 &#8211; Signup with DreamHost</strong><br />
You can sign up <a href="http://www.dreamhost.com/r.cgi?461119" target="_blank">using this link</a> or use the promo code LETMETRYRAILS and receive $50 off (i.e. no setup fee).</p>
<p style="text-align:justify;"><strong>Step 2 &#8211; Configure your domain</strong><br />
The next step is to configure your domain.   We&#8217;ll start at the <a href="http://panel.dreamhost.com" target="_blank">DreamHost configuration panel</a>.  Select <em>Domains</em> and then <em>Manage Domains</em> from the left-hand sidebar.  This will bring up the list of domains in your account.  Click the <em>Edit </em>button in the <em>Web Hosting</em> column.</p>
<p><a href="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_managedomains2.jpg"><img class="alignnone size-full wp-image-62" title="dreamhost_managedomains2" src="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_managedomains2.jpg?w=460&#038;h=228" alt="" width="460" height="228" /></a></p>
<p>This will open the settings page for that domain.  Check the FastCGI and Passenger (mod_rails) checkboxes.  Finally click the <em>Change fully hosted settings now!</em> button (note that this button is not at the bottom of the page, rather at the end of the first section).</p>
<p><a href="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_configuredomain1.jpg"><img class="alignnone size-full wp-image-63" title="dreamhost_configuredomain1" src="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_configuredomain1.jpg?w=460&#038;h=366" alt="" width="460" height="366" /></a></p>
<p style="text-align:justify;">FastCGI support allows your Rails project to run much faster.  The Passenger (mod_rails) option allows your Rails application to be configured much more easily and is the <a href="http://wiki.dreamhost.com/Passenger" target="_blank">preferred DreamHost method</a> for hosting Ruby on Rails applications.</p>
<p style="text-align:justify;"><strong>Step 3 &#8211; Configure your FTP/SSH user</strong><br />
We will be performing much of the setup and configuration of the website via SSH.  We will need to setup a user account for this purpose.  During your initial setup you should have created an ftp account for your domain, probably with the same name as that domain (if you accepted the defaults).  Select the <em>Users</em> and then <em>Manage Users</em> options from the left side-bar.  Click the <em>Edit</em> button next to your user in the <em>Actions </em>column.</p>
<p><a href="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_editusers.jpg"><img class="alignnone size-full wp-image-61" title="dreamhost_editusers" src="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_editusers.jpg?w=460&#038;h=216" alt="" width="460" height="216" /></a></p>
<p style="text-align:justify;">This will open the following page where you can edit your user.  Change the User <em>Account Type</em> to <em>Shell account</em> and select the <em>/bin/bash</em> shell type.  Finally, hit the <em>Save Changes</em> button at the bottom of the page.</p>
<p style="text-align:left;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_editingftpuser.jpg"><img class="alignnone size-full wp-image-64" title="dreamhost_editingftpuser" src="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_editingftpuser.jpg?w=460&#038;h=297" alt="" width="460" height="297" /></a></p>
<p style="text-align:left;">This enables the user to connect using a Telnet/SSH client, which is exactly what we are going to do next.</p>
<p style="text-align:justify;"><strong>Step 4 &#8211; Download some tools</strong><br />
Next we&#8217;re going to download the tools we&#8217;ll need to create and configure our rails website.  We&#8217;ll need the latest release of Ruby, MySQL, HeidiSql, and PuTTY.  HeidiSql is a free gui for maintaining MySQL databases.  PuTTY is a free Telnet/SSH client that we&#8217;ll use for remote configuration of our site.  Note that you do not need to signup on the MySQL site to get the download.  Click the <em>No thanks, just let me download</em> link.</p>
<ul>
<li>Ruby 1.8.6-27 RC1 can be <a href="http://rubyforge.org/frs/?group_id=167" target="_blank">downloaded here</a>.</li>
<li>MySQL 5.0 Community Server can be <a href="http://dev.mysql.com/downloads/mysql/5.0.html#win32" target="_blank">downloaded here</a> (select the Windows ZIP/Setup.EXE (x86) option)</li>
<li>HeidiSQL 3.2 can be <a href="http://www.heidisql.com/download.php" target="_blank">downloaded here</a>.</li>
<li>PuTTY can be <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">downloaded here</a>.</li>
</ul>
<p style="text-align:justify;"><strong>Step 5 &#8211; Installing Rails</strong><br />
Now that we have the necessary tools installed it is time to setup Rails locally.  Fortunately, Ruby comes with everything we need to get setup and running, including the WEBrick web server that we can use to run and test our site before deployment.  When installing Ruby, be sure to check the <em>Enable RubyGems </em>option on the first page of the installer.</p>
<p style="text-align:left;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rubyinstallation.jpg"><img class="alignnone size-full wp-image-66" title="rubyinstallation" src="http://stuartthompsontech.files.wordpress.com/2008/10/rubyinstallation.jpg?w=460&#038;h=355" alt="" width="460" height="355" /></a></p>
<p style="text-align:left;">Once the installer completes, open up a command window and execute the following commands:</p>
<p style="text-align:left;padding-left:30px;"><span style="color:#000080;">cd ruby/bin<br />
gem update &#8211;system<br />
gem install rails &#8211;version 2.1.2</span></p>
<p style="text-align:justify;">This will use the gem system to install rails locally.  If everything is successful, your command window should look something like this:</p>
<p style="text-align:left;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/installrails1.jpg"><img class="alignnone size-full wp-image-69" title="installrails1" src="http://stuartthompsontech.files.wordpress.com/2008/10/installrails1.jpg?w=460&#038;h=294" alt="" width="460" height="294" /></a></p>
<p style="text-align:justify;">You may need to restart your system at this point.  Ughh.  This is because Windows Vista and XP sometimes struggle to detect that new environment variables were added to the $PATH.  Unless you relish fully qualifying the <em>C:/Ruby/bin</em> directory on the next few commands, I&#8217;d advise you restart now.  It&#8217;s also not a bad idea since we did just install four new programs.  I&#8217;ve found Windows seems to run more smoothly if you reboot after installing new things.</p>
<p style="text-align:justify;"><strong>Step 6 &#8211; Create your Rails site locally</strong><br />
Now that we have Rails setup, let&#8217;s create a simple site locally.  I created a new directory on C:\ called <em>projects</em> in which to develop the site.  Open a command prompt and type the following:</p>
<p style="padding-left:30px;"><span style="color:#000080;">cd \<br />
md projects<br />
cd projects<br />
rails MyRailsSite</span></p>
<p>This will create your rails site in <em>C:\projects\MyRailsSite</em>.  Before we add our first view and controller, let&#8217;s quickly check that everything wired up properly.  To do this we need to start the WEBrick server:</p>
<p style="padding-left:30px;"><span style="color:#000080;">cd C:\projects\MyRailsSite<br />
ruby script/server</span></p>
<p>Vista may ask if you wish to <em>unblock</em> Ruby, which you do.  Your command prompt should look something like the following:</p>
<p><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rails_webrickserver.jpg"><img class="alignnone size-full wp-image-71" title="rails_webrickserver" src="http://stuartthompsontech.files.wordpress.com/2008/10/rails_webrickserver.jpg?w=460&#038;h=141" alt="" width="460" height="141" /></a></p>
<p>You can now navigate to <a href="http://127.0.0.1:3000" target="_blank">http://127.0.0.1:3000</a> to see your site.  If everything is configured correctly you should see the Ruby on Rails welcome page:</p>
<p><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rubyonrails_welcomescreen.jpg"><img class="alignnone size-full wp-image-72" title="rubyonrails_welcomescreen" src="http://stuartthompsontech.files.wordpress.com/2008/10/rubyonrails_welcomescreen.jpg?w=460&#038;h=336" alt="" width="460" height="336" /></a></p>
<p>We can shutdown the WEBrick server by pressing Ctrl-C in the command prompt window.</p>
<p>Now let&#8217;s create our first controller and view.  We&#8217;re going to keep it simple and put up a page that displays the message &#8220;Hello World!&#8221;.  At the command prompt type the following:</p>
<p style="padding-left:30px;"><span style="color:#000080;">cd projects\MyRailsSite<br />
ruby script/generate controller HelloWorld</span></p>
<p><span style="color:#000080;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rails_createcontroller.jpg"><img class="alignnone size-full wp-image-73" title="rails_createcontroller" src="http://stuartthompsontech.files.wordpress.com/2008/10/rails_createcontroller.jpg?w=460&#038;h=167" alt="" width="460" height="167" /></a><br />
</span></p>
<p style="text-align:justify;">This will generate a new controller for you as well as a new view.  If you aren&#8217;t familiar with MVC development, just follow along for now until the sample becomes clear.  The rest will come in time and with additional reading and practice.  For now it is suffice to say that a controller will perform the work for a web page request where the view will display the results of that work.</p>
<p style="text-align:justify;">Let&#8217;s edit the controller that was generated.  To do this, open up an explorer window, navigate to <em>C:\projects\MyRailsSite\app\controllers</em>, right-click over the <em>hello_world_controller.rb</em> file and select <em>Edit</em> from the context menu.  This should open the controller file in the SciTE editor.  We need to add lines to the class to respond to the <em>index</em> action.  The <em>index</em> action is the default action that will be performed for a controller.  To do this, edit the file to look like the following:</p>
<p style="text-align:justify;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rails_editcontroller.jpg"><img class="alignnone size-full wp-image-74" title="rails_editcontroller" src="http://stuartthompsontech.files.wordpress.com/2008/10/rails_editcontroller.jpg?w=442&#038;h=186" alt="" width="442" height="186" /></a></p>
<p style="text-align:justify;">This <em>controller</em> will now set the variable <em>@message</em> to the literal &#8220;Hello World&#8221;; when the index <em>action</em> is requested.  Controllers perform actions.</p>
<p style="text-align:justify;">Save the file and close it.  Now we will create a view to display the message.  Navigate to the <em>C:\projects\MyRailsSite\app\views\hello_world</em> directory in explorer (notice how Rails created the view directory for us).  Right-click in the directory and create a new file called <em>index.html.erb</em>.  Now right-click this file and open it in your favorite editor (Notepad will suffice).  Add the following to the file:</p>
<p style="text-align:justify;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rails_createview.jpg"><img class="alignnone size-full wp-image-75" title="rails_createview" src="http://stuartthompsontech.files.wordpress.com/2008/10/rails_createview.jpg?w=347&#038;h=194" alt="" width="347" height="194" /></a></p>
<p style="text-align:justify;">Save the file and close the editor.  We&#8217;re almost ready to test out our new controller and view.  First, however, we need to configure a <em>route</em> for our site.  A <em>route</em> is a mapping from an end-point (url) in our site to an actual controller and view that will fulfil the request.  In explorer, navigate to <em>C:\projects\MyRailsSite\config</em>, right-click the file <em>routes.rb</em> and select <em>Edit</em> from the context-menu.  This will open your routes file in the SciTE editor.  Almost the entire file is commented out.  Most of this file contains instructions for configuring custom routes.  We&#8217;re going to comment out the last two lines of the file and insert a single mapped route of our own.  Edit the end of the file to look like the following:</p>
<p style="text-align:justify;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rails_editroutes.jpg"><img class="alignnone size-full wp-image-76" title="rails_editroutes" src="http://stuartthompsontech.files.wordpress.com/2008/10/rails_editroutes.jpg?w=460&#038;h=105" alt="" width="460" height="105" /></a></p>
<p style="text-align:justify;">This line connects the <em>helloworld</em> route to the <em>hello_world</em> controller for the <em>index</em> action.  The action specification isn&#8217;t actually necessary as the index action is assumed by default if none is specified, but I prefer to be explicit.</p>
<p style="text-align:justify;">There is one final thing we&#8217;ll need to do before we can browse to our page locally.  We need to install and configure MySQL.</p>
<p style="text-align:justify;"><strong>Step 7 &#8211; Install and configure MySQL</strong><br />
This is a very short step.  Run the MySQL setup package you downloaded earlier and select the <em>Typical</em> installation option.  Then hit Next-&gt;Next-&gt;Finish all the way to the end.  When the configuration wizard runs, choose <em>Detailed Configuration</em>, then <em>Developer Machine, </em>then<em> </em><em>Multifunctional Database</em>.  When asked for a location for the Inno files, I used <em>C:\projects\MySQL</em>.  Choose <em>Decision Support (DSS)/OLAP</em> then leave both boxes checked on the next dialog with 3306 as the port number.  Choose <em>Standard Character Set</em>, then check <em>Install As Windows Service</em> and leave <em>Include Bin Directory in Windows PATH</em> unchecked.  Enter a new root password, leave <em>Create An Anonymous Account</em> unchecked.  Finally, hit <em>Execute</em> to finish the configuration wizard.  MySQL is now installed and configured.</p>
<p style="text-align:justify;"><strong>Step 8 &#8211; Create a database for our project</strong><br />
We&#8217;ll need to create a database for our project.  To do this we&#8217;ll need to install HeidiSql.  Let&#8217;s run that installer now.  I use the defaults from the installer except on the <em>Select Additional Tasks</em> dialog where I uncheck <em>Associate .SQL Files with HeidiSQL. </em>When the installer completes it will launch the HeidiSQL gui.  Click the New button at the top of the first dialog.  Name the connection <em>MyRailsSite</em>, click OK, and then enter the password you selected during your MySQL installation into the password box provided.  The first thing we&#8217;re going to do is create a new database.  Right-click over root@127.0.0.1 in the left side-bar and select <em>Create database</em> from the context menu.  Enter <em>MyRailsSite</em> as the database name and click ok.  Now select Tools-&gt;User-Manager from the top menu.  We&#8217;re going to create a new user to avoid using the root user in our application.  For the <em>Username</em> type myrailsdbuser, set<em> From Host </em>to<em> localhost</em>, and type a password for your new user.  Don&#8217;t use the same password you used for root.  In the <em>Allow access to</em> list, left-click over the <em>myrailssite</em> database (it will turn yellow).  Now click <em>Add User</em>.  Then click <em>Close</em> to close the user manager dialog.  Now we&#8217;ve created a database and a specific user for our Rails application to use.</p>
<p style="text-align:justify;"><strong>Step 9 &#8211; Configure Rails to use the database</strong><br />
Finally we need to configure our Rails site to use our new database.  In an Explorer window, navigate to <em>C:\projects\MyRailsSite\config</em>, right-click the <em>database.yml</em> file and edit it in your favorite editor (I use <a href="http://www.textpad.com/" target="_blank">TextPad</a> but NotePad will suffice).  Edit your file to look like the following:</p>
<p style="text-align:justify;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rails_dbconfig2.jpg"><img class="alignnone size-full wp-image-83" title="rails_dbconfig2" src="http://stuartthompsontech.files.wordpress.com/2008/10/rails_dbconfig2.jpg?w=285&#038;h=380" alt="" width="285" height="380" /></a></p>
<p style="text-align:justify;">
<p style="text-align:justify;">
<p style="text-align:justify;"><strong>Step 10 &#8211; Testing the site locally</strong><br />
We&#8217;re finally ready to test the site locally!  Open up a command window are run the following to start the WEBrick server:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">cd c:\projects\myrailssite<br />
ruby script/server</span></p>
<p style="text-align:justify;">Then open a browser and navigate to <a href="http://127.0.0.1:3000/" target="_blank">http://127.0.0.1:3000/</a>.  You&#8217;ll notice that the Rails welcome page still displays.  However, change the url in the browser to point to <a href="http://127.0.0.1:3000/helloworld" target="_blank">http://127.0.0.1:3000/helloworld</a>.  You should now see your view displaying the message &#8220;Hello World!&#8221;.  Let&#8217;s remove the default index page now and then make your default route point to your <em>helloworld</em> view.  To do this, open up Explorer and navigate to <em>c:\projects\myrailssite\public</em>.  This is your site&#8217;s public directory.  From here, delete the <em>index.html</em> file.  That&#8217;s the welcome page gone; we don&#8217;t need it anymore.  Now navigate to <em>c:\projects\myrailssite\config</em> and open the <em>routes.rb</em> file again.  Add the following line just before the map.connect line we added earlier:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">map.root :controller=&gt;&#8221;hello_world&#8221;</span></p>
<p style="text-align:justify;">This configures the <em>root</em> route to point to our hello world controller.  As we stated earlier, there is no need to specify the <em>index</em> action as it is assumed by default.  Save and close the file, then browse to <a href="http://127.0.0.1:3000" target="_blank">http://127.0.0.1:3000</a> once more.  Your site should now be displaying your &#8220;Hello World!&#8221; message.  Note how the url is just <a href="http://127.0.0.1:3000" target="_blank">http://127.0.0.1:3000</a> and doesn&#8217;t have helloworld at the end.  This is an important point about routes.  You aren&#8217;t navigating a particular directory structure on the site, you are simply navigating routes and actions.  The controller could be named anything you like as long as the route for a particular end-point correctly routed requests for that end-point to your controller.  For now, let&#8217;s stop the WEBrick server and close the command window.  The final task is to get your Rails site up to <a href="http://www.dreamhost.com">DreamHost</a> and serve your &#8220;Hello World!&#8221; request remotely.</p>
<p style="text-align:justify;"><strong>Step 11 &#8211; Configuring DreamHost for your site</strong><br />
This final configuration step may seem a little confusing at first, but only if you aren&#8217;t familiar with Linux and BASH.  It doesn&#8217;t take very long and it isn&#8217;t important to understand how it works because you&#8217;ll only need to do it once.  We&#8217;re going to install version 2.1.2 of rails to your remote host because that&#8217;s the version that Passenger (mod_rails) needs in order to run your site.  This is where we&#8217;ll need PuTTY.  Fortunately there is no installation step with PuTTY.  It is simply an executable that you download and run.</p>
<p style="text-align:justify;">When you run PuTTY, you will need to supply the username and password of the user we configured in step 3.  This will connect you to the server that will host your site.  The following instructions are commands to enter into the BASH shell as well as instructions on editing your ~/.bash_profile file (which is similar to environment settings for the command shell in Windows).  The first part of these instructions is about editing your ~/.bash_profile file to ensure that some paths and other required settings are configured before beginning installation.  These instructions have been adapted from the <a href="http://wiki.dreamhost.com/RubyGems" target="_blank">DreamHost wiki article on this topic</a>.</p>
<p style="text-align:justify;">Before we update rails, let&#8217;s first create our Rails site remotely.  To do this, first run PuTTY.  For the <em>Host Name</em> you will supply your domain name in the form www.MyDomainName.com.  Then click <em>Open</em>.  I choose <em>No</em> from the next dialog as I don&#8217;t want to store anything in the registry.  You will now enter the username and password for the user we created in step 3.  When you connect, type <em>ls</em> and hit enter.  This is the BASH command to list the contents of the current directory.  You should see <em>MyDomainName.com</em> listed in the output.  We are going to navigate to that folder and then create a rails site inside that folder.</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">cd MyDomainName.com<br />
rails MyRailsSite</span></p>
<p style="text-align:justify;">This will create a Rails site on the DreamHost server, the same way we did it locally earlier.  We&#8217;re going to create the site like this and then upload our site files from our local machine to the remote site.  To upload our files, we&#8217;ll use an Explorer window and ftp.  First, however, we need to create a copy of our database.yml and environment.rb files.  This is because those files will be different on our remote host than they are locally.  Create a copy of each of those files called database.yml.live and environment.rb.live now.  Now edit the database.yml.live file to look like the following:</p>
<p style="text-align:justify;"><a href="http://stuartthompsontech.files.wordpress.com/2008/10/rails_dbconfiglive2.jpg"><img class="alignnone size-full wp-image-87" title="rails_dbconfiglive2" src="http://stuartthompsontech.files.wordpress.com/2008/10/rails_dbconfiglive2.jpg?w=281&#038;h=134" alt="" width="281" height="134" /></a></p>
<p style="text-align:justify;">
<p style="text-align:justify;">Edit your environment.rb.live file and uncomment the following line (its on line 5):</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">ENV['RAILS_ENV'] ||= &#8216;production&#8217;</span></p>
<p style="text-align:justify;">This is important because running in development mode under FastCGI will cause memory leaks on the DreamHost server.  They will catch them and clean them up but it&#8217;s better to run in full production mode and not cause problems.</p>
<p style="text-align:justify;">One final change we need to make locally is to update the <em>c:\projects\myrailssite\config\environments\production.rb</em> file.  Comment out the <em>config.action_view.cache_template_loading = true</em> line as it causes problems with the Passenger product that will host our site.</p>
<p style="text-align:justify;">Now we&#8217;re ready to install Rails 2.1.2 remotely.  Switch back to your PuTTY session (or log in again if you <em>exit</em>ed).  Let&#8217;s first edit the ~/.bash_profile file.  To do this we will be using the <em>nano</em> text editor.  To open the ~/.bash_profile file in nano, type the following:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">nano ~/.bash_profile</span></p>
<p style="text-align:justify;">Now you can use the cursor keys to navigate the file.  We need to add the following lines to the end of the file:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;"># Path settings<br />
export GEM_HOME=&#8221;$HOME/.gems&#8221;<br />
export GEM_PATH=&#8221;$GEM_HOME:/usr/lib/ruby/gems/1.8&#8243;<br />
export PATH=&#8221;$HOME/bin:$HOME/.gems/bin:$PATH&#8221;<br />
export RUBYLIB=&#8221;$HOME/lib:$RUBYLIB&#8221;</span></p>
<p style="padding-left:30px;"><span style="color:#000080;"># Stops the DreamHost processes from killing the gem install process<br />
alias gem=&#8221;nice -n19 ~/bin/gem&#8221;</span></p>
<p style="text-align:justify;">To save your changes press Ctrl-O then hit enter.  Press Ctrl-X to exit the editor and return to the shell.  You can now type <span style="color:#000080;">cat ~/.bash_profile</span> and the contents of the file should be printed out.  This is a good way to check that your changes were saved and that you typed everything correctly.</p>
<p style="text-align:justify;">Now we need to perform the installation.  The following commands will achieve this:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">cd ~<br />
mkdir .gems</span></p>
<p style="padding-left:30px;"><span style="color:#000080;">mkdir bin lib src</span></p>
<p style="padding-left:30px;"><span style="color:#000080;">cd ~/src<br />
wget http://rubyforge.org/frs/download.php/43985/rubygems-1.3.0.tgz<br />
tar xzvf rubygems-1.3.0.tgz<br />
cd rubygems-1.3.0<br />
ruby setup.rb &#8211;prefix=$HOME</span></p>
<p style="padding-left:30px;"><span style="color:#000080;">cd ~/bin<br />
ln -s gem1.8 gem</span></p>
<p style="text-align:justify;">For more information on what each of these steps is doing check the <a href="http://wiki.dreamhost.com/RubyGems" target="_blank">DreamHost wiki article</a>.  We can check that the path and gem versions are correct by typing the following:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">which gem<br />
gem -v</span></p>
<p style="text-align:justify;">These commands should return <span style="color:#000080;">/home/USERNAME/bin/gem</span> and <span style="color:#000080;">1.3.0</span> respectively.  Now we can execute the command to install Rails 2.1.2, which is:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">gem install rails &#8211;version 2.1.2</span></p>
<p style="text-align:justify;">What we&#8217;ve accomplished here is to install RubyGems and Rails 2.1.2 to our hosted server.  The last thing we need to do to make everything work is to use rake to <em>freeze</em> our version of Rails to 2.1.2 so that Passenger will use our Rails installation when running our site.  The commands to do this are as follows.  Please note that you need to supply your domain name in the format MyDomainName.com and the name of your Rails site in place of MyRailsSite in the first command.  This simply changes the current directory so that we&#8217;re running rake in the right place.</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">cd ~/MyDomainName.com/MyRailsSite/<br />
rake rails:freeze:edge TAG=rel_2-1-2</span></p>
<p style="text-align:justify;">That&#8217;s it!  Phew.  That felt like a lot of work, but at least you only have to do it once.</p>
<p style="text-align:justify;"><strong>Step 12 &#8211; Deploying and testing your site remotely</strong><br />
Now that we&#8217;ve set up the environment with <a href="http://www.dreamhost.com" target="_blank">DreamHost</a>, the only task left is to deploy the site remotely and test it out.  Before we do that though, we are going to check one last configuration setting in the DreamHost control panel, just to be sure that everything is setup correctly.  If you navigate to Domains-&gt;Manage Domains in the left side-bar and then click the <em>Edit</em> button again (see step 2), then check out the <em>Specify your web directory</em> setting.  This is where <a href="http://www.dreamhost.com" target="_blank">DreamHost</a> will send requests to <em>MyDomainName.com</em>.  It should be set to:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#000080;">/home/username/MyDomainName.com/MyRailsSite/public</span></p>
<p style="text-align:justify;">By setting the directory to the <em>public</em> directory of your Rails site, it means that users cannot navigate outside of that directory and browse places that they aren&#8217;t supposed to be.</p>
<p style="text-align:justify;">Let&#8217;s finish up and deploy our Rails site from the local machine to the remote server.  We&#8217;ll use Explorer and ftp to do this.  Open up Explorer and type <em>ftp://ftp.MyDomainName.com</em> into the address bar.  Now open up the <em>MyDomainName.com</em> and then <em>MyRailsSite</em> folders.  You will need to copy your app directory from your local machine at <em>c:\projects\myrrailssite\app</em> up to the remote server.  When you have copied these files, navigate to the <em>pubilc </em>directory on the remote server and delete the index.html file.  We don&#8217;t need the Rails welcome page on live anymore either!  Then navigate to the <em>config</em> directory and copy the <em>routes.rb</em>, <em>environment.rb.live</em> and <em>database.yml.live</em> files up to the corresponding folder on the server.  Don&#8217;t forget to rename these to <em>environment.rb</em> and <em>database.yml</em> on the remote server.  We only renamed them so that we could have two different files locally.  Finally, navigate to the <em>config/environments</em> folder and copy the <em>production.rb</em> file that we edited up to the corresponding location on the remote server.  From now on, when you deploy your site, you will only have to copy the <em>app</em> folder to the remote server (unless you change config settings that is).</p>
<p style="text-align:justify;">The final step before we can test our site on live is to setup the MySQL database on the DreamHost side to match the one we set up locally.  Since we didn&#8217;t create any database tables, this is fairly simple to do through the DreamHost interface.  Go to Goodies-&gt;Manage MySQL and repeat the same steps here as we did in step 8.  You can also use HeidiSQL if you want to manage your database remotely that way.  However, for now I recommend using the DreamHost web interface to do this work.  All you need to ensure is that the database name and username/password for that database match the settings you specified in your database.yml file.  I&#8217;m going to cover using databases in Rails in more detail in a future article.  For now we just need to get an empty database and a user that has access to keep Rails happy.</p>
<p style="text-align:left;">Congratulations!  Assuming that everything was wired up correctly, you should now be able to open a browser and navigate to <em>http://www.MyDomainName.com</em> to see your site being hosted remotely.</p>
<p style="text-align:justify;">Hopefully this article will help you get up and running with a basic Rails site that is hosted remotely.  The focus of this article was understanding the relationship between running a Rails site locally and hosting it on a remote server.  Setting up your development in this way from day one will save a lot of headaches later when it comes to deployment time.  Developing and testing locally, then deploying to a live host means that problems can be identified early and that changes can be tested locally rather than on a live site.  I&#8217;m going to expand upon this article as part of my ongoing experiement with ASP.NET, Silverlight, PHP, and Ruby on Rails.  Next we&#8217;re going to develop a database, understand models using ActiveRecord, and dig a little deeper into Rails.  For now: happy hosting!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=54&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2008/10/28/ruby-on-rails-setup-with-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_managedomains2.jpg" medium="image">
			<media:title type="html">dreamhost_managedomains2</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_configuredomain1.jpg" medium="image">
			<media:title type="html">dreamhost_configuredomain1</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_editusers.jpg" medium="image">
			<media:title type="html">dreamhost_editusers</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/dreamhost_editingftpuser.jpg" medium="image">
			<media:title type="html">dreamhost_editingftpuser</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rubyinstallation.jpg" medium="image">
			<media:title type="html">rubyinstallation</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/installrails1.jpg" medium="image">
			<media:title type="html">installrails1</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rails_webrickserver.jpg" medium="image">
			<media:title type="html">rails_webrickserver</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rubyonrails_welcomescreen.jpg" medium="image">
			<media:title type="html">rubyonrails_welcomescreen</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rails_createcontroller.jpg" medium="image">
			<media:title type="html">rails_createcontroller</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rails_editcontroller.jpg" medium="image">
			<media:title type="html">rails_editcontroller</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rails_createview.jpg" medium="image">
			<media:title type="html">rails_createview</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rails_editroutes.jpg" medium="image">
			<media:title type="html">rails_editroutes</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rails_dbconfig2.jpg" medium="image">
			<media:title type="html">rails_dbconfig2</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rails_dbconfiglive2.jpg" medium="image">
			<media:title type="html">rails_dbconfiglive2</media:title>
		</media:content>
	</item>
		<item>
		<title>The ASP.NET, Silverlight, PHP, Rails Experiment</title>
		<link>http://stuartthompsontech.wordpress.com/2008/10/27/the-aspnet-silverlight-php-rails-experiment/</link>
		<comments>http://stuartthompsontech.wordpress.com/2008/10/27/the-aspnet-silverlight-php-rails-experiment/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 20:05:50 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=47</guid>
		<description><![CDATA[I&#8217;ve been working with Microsoft technologies for over ten years, specifically Microsoft&#8217;s web development technologies.  During that time I have built a variety of sites ranging in scope from e-commerce, educational, service provision, SaaS, to dashboards, portals, internal tools, and even SAP-migration.  While I praise the technology stack for what it allows me to do, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=47&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I&#8217;ve been working with <a href="http://msdn.microsoft.com/en-us/default.aspx" target="_blank">Microsoft technologies</a> for over ten years, specifically <a href="http://www.asp.net/" target="_blank">Microsoft&#8217;s web development technologies</a>.  During that time I have built a variety of sites ranging in scope from e-commerce, educational, service provision, <a href="http://en.wikipedia.org/wiki/Software_as_a_Service" target="_blank">SaaS</a>, to dashboards, portals, internal tools, and even SAP-migration.  While I praise the technology stack for what it allows me to do, it also comes with a whole host of limitations that make it hard for me to deliver the experience my clients would like.  Throughout this decade of web development I have heard a lot from those around me about alternative technology stacks that promise all manner of improvements and experiences.  Unfortunately there is a lot of resistance from any one technology stack to listen to and learn from the stacks around them, most of the cross-platform feedback comes in the form of &#8220;Microsoft sucks&#8221; or &#8220;PHP is for fan-boy script kiddies&#8221;.  The truth is that a large number of successful business are hosted on a wide variety of platforms.  Each technology stack has to at least be viable for that to be true.  The problem is getting at the truth without the zealous noise of &#8220;my stacks better than your stack&#8221; getting in the way.</p>
<p style="text-align:justify;">I decided that it was time for me to branch out and become more informed on these technologies myself so that I could truly understand the differences and what made each of them unique.  I&#8217;m hoping that as part of this experience I can not only become a better developer but also learn the problems that Ruby on Rails or PHP addresses.  I&#8217;ll like to be able to speak from an informed standpoint about the differences between the Microsoft and open-source approaches as well as better understand the problems each of those development worlds faces on a daily basis.  Either way, it&#8217;s going to be a heck of a lot of fun.</p>
<p style="text-align:justify;">The experiment I have in mind is to build the same web-site using four different technologies.  From the Microsoft camp I have chosen <a href="http://www.asp.net" target="_blank">ASP.NET</a> and <a href="http://silverlight.net/" target="_blank">Silverlight</a>.  From the open-source perspective I have chosen <a href="http://www.php.net/" target="_blank">PHP</a> and <a href="http://www.rubyonrails.org/" target="_blank">Ruby on Rails</a>.  I chose PHP and RoR because they are two technologies that I have always wanted to learn.  Learning both of those will also require some digging into <a href="http://httpd.apache.org/" target="_blank">Apache</a> and <a href="http://www.linux.org" target="_blank">Linux</a>, another two areas that I have too little direct experience with to effectively participate in an informed conversation.</p>
<p style="text-align:center;"><a href="http://www.asp.net"><img class="alignnone size-full wp-image-48" title="ASP.NET" src="http://stuartthompsontech.files.wordpress.com/2008/10/logo.png?w=108&#038;h=44" alt="" width="108" height="44" /> </a> <a href="http://www.silverlight.net"><img class="alignnone size-full wp-image-49" title="silverlightlogo" src="http://stuartthompsontech.files.wordpress.com/2008/10/silverlightlogo.jpg?w=131&#038;h=45" alt="" width="131" height="45" /> </a><a href="http://www.php.net"><img class="alignnone size-full wp-image-50" title="php" src="http://stuartthompsontech.files.wordpress.com/2008/10/php.gif?w=86&#038;h=49" alt="" width="86" height="49" /> </a><a href="http://www.rubyonrails.org"><img class="alignnone size-thumbnail wp-image-51" title="rails" src="http://stuartthompsontech.files.wordpress.com/2008/10/rails.png?w=42&#038;h=54" alt="" width="42" height="54" /></a></p>
<p style="text-align:justify;">Our horses are ready to race.  In terms of hosting, I have selected <a href="http://www.dreamhost.com" target="_blank">DreamHost</a> for the PHP and Rails sites, and I&#8217;m going to use <a href="http://www.stormhosts.com" target="_blank">StormHosts</a> for the <a href="http://www.asp.net" target="_blank">ASP.NET</a> and <a href="http://www.silverlight.net" target="_blank">Silverlight</a> projects (assuming that SH can do .NET 3.5, which I believe I saw at some point).  The reason I&#8217;m using remote hosting services for this experiment is that I don&#8217;t believe you get the true experience of a technology stack until you host it in this way.  It is very easy to get a Rails site up and running using <a href="http://www.webrick.org" target="_blank">WEBrick</a> and a local installation of Ruby.  Similarly, it is easy to get an ASP.NET site running on the personal web server that ships with <a href="http://msdn.microsoft.com/en-us/vstudio/default.aspx" target="_blank">Visual Studio 2008</a>.</p>
<p style="text-align:justify;">The first phase of the experiment is to get a &#8220;Hello World!&#8221; site up and running for each of the four environments.  The specifications are that a single end-point be accessible that displays the text &#8220;Hello World!&#8221; and that this end-point is accessible in both <a href="http://www.microsoft.com/windows/products/winfamily/ie/default.mspx" target="_blank">Internet Explorer</a> 7 and <a href="http://www.mozilla.com/en-US/firefox/" target="_blank">FireFox</a> 3.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=47&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2008/10/27/the-aspnet-silverlight-php-rails-experiment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/logo.png" medium="image">
			<media:title type="html">ASP.NET</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/silverlightlogo.jpg" medium="image">
			<media:title type="html">silverlightlogo</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/php.gif" medium="image">
			<media:title type="html">php</media:title>
		</media:content>

		<media:content url="http://stuartthompsontech.files.wordpress.com/2008/10/rails.png?w=74" medium="image">
			<media:title type="html">rails</media:title>
		</media:content>
	</item>
		<item>
		<title>Technical Blog Reborn</title>
		<link>http://stuartthompsontech.wordpress.com/2008/09/25/technical-blog-reborn/</link>
		<comments>http://stuartthompsontech.wordpress.com/2008/09/25/technical-blog-reborn/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 15:07:32 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[After the loss of my SubText blog following an failed upgrade, I am restarting my technical blog here at WordPress.  I&#8217;m going to spend the next couple of weeks migrating my existing articles over before I get going again on web 2.0 and quality development practices.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=1&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After the loss of my SubText blog following an failed upgrade, I am restarting my technical blog here at WordPress.  I&#8217;m going to spend the next couple of weeks migrating my existing articles over before I get going again on web 2.0 and quality development practices.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=1&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2008/09/25/technical-blog-reborn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>
	</item>
		<item>
		<title>VSLive! Day One &#8211; Architecting ASP.NET Applications Part 2 &#8211; Custom Providers</title>
		<link>http://stuartthompsontech.wordpress.com/2007/10/16/vslive-day-one-architecting-aspnet-applications-part-2-custom-providers/</link>
		<comments>http://stuartthompsontech.wordpress.com/2007/10/16/vslive-day-one-architecting-aspnet-applications-part-2-custom-providers/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 17:14:13 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[VSLive!]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=94</guid>
		<description><![CDATA[Custom Providers The second part of the discussion is opening with a discussion of custom provider development.  This is of great interest to me as my recent work with the Model View Presenter pattern has caused me to research and implement dependency injection for many of the layers of my application.  The current product that I&#8217;m working [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=94&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Custom Providers</strong><br />
The second part of the discussion is opening with a discussion of custom provider development.  This is of great interest to me as my recent work with the <a href="http://martinfowler.com/eaaDev/ModelViewPresenter.html">Model View Presenter</a> pattern has caused me to research and implement <a href="http://en.wikipedia.org/wiki/Dependency_injection">dependency injection</a> for many of the layers of my application.  The current product that I&#8217;m working on is implementing the MVP pattern and is using dependency injection to dynamically load a data layer at run time.  There is a need within the product to use a different data access layer assembly for the administrative tools than for the public side of the application.  The murky details behind this decision (which I shall leave aside) are to do with the deployment environment and maintenance cycles of the applications going forward.  There are a few mechanisms for achieving this dynamic load, however I&#8217;ve yet to find conclusive evidence that one method is preferable.</p>
<p>The idea behind dependency injection is improve the following fairly typical line of code:<br />
<span style="font-family:Courier,New;">MyClass myClass = new MyClass(); </span></p>
<p>One potential drawback in this line is that the physical class <span style="font-family:Courier,New;">MyClass</span> has been hard-coded as the only implementation that can exist for <span style="font-family:Courier,New;">myClass</span>.  If <span style="font-family:Courier,New;">MyClass</span> implements an interface <span style="font-family:Courier,New;">IMyClass</span> then it might be desirable in the code to switch out the implementation of the interface <span style="font-family:Courier,New;">IMyClass</span> that is being used.  The example du jour is switching out an MS SQL data access library for an Oracle data access library.  In that example, both implement the same interface but the application wishes to decide which library to use at runtime via a configuration setting.  This is a common problem in applications that wish to implement several version of a library than perform very similar but ultimately different tasks.  The provider model is based around this need.</p>
<p>The suggested methodology presented in this talk is to use:<br />
<span style="font-family:Courier,New;">Type myType = Type.GetType(&#8220;MyNamespace.MyClassName&#8221;);<br />
IMyClass myClass = System.Activator.CreateInstance(myType);<br />
</span></p>
<p>The theory here is that <span style="font-family:Courier,New;">Type.GetType</span> returns an object that describes the type to be created.  The <span style="font-family:Courier,New;">System.Activator.CreateInstance</span> line creates a concrete instance of the requested class except by this mechanism the class has been created using a string name versus a hard-coded class name.  This methodology works for classes that exist within the same assembly, however will not work for classes that exist outside of this assembly.  There is an extension to this will work for classes outside of this assembly.</p>
<p><strong>Dynamically Loading Assemblies</strong><br />
In order to extend this methodology to work for classes that are in other assemblies, there is a need to first load that assembly.  This is achieved via the following methodology:<br />
<span style="font-family:Courier,New;">Assembly asm = Assembly.LoadFile(MyAssemblyFileName);<br />
IMyClass myClass = asm.CreateInstance(MyClassName);<br />
</span></p>
<p>The basic change here is that now the concrete class instance is created from the assembly reference versus <span style="font-family:Courier,New;">System.Activator</span>.  This allows the dyanamically loaded class to reside in a separate assembly.  Now we have the ability to specify which data access layer library is being used within the application at run-time.  All calls within the application are made against the <span style="font-family:Courier,New;">IMyClass</span> interface, but the implementations now differ based upon the physical data access library that is loaded at run-time.</p>
<p><strong>Interface Isolation</strong><br />
Finally, interfaces are isolated into a separate assembly from either (any) of the concrete implementations of that interface.  The reason for this is that we do not want to require a reference from the main application to either of the implementations of the interface.  Such a reference would defeat the purpose of the exercise as it would again tie the application directly to a particular implementation.  Instead the main application references only the assembly that contains the interface.  Now any implementation of that interface can be used from within the main application by dynamically instantiating the implementation using the mechanism above.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/stuartthompsontech.wordpress.com/94/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/stuartthompsontech.wordpress.com/94/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=94&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2007/10/16/vslive-day-one-architecting-aspnet-applications-part-2-custom-providers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>
	</item>
		<item>
		<title>VSLive! Day One &#8211; Architecting ASP.NET Applications Part 1</title>
		<link>http://stuartthompsontech.wordpress.com/2007/10/16/vslive-day-one-architecting-aspnet-applications-part-1/</link>
		<comments>http://stuartthompsontech.wordpress.com/2007/10/16/vslive-day-one-architecting-aspnet-applications-part-1/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 17:13:18 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[VSLive!]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=91</guid>
		<description><![CDATA[Getting Situated For the preconference, I decided to attend Paul Sherrif&#8217;s talk on Architecting ASP.NET Applications.  Fortunately, I was able to get to the room about an hour early and find one of the few seats situated close to a power outlet.  I really didn&#8217;t want to have to transfer my notes from paper to my laptop [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=91&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Getting Situated</strong><br />
For the preconference, I decided to attend <a href="http://www.paulsheriffinnercircle.com/PublicSite/PublicDefault.aspx">Paul Sherrif&#8217;s</a> talk on <a href="http://www.ftponline.com/conferences/vslive/2007/lasvegas/workshops.aspx">Architecting ASP.NET Applications</a>.  Fortunately, I was able to get to the room about an hour early and find one of the few seats situated close to a power outlet.  I really didn&#8217;t want to have to transfer my notes from paper to my laptop later; I&#8217;d rather just type them out directly!</p>
<p><strong>N-Tier Development Benefits</strong><br />
The workshop has begun with a discussion of n-tier development; the benefits of logically separating services into different libraries and isolating functionality into discreet sections.  The advantages of this approach are that the maintenance and extension of your application are vastly simplified.  Refactoring common methods into reusable libraries minimizes the amount of work involved in fixing bugs because the buggy code needs only be fixed in one location.  Adapting to large-scale architectural changes in the application is also easier if a modular development model is adopted.  Switching out small components to adapt to technology shifts is far easier than making global code changes.  This means that large-scale changes can be handled cheaply and quickly.  The majority of the application libraries do not need to be run through a quality assurance cycle because they were not changed when the maintenance was performed.  Only the new library needs to be tested in addition to running a full integration test, which is still far cheaper that re-testing the entire system.  The following is a table detailing the suggested areas of isolation for an ASP.NET application:</p>
<table border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td>Business Rules</td>
<td>User Interface</td>
<td>Configuration Management</td>
</tr>
<tr>
<td>Data Access Service</td>
<td>Exception Management</td>
<td>Security Management</td>
</tr>
<tr>
<td>Data Layer</td>
<td>User Tracking</td>
<td>Log Management</td>
</tr>
</tbody>
</table>
<p><a href="http://www.stuartthompson.net/subtextblog/images/stuartthompson_net/subtextblog/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1.jpg"><img src="http://www.stuartthompson.net/subtextblog/images/stuartthompson_net/subtextblog/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1_Thumbnail.jpg" border="0" alt="" /></a></p>
<p><strong>Configuration Management</strong><br />
As opposed to using the <span style="font-family:Courier,New;">System.Configuration.ConfigurationManager.AppSettings["MyConfigItem"]</span> approach for reading settings, a custom AppConfigManager class can be built that isolates access to configuration settings into static properties on that class.  The argument for this architecture is that when and if the access mechanism for configuration settings changes in future versions of .NET, the changes will be isolated to only the AppConfigManager class.  This is a valid argument because the mechanism for reading configuration settings changed from .NET 1.1 to .NET 2.0.  In .NET 1.1 we used <span style="font-family:Courier,New;"><a href="http://msdn2.microsoft.com/en-us/library/system.configuration.configurationsettings.aspx">System.Configuration.ConfigurationSettings</a></span>, however in .NET 2.0 we are encouraged to use <span style="font-family:Courier,New;"><a href="http://msdn2.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx">System.Configuration.ConfigurationManager</a></span> instead.  Encapsulating application configuration settings is an architecture I&#8217;ve considered several times before but there is something that always makes me balk at the idea of a class full of statics.  The difference here, which I like, is that a sound justification exists and that the statics aren&#8217;t just returning constants.  Instead the static is returning a value using the <span>System.Configuration.ConfigurationManager.AppSettings["MyConfigItem"]</span> mechanism.  This does have the nice effect of isolating the final method of configuration management from the rest of the code in the application.  Should the mechanism for accessing configuration settings change in the future, only the AppConfigManager wrapper class will need to be updated.</p>
<p>I could be wrong, but I think Paul just compared using Intellisense to &#8220;using the force&#8221; ala Star Wars: &lt;sigh&gt;.  At least the humor hasn&#8217;t changed since the last conference I attended.  Actually, so far the guy has been pretty funny so I&#8217;ll give him a break.</p>
<p><img src="http://www.stuartthompson.net/subtextblog/images/stuartthompson_net/subtextblog/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1-LukeVader.jpg" border="0" alt="" /></p>
<p><strong>Custom Collection Classes</strong><br />
The major philosophical question that has arisen so far is whether or not to use custom collection classes when transacting between a data layer and a business tier or user interface layer.  The code samples presented use <a href="http://msdn2.microsoft.com/en-us/library/system.data.datatable.aspx"><span style="font-family:Courier,New;">DataTable</span></a> instances.  The argument presented is that a <span>DataTable</span> is actually analogous to a custom collection class as it has proprietary column names within it that correspond to the unique properties and data types of the business object being modeled.  The only concession offered in the workshop is that this does open a potential window for failure if Microsoft decided to drop support for the <span>DataTable</span> class in favor of a superior class.</p>
<p><strong>Code Generation</strong><br />
For a while now I have separated data adapter classes from object builder classes.  The data adapter classes are responsible for executing sql commands to a database and either writing or reading common data collection classes; such as <a href="http://msdn2.microsoft.com/en-us/library/system.data.idatareader.aspx">IDataReader</a>.  The builder classes are responsible for digesting those data collections and building concrete objects from them.  This allows for a nice separation between data interaction and data digestion.  However, I&#8217;ve always written both classes by hand.  They do not present a large chunk of work and I have usually disregarded the cost of coding such small functional classes as being negligible.  Code generation is something that has been suggested for these classes in the past, but I have often found that building the required code generation framework can be just as expensive as writing the classes that are needed.  However, the argument being presented in this workshop for code generation is that if the data builder level classes and stored procedures are generated then schema level changes are reflected more quickly.  This is an interesting advantage to note in the argument for using code generation for parts of the data layer.</p>
<p><strong>Deriving Business Rule Objects</strong><br />
The next part of this discussion addresses a second common problem with code generation, that of custom rule application.  A code generator can easily intuit the basic rules that need to be enforced for objects built from a schema, for example that required fields are populated.  However, a code generator cannot easily imply that a <em>cost</em> field needs to be between certain threshold values.  To address this problem, Paul suggests that a custom business rule object be derived from the generated data class.  The data class implements validation as virtual methods that can be overridden in the custom business class.  The overridden method can then apply the additional validation to enforce proprietary business rules.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/stuartthompsontech.wordpress.com/91/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/stuartthompsontech.wordpress.com/91/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=91&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2007/10/16/vslive-day-one-architecting-aspnet-applications-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>

		<media:content url="http://www.stuartthompson.net/subtextblog/images/stuartthompson_net/subtextblog/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1_Thumbnail.jpg" medium="image" />

		<media:content url="http://www.stuartthompson.net/subtextblog/images/stuartthompson_net/subtextblog/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1/10-14-2007-VSLiveDayOne-ArchitectingASPNETApplications-Part1-LukeVader.jpg" medium="image" />
	</item>
		<item>
		<title>Null-Coalescing Operator</title>
		<link>http://stuartthompsontech.wordpress.com/2007/08/10/null-coalescing-operator/</link>
		<comments>http://stuartthompsontech.wordpress.com/2007/08/10/null-coalescing-operator/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 17:46:24 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[??]]></category>
		<category><![CDATA[Null-Coalescing Operator]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=40</guid>
		<description><![CDATA[While at a rather disappointing MSDN event yesterday, I came across one gem of C# 3.0 candy in the form of a null-coalescing operator.  This is basically a short-cut for the oft seen: string emailAddress = parsedValue != null ? parsedValue : &#8220;(Not provided)&#8221;; OR string emailAddress = String.Empty; if (parsedValue != null) { emailAddress = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=40&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While at a rather disappointing MSDN event yesterday, I came across one gem of C# 3.0 candy in the form of a null-coalescing operator.  This is basically a short-cut for the oft seen:</p>
<p>string emailAddress = parsedValue != <span style="color:blue;">null</span> ? parsedValue : &#8220;(Not provided)&#8221;;</p>
<p><strong>OR</strong></p>
<p><span style="font-family:Courier,New;">string emailAddress = String.Empty;<br />
if (parsedValue != <span style="color:blue;">null</span>) {<br />
emailAddress = parsedValue;<br />
}<br />
else {<br />
emailAddress = &#8220;(Not provided)&#8221;;<br />
}<br />
</span></p>
<p><strong><span style="text-decoration:underline;">Using the Null-Coalescing Operator</span></strong><br />
These can now instead be re-written using the new null-coalescing operator as:</p>
<p><span style="font-family:Courier,New;"><span style="color:blue;">string</span> emailAddress = parsedValue ?? &#8220;(Not provided)&#8221;;</span></p>
<p>This can roughly be read as &#8220;Set emailAddress equal to parsedValue unless it is null, in which case set it to the literal (Not Provided)&#8221;.</p>
<p><strong><span style="text-decoration:underline;">Applications with Nullable Types</span></strong><br />
This is also very useful with the new nullable types.  For example, when converting an integer to its value type:</p>
<p><span style="font-family:Courier,New;"><span style="color:blue;">int</span>? recordsAffected = <span style="color:blue;">null</span>;<br />
<span style="color:#009900;">&#8230; code that might cause recordsAffected to contain a value &#8230;</span><br />
<span style="color:blue;">int</span> totalRecordsAffected += recordsAffected ?? 0;</span></p>
<p>Here a nullable int type can be added to a regular int without fear of an exception by subsituting 0 in the place of a null value.  It&#8217;s always nice to find new candy!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/stuartthompsontech.wordpress.com/40/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/stuartthompsontech.wordpress.com/40/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=40&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2007/08/10/null-coalescing-operator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Anonymous Method Predicates to Search Lists</title>
		<link>http://stuartthompsontech.wordpress.com/2007/08/07/using-anonymous-method-predicates-to-search-lists/</link>
		<comments>http://stuartthompsontech.wordpress.com/2007/08/07/using-anonymous-method-predicates-to-search-lists/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 19:15:24 +0000</pubDate>
		<dc:creator>stuartthompson</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Anonymous Methods]]></category>
		<category><![CDATA[Predicates]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://stuartthompsontech.wordpress.com/?p=38</guid>
		<description><![CDATA[I use System.Collections.Generic.List all over the place.  Generics are a couple of years out of date and most people are done with them in terms of cool factor, but that doesn&#8217;t in any way detract from the coolness they add to my life each and every day.  I still eat toast and that&#8217;s been around for ages.  I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=38&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I use System.Collections.Generic.List all over the place.  Generics are a couple of years out of date and most people are done with them in terms of cool factor, but that doesn&#8217;t in any way detract from the coolness they add to my life each and every day.  I still eat toast and that&#8217;s been around for ages.  I answered a question this morning that made me realize that while the generic list class has been generally embraced by most, it perhaps has also been generally muddled by some attempting to keep up with the oft quick pace that is .NET.  I&#8217;ve seen quite a few development shops that stuck around on .NET 1.1 for a long time because of migration concerns and then very quickly &#8220;updated their code&#8221; to embrace .NET 2.0 without really giving people the time to absorb all of the new information.  One of these areas is with collection classes.</p>
<p>When a development shop moves to .NET 2.0, one of the first things you&#8217;ll see is a bunch of {blah}Collection class objects being removed from the codebase and their usage replaced with List throughout.  This is all well and good.  A smaller code surface area is easier to test and maintain, and most people didn&#8217;t ever fully finish building a complete collection class anyway, feeling that the code around finding, searching, comparing, etc&#8230; within the collection classes was always a little muddy.  It&#8217;s true that building a robust collection class is difficult, especially when considering an object model that involves some serious aggregation.</p>
<p>However, we seem to have found a new source for confusion on how to search collections in the adoption of the System.Collections.Generic.List class.  The question I answered this morning about searching a generic list is not the first I have received, so I thought I&#8217;d take the time to share a couple of techniques that I use and get feedback from others on their strategies.  What prompted me to write this article was a small snippet of code I received that looked like this:  (original code modified to protect the innocent)</p>
<p>string targetName = &#8220;Thompson&#8221;;</p>
<p>List myObjectList = new List();<br />
&#8230; list is populated with some items &#8230;</p>
<p>MyObj selectedObject = null;<br />
foreach (MyObj obj in myObjectList)<br />
{<br />
if (obj.Name == targetName)<br />
{<br />
selectedObject = obj;<br />
}<br />
}</p>
<p>The code <em>looks</em> reasonable from a first glance.  The original code was actually copied from within a collection class&#8217; SearchByName() method when the class was being replaced with a System.Collections.Generic.List.  This is scary for a couple of reasons.  First of all, original code contains a couple of bugs that weren&#8217;t addressed as part of the migration probably because very little time was given to &#8220;move to .NET 2.0&#8243;. &amp;nbp;Secondly, this probably isn&#8217;t an isolated case.  I suspect that this kind of refactoring is happening in a lot of other projects.  Let&#8217;s look at the code in a little more detail and think about some of the opportunities for improvement.</p>
<p>The first obvious bug is that if two objects exist in the list with the target name, the last one searched that matches is being set as the selected object.  This shouldn&#8217;t simply be handled by adding a &#8220;return&#8221; within the loop to return the first either (which I&#8217;ve seen in &#8220;fixes&#8221; before).  In this case it is probably important to know that more than one object matched the target name.  While seemingly minor, there is no lock statement around the foreach search, meaning that the list could be modified during the search by code in any thread with a reference to the list.  Wouldn&#8217;t it be nice if there were a way to find an item in a list without having to worry about such things?</p>
<p>The System.Collections.Generic.List class provides Find() and FindAll() methods that take a System.Predicate as a parameter.  Most developers I&#8217;ve watched tend to browse this method in Intellisense, think &#8220;Oh my god, I have no idea what this Predicate class is&#8221; and then code a method similar to the one listed above.  However, the System.Predicate generic really isn&#8217;t all that scary and is actually a really elegant solution to the problem.  Look at the following code for a second:</p>
<p>string targetName = &#8220;Thompson&#8221;;</p>
<p>List myObjectList = new List();<br />
&#8230; list is populated with some items &#8230;</p>
<p>List matches = myObjectList.FindAll(delegate(MyObj compare)<br />
{<br />
return compare.Name == targetName;<br />
});</p>
<p>Here, an anonymous method was used as an implementation of System.Predicate to determine whether the comparison of an object&#8217;s name to the target name was true.  That&#8217;s essentially how predicates work, they assert whether a particular predicate is true or not.  In this case, we are using them to determine whether or not a particular item in a collection matches certain search criteria.  The way that the FindAll() method works is to pass each object in the collection to the specified predicate and add the object to a <em>match</em> list if the predicate is true.  In the one call to FindAll() our code was able to determine all items in the list that have the specified target name.  Also, the Find() and FindAll() method correctly issue a lock statement upon the list to protect the search, as well as other finery around error handling for null objects in the list.  All of this code for free in a single method call.</p>
<p>Anonymous delegates do not have to be used for predicates, although they present the most graceful solution for a parameterized search.  What I mean by this is that if your search does not rely upon a parameter like <em>targetName</em> in the example above, you could pass a delagate implementation to the find method.  The example below shows how a predicate can be used to find items in the list with a name longer than 5 characters:</p>
<p>List myObjectList = new List();<br />
&#8230; list is populated with some items &#8230;</p>
<p>List matches = myObjectList.FindAll(ObjNameLongEnough);</p>
<p>The method ObjNameLongEnough is defined as follows:</p>
<p>private bool ObjNameLongEnough(MyObj compare)<br />
{<br />
return compare.Name.Length &gt; 5;<br />
}</p>
<p>This example gives a better idea of how the anonymous method delegate is working by showing the signature of the System.Predicate that is expected.  Notice that the method signature of ObjNameLongEnough() takes a MyObj parameter.  The FindAll() method simply calls this delegate for each item in the list and adds the object to the match collection if the predicate returns true.  If the desired behavior was to find only the first match in the list, use the Find() method instead.</p>
<p>Astute readers are probably wondering if there is an overloaded version of System.Predicate that takes an additional search parameter.  This would have allowed for the first example that compared to target name to be coded as an actual delegate as opposed to an anonymous method by passing the targetName variable into the search delegate.  However, unfortunately, there is not an overloaded version.  This appears to stem from the computer science root that a predicate is simply a test that something is true of something.  Therefore a predicate cannot be parameterized as it would be testing its trueness(TM) to something in relation to something else.</p>
<p>IMHO anonymous methods are still a great solution to the problem and provide compact, readable code for searching generic list collections without having to worry about the finer points of locking, object null testing, and first match versus all matches.  Enjoy!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/stuartthompsontech.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/stuartthompsontech.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stuartthompsontech.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stuartthompsontech.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stuartthompsontech.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stuartthompsontech.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stuartthompsontech.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stuartthompsontech.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stuartthompsontech.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stuartthompsontech.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stuartthompsontech.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stuartthompsontech.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stuartthompsontech.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stuartthompsontech.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stuartthompsontech.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stuartthompsontech.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stuartthompsontech.wordpress.com&amp;blog=4977974&amp;post=38&amp;subd=stuartthompsontech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stuartthompsontech.wordpress.com/2007/08/07/using-anonymous-method-predicates-to-search-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5c5a46115322ba7acbb5f7a357d79676?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">stuartthompson</media:title>
		</media:content>
	</item>
	</channel>
</rss>
