<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ryan Lanciaux</title>
	<atom:link href="http://www.ryanlanciaux.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ryanlanciaux.com</link>
	<description>new media mercenary</description>
	<lastBuildDate>Sun, 14 Aug 2011 18:03:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Gherkin style BDD testing in .NET</title>
		<link>http://www.ryanlanciaux.com/2011/08/14/gherkin-style-bdd-testing-in-net/</link>
		<comments>http://www.ryanlanciaux.com/2011/08/14/gherkin-style-bdd-testing-in-net/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 18:03:13 +0000</pubDate>
		<dc:creator>Ryan Lanciaux</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.ryanlanciaux.com/?p=78</guid>
		<description><![CDATA[Behavior Driven Development is something that has interested me forquite awhile. I have constantly tried to write my tests as clear andconcise as possible but once I saw Cucumber for Ruby that became thenew standard for what I was trying &#8230; <a href="http://www.ryanlanciaux.com/2011/08/14/gherkin-style-bdd-testing-in-net/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development" target="_blank">Behavior Driven Development</a> is something that has interested me forquite awhile. I have constantly tried to write my tests as clear andconcise as possible but once I saw <a href="http://cukes.info/" target="_blank">Cucumber for Ruby</a> that became thenew standard for what I was trying to achieve in .NET. This is where<a href="http://specflow.org/" target="_blank">SpecFlow </a>comes in.
<p>&nbsp;</p>
<p>SpecFlow is a BDD library for .NET that aimsto add testing capabilities that are similar to  <a href="http://cukes.info/" target="_blank">Cucumber</a> &#8212; that is,specifications are written in human readable Gherkin Format. From the<a href="http://specflow.org/" target="_blank">project site</a>:&nbsp;</p>
<blockquote><p>	<a href="http://specflow.org/" target="_blank">SpecFlow </a>aims at bridging the communication gap between domain experts	and developers by binding business readable behavior specifications to	the underlying implementation. </p></blockquote>
<p>In theory, I really like that domain experts could write the specifications but I would be interested in seeing how that works out. </p>
<p><strong>So what exactly is this Gherkin format?</strong> </p>
<p>According to the <a href="http://wiki.github.com/aslakhellesoy/cucumber/gherkin" target="_blank">Gherkin project</a> on github, &#39;Gherkin is the language that Cucumber understands. It is a <a href="http://martinfowler.com/bliki/BusinessReadableDSL.html">Business Readable, Domain Specific Language</a> that lets you describe software&rsquo;s behaviour without detailing how that behaviour is implemented.&#39; In other words, its a common DSL for describing the required functionality for a given system.&nbsp;</p>
<p>This functionality is typically broken down by feature and each feature has a number of scenarios. A scenario is made up of 3 steps: GIVEN, WHEN and THEN (which seems to somewhat loosely correspond to Arrange, Act, Assert) and in a simplistic world, looks a little like this:</p>
<blockquote><p>	GIVEN an admin user<br />	WHEN user requests top secret data<br />	THEN return the list of data </p></blockquote>
<p>If you want to learn more about the Gherkin format check out <a href="http://www.engineyard.com/blog/2009/cucumber-introduction/" target="_blank">Engine Yard&#39;s Introduction to BDD with Cucumber by Dave Astels</a>  or <a href="http://wiki.github.com/aslakhellesoy/cucumber/given-when-then" target="_blank">Given-When-Then by Aslak Helles&oslash;y</a>
<p><strong>Quick Synopsis</strong></p>
<p>I&#39;ve recently started to move my blog over to a new server and a new root domain name; this could have an adverse affect on inbound links. In order to make sure this move was successful, I wanted to write an app to perform 301 redirects from the old URL to the new one. </p>
<p>There are a number of <a href="http://www.singingeels.com/Blogs/Nullable/2007/09/14/URL_ReWriting_The_Right_Way_Its_Easy.aspx" target="_blank">examples out there already for performing 301s</a> but I wanted to make sure I was testing the code &#8212; It seemed like a great opportunity to get a little more use out of SpecFlow. </p>
<p><strong>Initial Setup</strong></p>
<ol>
<li><a href="http://specflow.org/getdoc/b647f699-ff30-48db-9bd5-db6dc45016e8/SpecFlowSetup_v1-1-0.aspx" target="_blank">Download and run the SpecFlow installer </a></li>
<li>Create a new Project and add a reference to SpecFlow and NUnit Framework</li>
<li>Add references to your mocking framework (this example is using <a href="http://code.google.com/p/moq/" target="_blank">Moq</a>)</li>
</ol>
<p><strong>On with the code!</strong> </p>
<p>After all the references are sorted out add a SpecFlow feature. </p>
<p><img src="/files/templates.gif" alt="" /></p>
<p>The feature file is where we&#39;re going to define our specifications. I want to make sure that when a request is made to the old root it will get redirect to the new root url. So here is what the feature looks like initially:</p>
<blockquote style="width: 550px"><p>	Feature: Redirection <br />	&nbsp;&nbsp;&nbsp; In order to not upset the google<br />	&nbsp;&nbsp;&nbsp; As a blogger who almost never has the time to blog<br />	&nbsp;&nbsp;&nbsp; I want to redirect my old url to my new one </p>
<p>	Scenario: Redirect root request<br />	&nbsp;&nbsp;&nbsp; Given I have entered a request to http://www.frickinsweet.com/ryanlanciaux.com<br />	&nbsp;&nbsp;&nbsp; And the old url is frickinsweet.com/ryanlanciaux.com<br />	&nbsp;&nbsp;&nbsp; And my new url is ryanlanciaux.com<br />	&nbsp;&nbsp;&nbsp; When the request is made<br />	&nbsp;&nbsp;&nbsp; Then the response url is http://www.ryanlanciaux.com<br />	&nbsp;&nbsp;&nbsp; And the response has a 301 in the status </p></blockquote>
<p>Notice that over in the Solution Explorer window you can expand the feature to reveal a .cs file. <br /><img src="/files/solution_explorer.gif" alt="" /><br />The class is an auto-generated file that updates when the .feature file is changed. We can run this through our test runner to watch it fail and get some extra information as to why it failed. </p>
<p>&nbsp;</p>
<p><img src="/files/test_runner.gif" alt="" /></p>
<p>The tests are failing because there is no real definition to the scenario steps. We can almost directly copy and paste the output from the test runner dialog to a new class and fill in the code for the methods with standard unit testing code. Like I said before, I treat everything that is a GIVEN statement like an arrange section of a standard test; WHEN and THEN like act and assert respectively. </p>
<p>We could hardcode these tests to be specifically run against the urls specified in the scenario but this approach feels brittle and does not encourage code reuse. In order to use these these same steps in our future scenarios we can add wildcard mappings rather than specifying a single url in the attribute definition. The wildcard mapping is the familiar .* surrounded by parenthesis.</p>
<div class="code">
<div style="background-image: none; background-repeat: repeat; background-attachment: scroll; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: white; font-family: 'Courier New'; font-size: 10pt; color: black; background-position: 0% 0%">
<pre style="margin: 0px"><span style="color: #2b91af">&nbsp;&nbsp;&nbsp;24</span>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">Given</span>(<span style="color: #a31515">@&quot;I have entered a request to (.*)&quot;</span>)]</pre>
</div>
<div style="background-image: none; background-repeat: repeat; background-attachment: scroll; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: white; font-family: 'Courier New'; font-size: 10pt; color: black; background-position: 0% 0%">&nbsp;</div>
</div>
<p>Also note now that when we have a wildcard mapping, we can pass in a parameter to that ScenarioStepDefinition</p>
<p>
<div class="code">
<div style="background-image: none; background-repeat: repeat; background-attachment: scroll; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: white; font-family: 'Courier New'; font-size: 10pt; color: black; background-position: 0% 0%">
<pre style="margin: 0px"><span style="color: blue">public</span> <span style="color: blue">void</span> GivenIHaveEnteredARequestToHttpWww_Frickinsweet_ComRyanlanciaux_ComPage2(<span style="color: blue">string</span> url)</pre>
</div>
</div>
<p>The final result is a lot of code but it is broken down into small, reusable sections.
<div class="code">
<div style="background-image: none; background-repeat: repeat; background-attachment: scroll; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: white; font-family: 'Courier New'; font-size: 9pt; color: black; background-position: 0% 0%">
<pre style="margin: 0px">[<span style="color: #2b91af">TestFixture</span>]</pre>
<pre style="margin: 0px">[<span style="color: #2b91af">Binding</span>]</pre>
<pre style="margin: 0px"><span style="color: blue">public</span> <span style="color: blue">class</span> <span style="color: #2b91af">RedirectTest</span></pre>
<pre style="margin: 0px">{</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: blue">string</span> oldUrl;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: blue">string</span> newUrl;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: blue">string</span> requestedUrl;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: blue">string</span> finalUrl;</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: #2b91af">RedirectHandler</span> _handler;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpContextBase</span>&gt; mockContext;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">private</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpResponseBase</span>&gt; mockResponse;</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">Given</span>(<span style="color: #a31515">@&quot;I have entered a request to (.*)&quot;</span>)]</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">void</span> GivenIHaveEnteredARequestToHttpWww_Frickinsweet_ComRyanlanciaux_ComPage2(<span style="color: blue">string</span> url)</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: blue">var</span> uri = <span style="color: blue">new</span> <span style="color: #2b91af">Uri</span>(url);</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; requestedUrl = url;</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mockContext = <span style="color: blue">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpContextBase</span>&gt;();</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mockContext.Setup(x =&gt; x.Request.Url).Returns(uri);</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">Given</span>(<span style="color: #a31515">@&quot;the old url is (.*)&quot;</span>)]</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">void</span> GivenTheOldUrlIsFrickinsweet_ComRyanlanciaux_Com(<span style="color: blue">string</span> url)</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; oldUrl = url;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">Given</span>(<span style="color: #a31515">@&quot;my new url is (.*)&quot;</span>)]</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">void</span> GivenMyNewUrlIsRyanlanciaux_Com(<span style="color: blue">string</span> url)</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; newUrl = url;</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: green">//now that we know both old and new url do a replace on httpcontexts&#39; url</span></pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: green">//setup what we expect the called url to be and throw a callback on the mock so we can verify later</span></pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mockResponse = <span style="color: blue">new</span> <span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">HttpResponseBase</span>&gt;();</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mockResponse.SetupProperty(x =&gt; x.Status);</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mockResponse.Setup(x =&gt; x.AddHeader(<span style="color: #a31515">&quot;Location&quot;</span>, requestedUrl.Replace(oldUrl, newUrl)))</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; .Callback(() =&gt; finalUrl = requestedUrl.Replace(oldUrl, newUrl));</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; mockContext.Setup(x =&gt; x.Response).Returns(mockResponse.Object);</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">When</span>(<span style="color: #a31515">@&quot;the request is made&quot;</span>)]</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">void</span> WhenTheRequestIsMade()</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _handler = <span style="color: blue">new</span> <span style="color: #2b91af">RedirectHandler</span>();</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _handler.ProcessRequest(mockContext.Object, oldUrl, newUrl);</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">Then</span>(<span style="color: #a31515">@&quot;the response has a 301 in the status&quot;</span>)]</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">void</span> ThenTheResponseHasA301InTheStatus()</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #2b91af">Assert</span>.That(mockContext.Object.Response.Status == <span style="color: #a31515">&quot;301 Moved Permanently&quot;</span>);</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">Then</span>(<span style="color: #a31515">@&quot;the response url is (.*)&quot;</span>)]</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">void</span> ThenTheResponseUrlIsTheNewUrl(<span style="color: blue">string</span> expectedUrl)</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #2b91af">Assert</span>.AreEqual(expectedUrl, finalUrl);</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px">&nbsp;</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; [<span style="color: #2b91af">Then</span>(<span style="color: #a31515">@&quot;301 is not in the headers&quot;</span>)]</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; <span style="color: blue">public</span> <span style="color: blue">void</span> Then_301IsNotInTheHeaders()</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; {</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #2b91af">Assert</span>.IsNull(mockResponse.Object.Status);</pre>
<pre style="margin: 0px">&nbsp;&nbsp;&nbsp; }</pre>
<pre style="margin: 0px">}</pre>
</div>
</div>
<p>Since we are using wildcards instead of raw urls in the step definitions we can easily write other tests that will just work with out adding any extra code.</p>
<blockquote style="width: 550px"><p>	Scenario: Redirect to correct path on new url<br />	&nbsp;&nbsp;&nbsp; Given I have entered a request to http://www.frickinsweet.com/ryanlanciaux.com/page2<br />	&nbsp;&nbsp;&nbsp; And the old url is frickinsweet.com/ryanlanciaux.com<br />	&nbsp;&nbsp;&nbsp; And my new url is ryanlanciaux.com<br />	&nbsp;&nbsp;&nbsp; When the request is made<br />	&nbsp;&nbsp;&nbsp; Then the response url is http://www.ryanlanciaux.com/page2<br />	&nbsp;&nbsp;&nbsp; And the response has a 301 in the status 	</p>
</blockquote>
<p>This project, in its entirety, is <a href="http://github.com/ryanlanciaux/Redirect" target="_blank">hosted on GitHub</a>. Check it out if you are interested in seeing SpecFlow in the context of the whole (tiny) application. Make sure that you add all the files from the lib dir into your references the first time you run it or you will receive all kinds of errors &#8212; additionally, I wrote this quickly for myself so there is no real warranty / guarantee that the code is free from defects &#8212; use at your own risk. <img src='http://www.ryanlanciaux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p><a href="http://github.com/ryanlanciaux/Redirect" target="_blank">Download Project from GitHub</a> </p>
<p><a href="http://specflow.org/" target="_blank">Visit the SpecFlow homepage</a>&nbsp;</p>
<p>&nbsp;</p>
<blockquote style="width: 150px"><p>	<strong>Pass it along</strong><br />
<hr />
<div>	<a href="http://www.dotnetkicks.com/kick/?url=http://ryanlanciaux.com/ryanlanciaux/post/Gherkin-style-BDD-testing-in-NET.aspx">	<img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://ryanlanciaux.com/ryanlanciaux/post/Gherkin-style-BDD-testing-in-NET.aspx" border="0" alt="kick it on DotNetKicks.com" />	</a>	</div>
<p>	<script type="text/javascript">	var dzone_url = 'http://ryanlanciaux.com/ryanlanciaux/post/Gherkin-style-BDD-testing-in-NET.aspx';</script>	<script type="text/javascript">	var dzone_title = 'Gherkin style BDD testing in .NET';</script>	<script type="text/javascript">	var dzone_blurb = 'BDD / Specification testing in .NET with the SpecFlow framework. SpecFlow is a BDD library for .NET that aims to add similar functionality as Cucumber to .NET projects';</script>	<script type="text/javascript">	var dzone_style = '1';</script>	<script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js">	</script> 	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	<script src="http://tweetmeme.com/i/scripts/button.js" type="text/javascript">	</script></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2011/08/14/gherkin-style-bdd-testing-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migration in process</title>
		<link>http://www.ryanlanciaux.com/2011/08/13/migration-in-process/</link>
		<comments>http://www.ryanlanciaux.com/2011/08/13/migration-in-process/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 19:46:43 +0000</pubDate>
		<dc:creator>Ryan Lanciaux</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[move]]></category>
		<category><![CDATA[notes]]></category>

		<guid isPermaLink="false">http://www.ryanlanciaux.com/?p=3</guid>
		<description><![CDATA[Currently migrating the site to WordPress &#8212; I am working on getting all the content in right now. There may be some hiccups.]]></description>
			<content:encoded><![CDATA[<p>Currently migrating the site to WordPress &#8212; I am working on getting all the content in right now. There may be some hiccups.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2011/08/13/migration-in-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beginning ASP.NET MVC 1.0 available on Amazon</title>
		<link>http://www.ryanlanciaux.com/2009/08/07/beginning-asp-net-mvc-1-0-available-on-amazon/</link>
		<comments>http://www.ryanlanciaux.com/2009/08/07/beginning-asp-net-mvc-1-0-available-on-amazon/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 07:37:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[c7a3b088-2580-45a2-9dc8-662db971b5e0]]></category>

		<guid isPermaLink="false">/ryanlanciaux/post/Beginning-ASPNET-MVC-10-available-on-Amazon.aspx</guid>
		<description><![CDATA[I know I&#39;ve been quiet for a little bit here but wanted to point out some great news. Simone Chiaretta and Keyvan Nayyeri&#39;s book Beginning ASP.NET MVC 1.0 is available for purchase in the US on Amazon. Both Simone and &#8230; <a href="http://www.ryanlanciaux.com/2009/08/07/beginning-asp-net-mvc-1-0-available-on-amazon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
I know I&#39;ve been quiet for a little bit here but wanted to point out some great news. Simone Chiaretta and Keyvan Nayyeri&#39;s book <a href="http://www.amazon.com/gp/product/047043399X/105-8603807-8434027?ie=UTF8&amp;tag=keyvannayyeri-20&amp;linkCode=xm2&amp;camp=1789&amp;creativeASIN=047043399X" target="_blank">Beginning ASP.NET MVC 1.0 </a>is available for purchase in the US on Amazon. Both Simone and Keyvan have a wealth of knowledge about the framework, so I&#39;m really looking forward to the book. For more information check out
</p>
<ul>
<li><a href="http://codeclimber.net.nz/archive/2009/08/05/beginning-asp.net-mvc-1.0-available-on-amazon.aspx" target="_blank">Simone&#39;s site&nbsp;</a></li>
<li><a href="http://nayyeri.net/blog/beginning-asp-net-mvc-1-0-ndash-finally-available/" target="_blank">Keyvan&#39;s site</a>
	</li>
</ul>
<p>
&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2009/08/07/beginning-asp-net-mvc-1-0-available-on-amazon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Are you a Control Freak?</title>
		<link>http://www.ryanlanciaux.com/2009/03/24/are-you-a-control-freak/</link>
		<comments>http://www.ryanlanciaux.com/2009/03/24/are-you-a-control-freak/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 21:04:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[c7a3b088-2580-45a2-9dc8-662db971b5e0]]></category>

		<guid isPermaLink="false">/ryanlanciaux/post/Are-you-a-Control-Freak.aspx</guid>
		<description><![CDATA[No Controls? Since the very early ASP.NET MVC previews, the most common argument I&#8217;ve heard against using the framework is the lack of user controls. In my opinion, this is a mixed blessing, however, for some, this is a show &#8230; <a href="http://www.ryanlanciaux.com/2009/03/24/are-you-a-control-freak/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>No Controls?</strong><br />
Since the very early ASP.NET MVC previews, the<br />
most common argument I&#8217;ve heard against using the framework is the lack<br />
of user controls. In my opinion, this is a mixed blessing, however, for<br />
some, this is a show stopper. What can you do to provide a rich user<br />
interface with the MVC framework, while not reinventing the wheel?</p>
<p><strong>jQuery</strong><br />
Now<br />
you could go ahead and program a full fledged data grid or WYSIWYG<br />
editor, however, unless you have a bit of time to spare this is not the<br />
ideal solution. As most may realize, jQuery fits very nicely to fill in<br />
the gaps left by the absence of user controls. For the most part, the<br />
controls are not going to let you just drag-and-drop, type in a dataset<br />
and profit but a lot of the pain is kept to a minimum.</p>
<p><strong>Examples</strong><br />
<a id="k9ve" title="Ingrid" href="http://www.reconstrukt.com/ingrid/">Ingrid</a><br />
<img src="/files/ingrid.gif" alt="" /><br />
If<br />
you&#8217;re looking for a data grid there are a number of options available<br />
pictured above is Ingrid. <strong>Flexigrid </strong>is another good one that people<br />
have <a id="zc7x" title="used with the MVC framework" href="http://www.codeproject.com/KB/aspnet/MVCFlexigrid.aspx">used with the MVC framework</a>, however, <em>their site appears to be down</em> at the moment.<br />
<a href="http://bassistance.de/jquery-plugins/jquery-plugin-treeview/" target="_blank">Treeviews</a> are available</p>
<p><img src="/files/treeview.gif" alt="" /></p>
<p><a href="http://code.google.com/p/jquery-checkbox/" target="_blank">Radio Buttons / Check Boxes<br />
</a></p>
<p><img src="/files/check_box.gif" alt="" /></p>
<p><a href="http://plugins.jquery.com/" target="_blank">Check out the jQuery plugin database</a>.</p>
<p><strong>Getting Started<br />
</strong>So,<br />
if you&#8217;ve decided you want to look more into using jQuery plugins &#8212; a<br />
couple of tips that may make the transition a little easier:</p>
<ul>
<li>Obviously,<br />
familiarize yourself with jQuery. Some of the plugins will work with<br />
almost 0 configuration but it&#8217;s much better to actually know what&#8217;s<br />
going on. <a href="http://www.smashingmagazine.com/2008/09/16/jquery-examples-and-best-practices/" target="_blank">View more info on getting started with jQuery</a></li>
</ul>
<ul>
<li>The <a href="http://nayyeri.net/blog/using-jsonresult-in-asp-net-mvc-ajax/" target="_blank">JsonResult</a> is your friend &#8212; <a href="http://www.dev102.com/2008/08/19/jquery-and-the-aspnet-mvc-framework/" target="_blank">learn it well</a>.</li>
</ul>
<ul>
<li>Read up on what people using different languages are doing. I&#8217;m<br />
not saying that you should necessarily go out and learn Rails or<br />
CakePHP/CodeIgniter (although, it is beneficial). but at least look at the<br />
techniques that programmers from that realm of things are doing &#8212; see how they are implementing their controls.</li>
</ul>
<p>What tips do you have for creating robust user interfaces with the MVC framework?</p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http://frickinsweet.com/ryanlanciaux.com/post/Are-you-a-Control-Freak.aspx"><br />
<img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://frickinsweet.com/ryanlanciaux.com/post/Are-you-a-Control-Freak.aspx" alt="kick it on DotNetKicks.com" border="0" /><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2009/03/24/are-you-a-control-freak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Findlay .NET UserGroup Recap</title>
		<link>http://www.ryanlanciaux.com/2009/01/27/findlay-net-usergroup-recap/</link>
		<comments>http://www.ryanlanciaux.com/2009/01/27/findlay-net-usergroup-recap/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 20:48:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[c7a3b088-2580-45a2-9dc8-662db971b5e0]]></category>

		<guid isPermaLink="false">/ryanlanciaux/post/Findlay-NET-UserGroup-Recap.aspx</guid>
		<description><![CDATA[I had a great time tonight at the Findlay .NET User group! Thanks everyone that battled the weather to come out and hear me talk about the ASP.NET MVC Framework. As promised, I have posted the route constraint to allow &#8230; <a href="http://www.ryanlanciaux.com/2009/01/27/findlay-net-usergroup-recap/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
I had a great time tonight at the Findlay .NET User group! Thanks everyone that battled the weather to come out and hear me talk about the ASP.NET MVC Framework. As promised, I have posted the route constraint to allow only alphabetical values to be accepted as valid input for the display named message.
</p>
<div style="background: #383838 none repeat scroll 0% 0%; font-family: Monaco; font-size: 10pt; color: #cfcfcf; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
<p style="margin: 0px">
&nbsp;<br />
routes.MapRoute(<span style="color: #fe2f93">&quot;Message&quot;</span>,
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #fe2f93">&quot;Message/{action}/name/{Name}/&quot;</span>,
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">new</span> { controller = <span style="color: #fe2f93">&quot;Message&quot;</span>, action = <span style="color: #fe2f93">&quot;HelloWorld&quot;</span>, name = <span style="color: #fe2f93">&quot;&quot;</span> },
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">new</span> {name=<span style="color: #fe2f93">&quot;[a-zA-Z]+&quot;</span>}
</p>
<p style="margin: 0px">
&nbsp; );
</p>
</div>
<p>
I apologize about the lapse in memory &#8212; The regular expression needed a + at the end to signify that it was more than one character whoops <img src='http://www.ryanlanciaux.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> &nbsp; For more information on Routes check out <a href="http://www.codethinked.com/post/2008/08/20/Exploring-SystemWebRouting.aspx" target="_blank">Justin Etheredge&#39;s post on routing</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2009/01/27/findlay-net-usergroup-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC Framework Talk : Findlay .NET User Group</title>
		<link>http://www.ryanlanciaux.com/2009/01/23/mvc-framework-talk-findlay-net-user-group/</link>
		<comments>http://www.ryanlanciaux.com/2009/01/23/mvc-framework-talk-findlay-net-user-group/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 07:58:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[0164664c-d7ab-4807-a8ff-1ea60dc19869]]></category>
		<category><![CDATA[c7a3b088-2580-45a2-9dc8-662db971b5e0]]></category>

		<guid isPermaLink="false">/ryanlanciaux/post/MVC-Framework-Talk-Findlay-NET-User-Group.aspx</guid>
		<description><![CDATA[I will be giving a talk on the ASP.NET MVC Framework at the Findlay .NET User Group on Tuesday, January 27th (5:30pm &#8211; 7:30pm). If you&#39;re in NW Ohio and want to learn more about the MVC framework and how &#8230; <a href="http://www.ryanlanciaux.com/2009/01/23/mvc-framework-talk-findlay-net-user-group/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I will be giving a talk on the ASP.NET MVC Framework at the <a href="http://www.fanug.org" target="_blank">Findlay .NET User Group </a>on Tuesday, January 27th (5:30pm &#8211; 7:30pm). If you&#39;re in NW Ohio and want to learn more about the MVC framework and how to get up and running with it you might be interested. The talk is taking place at the Marathon building downtown &#8212; 539 S. Main St., Findlay, OH &#8211; Room 106M. More information is available at the <a href="http://www.fanug.org" target="_blank">User Group site</a>. Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2009/01/23/mvc-framework-talk-findlay-net-user-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do you suffer from this condition?</title>
		<link>http://www.ryanlanciaux.com/2008/12/17/do-you-suffer-from-this-condition/</link>
		<comments>http://www.ryanlanciaux.com/2008/12/17/do-you-suffer-from-this-condition/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 12:40:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[c7a3b088-2580-45a2-9dc8-662db971b5e0]]></category>

		<guid isPermaLink="false">/ryanlanciaux/post/Do-you-have-this-condition.aspx</guid>
		<description><![CDATA[Oxitis [oks - ahy - tis] -Noun Acute or chronic anxiety toward sharing code online; this anxiety is usually caused by fear of public ridicule or excessive criticism regarding imperfections in code. Origin:&#160; 2008, Josh Schwartzberg (n.); Oxitephobia; avoidance of &#8230; <a href="http://www.ryanlanciaux.com/2008/12/17/do-you-suffer-from-this-condition/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<blockquote>
<p>
	<strong>Oxitis</strong> [oks - ahy - tis]<br />
	<em>-Noun</em>
	</p>
<p>
	Acute or chronic anxiety toward sharing code online; this anxiety is usually caused by fear of public ridicule or excessive criticism regarding imperfections in code.
	</p>
<p style="color: #777777">
	Origin:&nbsp; <br />
	2008, <a href="http://weblogs.asp.net/dotjosh/default.aspx" target="_blank">Josh Schwartzberg</a> (n.); <a href="http://weblogs.asp.net/dotjosh/archive/2008/12/15/mvc-jquery-meets-x-mas-music-project.aspx" target="_blank">Oxitephobia</a>; avoidance of placing imperfect code online; initially referring to <a href="http://www.codeplex.com/oxite" target="_blank">Microsoft Oxite</a>
	</p>
<p>
</p></blockquote>
<p>
<a href="http://www.dotnetkicks.com/kick/?url=http://frickinsweet.com/ryanlanciaux.com/post/Do-you-have-this-condition.aspx"><br />
<img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://frickinsweet.com/ryanlanciaux.com/post/Do-you-have-this-condition.aspx" border="0" alt="kick it on DotNetKicks.com" /><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2008/12/17/do-you-suffer-from-this-condition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Constitutes Ethical SEO?</title>
		<link>http://www.ryanlanciaux.com/2008/12/12/what-constitutes-ethical-seo/</link>
		<comments>http://www.ryanlanciaux.com/2008/12/12/what-constitutes-ethical-seo/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 00:45:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[c7a3b088-2580-45a2-9dc8-662db971b5e0]]></category>

		<guid isPermaLink="false">/ryanlanciaux/post/What-Constitutes-Ethical-SEO.aspx</guid>
		<description><![CDATA[&#34;nice post!!thanks for the info..that&#39;s great and cool&#34; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; -Random Spammer As a web developer / someone who has a blog, I understand dealing with spam is one of the &#8230; <a href="http://www.ryanlanciaux.com/2008/12/12/what-constitutes-ethical-seo/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<blockquote><p>
	<em>&quot;nice post!!thanks for the info..that&#39;s great and cool&quot;<br />
	&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -Random Spammer</em>
</p></blockquote>
<p>
As<br />
a web developer / someone who has a blog, I understand dealing with<br />
spam is one of the necessary evils of having a comments enabled on my<br />
site. For the most part, my site has remained far enough under the<br />
radar that most spammers do not waste their time. More recently,<br />
however, there has been a gradual influx of comment spam with a title<br />
something along the lines of &quot;[Company Name] SEO Test.&quot; There is worse<br />
spam for sure but it was definitely annoying. </p>
<p>A quick Google<br />
search pointed me to a Web Development and Search Engine Optimization<br />
company hosting an SEO competition. I checked the rules and sure enough,<br />
there was a rule stating that only Ethical SEO Techniques would be<br />
permitted. Quickly, I emailed the organization one of the comments<br />
(with url, ip, email, etc) exepecting the offending parties would be<br />
removed from the competition, eliminating additional garbage comments.<br />
I was shocked to receive their reply.</p>
<blockquote><p>
	<em>Unfortunately<br />
	this is not against the rules of the competition &ndash; I would encourage<br />
	you to remove the spamming links for your website to discourage this<br />
	behaviour but as I said I can&rsquo;t actually penalise this person<br />
	for making posts on other peoples websites.</em></p>
<p>	<em>Sorry about the spam.</em>
</p></blockquote>
<p><strong>Gaming the System</strong><br />
In<br />
my opinion, Search Engine Optimization should be about perfecting a<br />
website and the website&#39;s content; not tricking google into thinking<br />
more people find your content useful than actuality. <a href="http://www.youngentrepreneur.com/blog/2008/12/11/seo-advice-josh-can-help/" target="_blank">Optimizing tags<br />
and titles</a> is one thing but gaming the system to garner search ranking is wrong<br />
and is detrimental to the web as a whole. Just because commenting is<br />
legal and allowable does not make it ethical. Unfortunately, this<br />
practice will continue to exist as long as it gets results and<br />
organizations act as enablers to those who would use these tactics for<br />
financial gain (not to mention increased search engine ranking for the<br />
enabling organizations). </p>
<p><strong>Link Spam is Digital Graffiti</strong></p>
<div style="float: right">
<img src="/files/spra-paint.jpg" alt="" />
</div>
<p>Imagine<br />
for a second if companies condoned this practice outside of the Web &#8211;<br />
what if McDonalds or Nike paid for their logos to be spray painted on<br />
other&#39;s property? To make matters worse what if after receiving<br />
numerous complaints they held a press conference and said &quot;soap and<br />
water removes the paint&quot; or &quot;just hire some guards and the problem will<br />
go away.&quot;? I think it&#39;s safe to assume that practice would not be<br />
received so kindly (h/t <a href="http://www.codehinting.com" target="_blank">Matt Braun</a> on the graffiti analogy)!<br />
Fortunately a link is not as hard to remove as paint but the concept is<br />
similar. </p>
<p><strong>Solutions anyone?</strong><br />
Social networks such as<br />
<a href="http://www.digg.com" target="_blank">Digg</a>, <a href="http://www.dotnetkicks.com" target="_blank">DotNetKicks </a>and <a href="http://www.dzone.com" target="_blank">DZone </a>have always been plagued by those who would<br />
try to circumvent the rules for personal gain. Where honeypots and<br />
captcha systems would traditionally help against<br />
bots, an increasing number of spammers seem to be actual people. The<br />
administrators of these social networks are constantly coming up with<br />
more sophisticated ways to combat spam but what should small blogs and<br />
websites do?</p>
<p>Currently,<br />
there are a number of methodologies for preventing blog spam that work<br />
with varying degrees of effectiveness but none are ideal. Obviously,<br />
you can moderate comments &#8212; this works okay but is painful if you are<br />
getting a lot of spam or a lot of comments. Also, make sure your<br />
comment links have a rel=&quot;nofollow&quot; attribute (h/t <a href="http://codeclimber.net.nz" target="_blank">Simone Chiaretta</a>). Google<br />
does not take nofollow links into account when calculating page rank.<br />
Although this does not reward the spammer, it does not prevent spam. </p>
<p>What I would like to see is a centralized comment system like Disqus or<br />
IntenseDebate that lets a user login with OpenID, Google Friend<br />
Connect, Microsoft LiveID, Facebook Connect (whichever the user wants).<br />
There would be a standard vote up / down vote for every comment a user<br />
makes where the overall votes across all sites would determine the<br />
users rating. Casting a down vote would remove a minimal amount of<br />
points from the voter to prevent someone from going on a down vote<br />
rampage (exactly how <a href="http://www.stackoverflow.com" target="_blank">StackOverflow </a>works). Site owners could set<br />
restrictions that would prevent users with a rating less than a<br />
specified number from posting on their site. This may be idealistic and<br />
introduce a new realm of privacy concerns but if done properly, I think it<br />
would help eliminate a great deal of spam.</p>
<p><strong>Wrapping things up<br />
</strong>Although there are many less-than ethical tactics to increasing a<br />
site&#39;s ranking, site structure and site content are the best methods of<br />
SEO. I would love to hear your thoughts, ideas and any suggestions you<br />
have in eliminating link spam.<br />
</p>
<blockquote><p>
	If you liked this post&#8230;</p>
<table border="0" cellspacing="10">
<tbody>
<tr>
<td valign="top">
<table border="0">
<tbody>
<tr>
<td>
							<a href="http://www.dotnetkicks.com/kick/?url=http://frickinsweet.com/ryanlanciaux.com/post/What-Constitutes-Ethical-SEO.aspx"><br />
							<img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://frickinsweet.com/ryanlanciaux.com/post/What-Constitutes-Ethical-SEO.aspx" border="0" alt="kick it on DotNetKicks.com" /><br />
							</a></td>
</tr>
<tr>
<td>
							<script type="text/javascript">
							var dzone_url = 'http://frickinsweet.com/ryanlanciaux.com/post/What-Constitutes-Ethical-SEO.aspx';</script><br />
							<script type="text/javascript">
							var dzone_title = 'What Constitutes Ethical SEO?';</script><br />
							<script type="text/javascript">
							var dzone_blurb = '';</script><br />
							<script type="text/javascript">
							var dzone_style = '2';</script><br />
							<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js">
							</script><br />
							
							</td>
</tr>
<tr>
<td><a href="http://feeds.feedburner.com/RyanLanciaux">Subscribe via RSS</a></td>
</tr>
</tbody>
</table>
</td>
<td>
				<script src="http://digg.com/tools/diggthis.js" type="text/javascript">
				</script> 
				</td>
</tr>
</tbody>
</table>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2008/12/12/what-constitutes-ethical-seo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC HtmlHelper for Gravatar</title>
		<link>http://www.ryanlanciaux.com/2008/11/13/mvc-htmlhelper-for-gravatar/</link>
		<comments>http://www.ryanlanciaux.com/2008/11/13/mvc-htmlhelper-for-gravatar/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 22:44:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[c7a3b088-2580-45a2-9dc8-662db971b5e0]]></category>

		<guid isPermaLink="false">/ryanlanciaux/post/MVC-HtmlHelper-for-Gravatar.aspx</guid>
		<description><![CDATA[Based on a great suggestion from Ben Scheirman and Simone Chiaretta I have converted the Gravatar URL helper class into a HtmlHelper extension method. This was my first stab at making a HtmlHelper extension but it seems to be working &#8230; <a href="http://www.ryanlanciaux.com/2008/11/13/mvc-htmlhelper-for-gravatar/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
Based on a great suggestion from <a href="http://flux88.com/" target="_blank">Ben Scheirman</a> and <a href="http://www.codeclimber.net.nz" target="_blank">Simone Chiaretta</a> I have converted the <a href="/ryanlanciaux.com/post/Gravatar-on-ASPNET-MVC.aspx" target="_blank">Gravatar URL helper class</a> into a HtmlHelper extension method. This was my first stab at making a HtmlHelper extension but it seems to be working nicely and helps me keep my code a lot cleaner. Instead saving the URL (which I would highly advise against) or doing some weird method calling acrobatics in the Controller, I can simply say &lt;%= Html.Gravatar(&quot;email@email.com&quot;) %&gt; inside the view.
</p>
<p>
I&#39;ve added a couple different method definitions for various parameters. You can pass in just an e-mail address, an e-mail and gravatar parameters (<a href="http://en.gravatar.com/site/implement/url" target="_blank">see here for more info on gravatar parameters</a>) or an e-mail address, gravatar parameters and html attributes. A quick usage summary is listed below (I&#39;m using my <a href="http://www.frickinsweet.com/joelroxor" target="_blank">brother Joel&#39;s</a> gravatar in the examples)
</p>
<p></p>
<table border="0" cellspacing="0" cellpadding="0" style="border: 1px dashed #999999">
<tbody>
<tr style="background-color: #efefef">
<td valign="top">
<p>
			<strong>&lt;%= Html.Gravatar(&quot;email@email.com&quot;) %&gt;<br />
			</strong>
			</p>
<p>
			Base Gravatar Helper&nbsp;
			</p>
</td>
<td valign="top">&nbsp;<img src="/files/default-image.gif" alt="" /></td>
</tr>
<tr style="background-color: #dddddd">
<td valign="top">
<p>
			<strong>&lt;%= Html.Gravatar(&quot;email@email.com&quot;, new&nbsp; { s = &quot;128&quot;, r = &quot;pg&quot; })%&gt;</strong><em><br />
			</em>
			</p>
<p>
			Gravatar helper with optional <a href="http://en.gravatar.com/site/implement/url" target="_blank">Gravatar Parameters</a>
			</p>
</td>
<td valign="top">&nbsp;<img src="/files/gravatar-params-image.gif" alt="" /></td>
</tr>
<tr style="background-color: #efefef">
<td valign="top">
<p>
			<strong><br />
			&lt;%= Html.Gravatar(&quot;email@email.com&quot;, null, new&nbsp; { style = &quot;border:5px solid&quot; })%&gt;&nbsp;&nbsp;<br />
			</strong>
			</p>
<p>
			Helper with HTML attributes. Please note, this is still expecting the Gravatar parameters &#8212; you can pass in null if you want to just grab the default image with no additional properties.
			</p>
</td>
<td valign="top">&nbsp;<img src="/files/html-params-image.gif" alt="" /></td>
</tr>
<tr style="background-color: #dddddd">
<td valign="top">
<p>
			<strong><br />
			&lt;%= Html.Gravatar(&quot;email@email.com&quot;, new { s = &quot;128&quot;, r = &quot;pg&quot; }, new { style=&quot;border:5px solid;&quot;})%&gt;<br />
			</strong>
			</p>
<p>
			Helper with both Gravatar parameters and HTML attributes
			</p>
</td>
<td valign="top">&nbsp;<img src="/files/all-image.gif" alt="" /></td>
</tr>
</tbody>
</table>
<p>
Anyways, I&#39;ve posted the class file below. Hopefully you find it useful &#8212; I would love to hear what your thoughts are or of any changes you would like to see. <br />
<a rel="enclosure" href="/files/GravatarHelper.cs">GravatarHelper.cs (2.72 kb)</a></p>
<div style="float: left">
<a href="http://www.dotnetkicks.com/kick/?url=http://frickinsweet.com/ryanlanciaux.com/post/MVC-HtmlHelper-for-Gravatar.aspx"><br />
<img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://frickinsweet.com/ryanlanciaux.com/post/MVC-HtmlHelper-for-Gravatar.aspx" border="0" alt="kick it on DotNetKicks.com" /><br />
</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2008/11/13/mvc-htmlhelper-for-gravatar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gravatar on ASP.NET MVC</title>
		<link>http://www.ryanlanciaux.com/2008/11/09/gravatar-on-asp-net-mvc/</link>
		<comments>http://www.ryanlanciaux.com/2008/11/09/gravatar-on-asp-net-mvc/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 11:56:00 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[c7a3b088-2580-45a2-9dc8-662db971b5e0]]></category>

		<guid isPermaLink="false">/ryanlanciaux/post/Gravatar-on-ASPNET-MVC.aspx</guid>
		<description><![CDATA[UPDATE: See here In the near future, I have a web project coming out that I&#39;ve been working on for the past month or so. I&#39;m not going to give too much detail on that just yet, however, in working &#8230; <a href="http://www.ryanlanciaux.com/2008/11/09/gravatar-on-asp-net-mvc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
<strong>UPDATE:</strong> <a href="/ryanlanciaux.com/post/MVC-HtmlHelper-for-Gravatar.aspx">See here </a>
</p>
<p>
In the near future, I have a web project coming out that I&#39;ve been working on for the past month or so. I&#39;m not going to give too much detail on that just yet, however, in working on this project, I had to come up with a way for users to have profile images. I would rather not host these images on my server, I decided to leverage <a href="http://en.gravatar.com/" target="_blank">Gravatar </a>(Globally Recognized Avatars).
</p>
<p>
There are a couple <a href="http://www.freshclickmedia.com/blog/2008/02/gravatar-aspnet-control/" target="_blank">pre-existing options</a> for dealing with gravatar in the .NET framework, however, I&#39;m using the MVC framework &#8212; standard ASP.NET controls are out of the question. After a brief look on the <a href="http://en.gravatar.com/" target="_blank">Gravatar</a> site (specifically the page dealing with <a href="http://en.gravatar.com/site/implement/url" target="_blank">how the URL is constructed</a>), it seemed like this would be a pretty easy task to write a class that I could use to get gravatar image paths. Below is the main part of the class I created to retrieve gravatar information based on an e-mail address:
</p>
<p></p>
<div style="background: #383838 none repeat scroll 0% 0%; line-height: 11px; font-family: Monaco; font-size: 9pt; color: #cfcfcf; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">public</span> <span style="color: #c3fe2f">static</span> <span style="color: #c3fe2f">string</span> GetGravatarURL(<span style="color: #c3fe2f">string</span> email, <span style="color: #c3fe2f">string</span> size)
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">return</span> (<span style="color: #c3fe2f">string</span>.Format(<span style="color: #fe2f93">&quot;http://www.gravatar.com/avatar/{0}?s={1}&amp;r=PG&quot;</span>,
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EncryptMD5(email), size));
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
</p>
<p style="margin: 0px">
&nbsp;
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">public</span> <span style="color: #c3fe2f">static</span> <span style="color: #c3fe2f">string</span> GetGravatarURL(<span style="color: #c3fe2f">string</span> email, <span style="color: #c3fe2f">string</span> size, <span style="color: #c3fe2f">string</span> defaultImagePath)
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">return</span> GetGravatarURL(email, size) +&nbsp; <span style="color: #c3fe2f">string</span>.Format(<span style="color: #fe2f93">&quot;&amp;default={0}&quot;</span>, defaultImagePath);
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
</p>
<p style="margin: 0px">
&nbsp;
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">private</span> <span style="color: #c3fe2f">static</span> <span style="color: #c3fe2f">string</span> EncryptMD5(<span style="color: #c3fe2f">string</span> Value)
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.Security.Cryptography.<span style="color: #4e55df">MD5CryptoServiceProvider</span> md5 = <span style="color: #c3fe2f">new</span> <span style="color: #4e55df">MD5CryptoServiceProvider</span>();
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">byte</span>[] valueArray = System.Text.<span style="color: #4e55df">Encoding</span>.ASCII.GetBytes(Value);
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; valueArray = md5.ComputeHash(valueArray);
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">string</span> encrypted = <span style="color: #fe2f93">&quot;&quot;</span>;
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">for</span> (<span style="color: #c3fe2f">int</span> i = <span style="color: #fe2fdf">0</span>; i &lt; valueArray.Length; i++)
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; encrypted += valueArray[i].ToString(<span style="color: #fe2f93">&quot;x2&quot;</span>).ToLower();
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #c3fe2f">return</span> encrypted;
</p>
<p style="margin: 0px">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }
</p>
</div>
<p>
<br />
All we&#39;re really doing is creating a URL based on the Gravatar path, an MD5 encrypted version of an e-mail address and some user specified parameters. For the methods, Size is how many pixels the image should be (up to 500) and defaultImagePath is the url to use as an alternate image if the user does not have a Gravatar image. There is a rating parameter also but for my site, I&#39;m setting it to PG always.</p>
<p>This is not all that difficult but hopefully useful. I plan to continue writing examples as I make progress on the web application I mentioned.
</p>
<p></p>
<div style="float: left; position: relative; padding-right: 1px">
<a href="http://www.dotnetkicks.com/kick/?url=http://frickinsweet.com/ryanlanciaux.com/post/Gravatar-on-ASPNET-MVC.aspx"><br />
<img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://frickinsweet.com/ryanlanciaux.com/post/Gravatar-on-ASPNET-MVC.aspx" border="0" alt="kick it on DotNetKicks.com" /><br />
</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ryanlanciaux.com/2008/11/09/gravatar-on-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

