<?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>Noah Blumenthal&#039;s Blog</title>
	<atom:link href="http://noahblu.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://noahblu.wordpress.com</link>
	<description>.NET and other development stuff</description>
	<lastBuildDate>Sun, 25 Oct 2009 01:01:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='noahblu.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Noah Blumenthal&#039;s Blog</title>
		<link>http://noahblu.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://noahblu.wordpress.com/osd.xml" title="Noah Blumenthal&#039;s Blog" />
	<atom:link rel='hub' href='http://noahblu.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Blog moved</title>
		<link>http://noahblu.wordpress.com/2009/10/25/blog-moved/</link>
		<comments>http://noahblu.wordpress.com/2009/10/25/blog-moved/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 01:01:16 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/?p=133</guid>
		<description><![CDATA[Head over to http://www.statichippo.com for the new blog.  I&#8217;m not sure how long I&#8217;ll keep this one up, so update your bookmarks!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=133&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Head over to <a href="http://www.statichippo.com">http://www.statichippo.com</a> for the new blog.  I&#8217;m not sure how long I&#8217;ll keep this one up, so update your bookmarks!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=133&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/10/25/blog-moved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>When (not) to use volatile</title>
		<link>http://noahblu.wordpress.com/2009/09/25/when-not-to-use-volatile/</link>
		<comments>http://noahblu.wordpress.com/2009/09/25/when-not-to-use-volatile/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 16:07:50 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/2009/09/25/when-not-to-use-volatile/</guid>
		<description><![CDATA[I was banging my head against a wall when I found this post by Jerome Laban about the volatile keyword.&#160; I made the mistake of thinking that volatile would be sufficient in this situation: 1: private volatile int _counter = 0; 2: ... 3: private void SomeMethodThatIsCalledByMultipleThreads() 4: { 5: _counter++; 6: } and I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=130&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was banging my head against a wall when I found <a href="http://www.jaylee.org/post/2004/08/Dont-get-C-volatile-the-wrong-way.aspx">this post</a> by Jerome Laban about the <em>volatile</em> keyword.&#160; I made the mistake of thinking that volatile would be sufficient in this situation:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">volatile</span> <span style="color:#0000ff;">int</span> _counter = 0;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> ...</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> SomeMethodThatIsCalledByMultipleThreads()</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     _counter++;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>and I was surprised when some of my unit tests were not running correctly (on a side note, I usually unit test multi-threading issues by issuing a command 100 or 1000 times.&#160; I’m interested in hearing how you test that kind of stuff).</p>
<p>Turns out that if I thought about it a little more I would have realized that this won’t do what you (might) expect.&#160; You see the volatile keyword just tells the system never to cache this variable – that’s especially important in multi-processor systems (and who doesn’t have at least 2 cores nowadays?) where each processor might have a different cache of the variable value.</p>
<p>So by using the <em>volatile</em> keyword you’re telling the processor to always get the latest version of the variable from memory.&#160; So why is the above code not thread safe?</p>
<p>Well, remember that the incrementing a variable is a multi-step process:</p>
<ol>
<li>load variable into a register</li>
<li>increment</li>
<li>save back from the register</li>
</ol>
<p>Now the thread might pause at any point in this process!&#160; What happens if Thread A does step 1 and then gets paused, then Thread 2 does step 1?&#160; After both threads run, _counter will only have incremented by 1!&#160; So even though you’re always reading the current value, your increment isn’t thread safe.</p>
<p>So this is where you say “hey – I don’t really need the volatile keyword here.&#160; I need a lock instead”.&#160; And you’d be right:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">volatile</span> <span style="color:#0000ff;">int</span> _counter = 0;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">object</span> _myLocker = <span style="color:#0000ff;">new</span> <span style="color:#0000ff;">object</span>();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> ...</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> SomeMethodThatIsCalledByMultipleThreads()</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     <span style="color:#0000ff;">lock</span>(_myLocker)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span>         _counter++;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span> }</pre>
<p><!--CRLF--></div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/130/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=130&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/09/25/when-not-to-use-volatile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>When Rexex is EVIL (or how to lock up an app/server with simple regex)</title>
		<link>http://noahblu.wordpress.com/2009/09/17/when-rexex-is-evil-or-how-to-lock-up-an-appserver-with-simple-regex/</link>
		<comments>http://noahblu.wordpress.com/2009/09/17/when-rexex-is-evil-or-how-to-lock-up-an-appserver-with-simple-regex/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 14:05:32 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/?p=128</guid>
		<description><![CDATA[Terrific powerpoint on ReDoS over here It is believed that Regex performance is fast, but the truth is that the Regex worst case is exponential.  In this presentation we will show how an attacker can easily exploit the Regex worst case and cause an application DoS.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=128&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Terrific powerpoint on ReDoS over <a href="http://www.checkmarx.com/Upload/Documents/PDF/Checkmarx_OWASP_IL_2009_ReDoS.pdf">here</a></p>
<blockquote>
<p dir="ltr"><span><span style="font-size:small;">It is believed that Regex performance is fast, but the  truth is that the Regex worst case is exponential.  In this presentation we will  show how an attacker can easily exploit the Regex worst case and cause an  application DoS.</span></span></p>
</blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/128/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/128/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/128/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=128&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/09/17/when-rexex-is-evil-or-how-to-lock-up-an-appserver-with-simple-regex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>Rendering ViewPage to random stream (or not)</title>
		<link>http://noahblu.wordpress.com/2009/09/16/rendering-viewpage-to-random-stream-or-not/</link>
		<comments>http://noahblu.wordpress.com/2009/09/16/rendering-viewpage-to-random-stream-or-not/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 15:09:36 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/?p=124</guid>
		<description><![CDATA[I had this crazy idea. My company has some Response Filters that replace tokens in the outputted HTML into some other data.&#160; Now that we&#8217;re moving over to MVC I figured hey &#8212; maybe I can do a better job with these.&#160; You see, these Filters have inline HTML &#8212; that is, they use a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=124&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had this crazy idea.</p>
<p>My company has some Response Filters that replace tokens in the outputted HTML into some other data.&#160; Now that we&#8217;re moving over to MVC I figured hey &#8212; maybe I can do a better job with these.&#160; You see, these Filters have inline HTML &#8212; that is, they use a StringBuilder to create the necessary HTML to replace the token.&#160; That&#8217;s no fun &#8212; first of all it&#8217;s not too pretty, but also, what happens when the designer wants to make a change?</p>
<p>My crazy idea was to call an Action from within the Filter.&#160; I figured this would have a couple benefits:</p>
<ol>
<li>Decouple UI from the data (that&#8217;s what MVC&#8217;s all about right?) </li>
<li>Provide 1 stop for this information (so now the same method can be called from within the web app, without the need for a token, and the same method will be called from the filter to replace the token) </li>
</ol>
<p>I figured the process would go something like this:</p>
<ol>
<li>Create a StreamWriter that points to a MemoryStream </li>
<li>Create a faux Response object that uses this StreamWriter </li>
<li>Have the ControllerFactory.Current create the controller </li>
<li>Invoke the Action on the Controller using the in-memory Response </li>
<li>Since the output will be sent to MemoryStream, just read it from there and replace the token </li>
</ol>
<p>Sound simple, right?&#160; It&#8217;s not!</p>
<p>First of all, HttpContext is a magical, super-inter-dependent beast.</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> IControllerFactory factory = ControllerBuilder.Current.GetControllerFactory();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> <span style="color:#008000;">// I need an HttpRequest    </span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> HttpRequest httpRequest = <span style="color:#0000ff;">new</span> HttpRequest(HttpContext.Current.Request.FilePath, HttpContext.Current.Request.Url.AbsoluteUri, <span style="color:#0000ff;">string</span>.Empty);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> <span style="color:#008000;">// Here's the stream I'm going to put the response into</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> MemoryStream memStream = <span style="color:#0000ff;">new</span> MemoryStream();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span> <span style="color:#008000;">// I need a Response to hold the stream</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> HttpResponse response = <span style="color:#0000ff;">new</span> HttpResponse(<span style="color:#0000ff;">new</span> StreamWriter(memStream));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span> <span style="color:#008000;">// I need an HttpContextBase, which wraps the HttpContext, which requires the Request &amp; Response</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span> HttpContextBase httpContext = <span style="color:#0000ff;">new</span> HttpContextWrapper(<span style="color:#0000ff;">new</span> HttpContext(httpRequest, response));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span> <span style="color:#008000;">// I need a RequestContext to feed into the Execute method on my Controller</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span> RequestContext requestContext = <span style="color:#0000ff;">new</span> RequestContext(httpContext, <span style="color:#0000ff;">new</span> RouteData()</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span>     Values = { { <span style="color:#006080;">&quot;controller&quot;</span>, <span style="color:#006080;">&quot;Home&quot;</span> }, { <span style="color:#006080;">&quot;action&quot;</span>, <span style="color:#006080;">&quot;SomeAction&quot;</span> } }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span> });</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span> IController controller = factory.CreateController(requestContext, <span style="color:#006080;">&quot;Home&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum16">  16:</span> controller.Execute(requestContext);</pre>
<p><!--CRLF--></div>
</div>
<p>Man, that was a lot of work!&#160; And you know what?&#160; <strong><em>It doesn’t even work!</em></strong></p>
<p>That’s right, get used to it because this post is all about things not working.&#160; If you’re looking for a quick fix, you might want to visit <a href="http://www.google.com">google</a> because you won’t find it in this post.&#160; The above code generates the following Exception on line 16:</p>
<blockquote>
<p>The SessionStateTempDataProvider requires SessionState to be enabled.</p>
</blockquote>
<p>And a quick peek at Reflector tells me this is because the HttpContext (that I’m passing in) has a Session object that’s null.</p>
<p>Ok, so I came up with another, simpler and more elegant way of accomplishing this, if not a little more dependent:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#008000;">// Queue up all my HttpContext dependencies</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span> HttpRequest httpRequest = <span style="color:#0000ff;">new</span> HttpRequest(HttpContext.Current.Request.FilePath, HttpContext.Current.Request.Url.AbsoluteUri, <span style="color:#0000ff;">string</span>.Empty);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span> MemoryStream memStream = <span style="color:#0000ff;">new</span> MemoryStream();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span> HttpResponse response = <span style="color:#0000ff;">new</span> HttpResponse(<span style="color:#0000ff;">new</span> StreamWriter(memStream));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span> HttpContextBase httpContext = <span style="color:#0000ff;">new</span> HttpContextWrapper(<span style="color:#0000ff;">new</span> HttpContext(httpRequest, response));</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> <span style="color:#008000;">// In reality I'd use reflection for this, but as you'll see the code won't work anyway so why bother?</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum8">   8:</span> HomeController homeController = <span style="color:#0000ff;">new</span> HomeController();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum9">   9:</span> ControllerContext controllerContext = <span style="color:#0000ff;">new</span> ControllerContext(httpContext, <span style="color:#0000ff;">new</span> RouteData(){</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum10">  10:</span>     Values = {{ <span style="color:#006080;">&quot;controller&quot;</span>, <span style="color:#006080;">&quot;Home&quot;</span>}, { <span style="color:#006080;">&quot;action&quot;</span>, <span style="color:#006080;">&quot;SomeAction&quot;</span>}}</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum11">  11:</span> }, homeController);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum12">  12:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum13">  13:</span> <span style="color:#008000;">// Again, I would use reflection but it's a waste of time</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum14">  14:</span> ActionResult result = homeController.SomeAction();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum15">  15:</span> result.ExecuteResult(controllerContext);</pre>
<p><!--CRLF--></div>
</div>
<p>Looks pretty good, right?&#160; What I’m doing is creating the Controller (in a non proof-of-concept I’d use reflection to queue that up) and then calling the necessary Action which returns an ActionResult.&#160; I’m then running the ExecuteResult method on said ActionResult passing in my ControllerContext which has a reference to my HttpContext which in turn writes data to my MemoryStream.</p>
<p>However, this also doesn’t work as (I) expected.&#160; What ends up happening is that the MemoryStream length remains 0 but the output from the ActionResult ends up on the calling page – at the top of the page.</p>
<p>I debugged against the MVC source code and you want to see the culprit?&#160; ViewPage.cs, line 110:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum1">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">virtual</span> <span style="color:#0000ff;">void</span> RenderView(ViewContext viewContext) {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum2">   2:</span>     ViewContext = viewContext;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum3">   3:</span>     InitHelpers();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum4">   4:</span>     <span style="color:#008000;">// Tracing requires Page IDs to be unique.</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum5">   5:</span>     ID = Guid.NewGuid().ToString();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum6">   6:</span>     ProcessRequest(HttpContext.Current);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;" id="lnum7">   7:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Notice the last line there:</p>
<blockquote>
<p><strong>ProcessRequest(HttpContext.Current);</strong></p>
</blockquote>
<p>So, no matter what you do, you’ll still be passing the HttpContext.Current (with its StreamWriter) back to the Page to get rendered.&#160; Damn!</p>
<h4>So what are the options here?&#160; </h4>
<p>I could inherit from ViewPage and override the RenderView.&#160; That might work, but could cause other bugs because HttpContext is still super duper dependent and to debug I’ll have to head on over to the .NET Framework code (which, luckily, is available).&#160; I’ll also probably want to create a new class for my Controllers (which we already have, actually) to inherit from Controller so that I can create some sort of View method that will return my special inherited ViewPage that calls this overridden RenderView.</p>
<p>This no longer strikes me as quite the elegant solution I first assumed it would be.</p>
<p>I’m not quite sure the direction I’m going to take this now.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=124&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/09/16/rendering-viewpage-to-random-stream-or-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>MCTS Test Information</title>
		<link>http://noahblu.wordpress.com/2009/08/24/mcts-test-information/</link>
		<comments>http://noahblu.wordpress.com/2009/08/24/mcts-test-information/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 16:12:24 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/?p=119</guid>
		<description><![CDATA[I passed the MCTS last week and figured people might want to know a little about the test and what I did to pass. First of all, I used the Microsoft Press Self Paced study guide for the 70-562 test (available on Amazon).  It is a BIG book, but a lot of it is fluff [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=119&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I passed the MCTS last week and figured people might want to know a little about the test and what I did to pass.</p>
<p>First of all, I used the Microsoft Press Self Paced study guide for the 70-562 test (available on <a href="https://www.amazon.com/dp/073562562X?tag=mybl028e-20&amp;camp=213381&amp;creative=390973&amp;linkCode=as4&amp;creativeASIN=073562562X&amp;adid=0NFG5EY6458PC9PYEGP4&amp;">Amazon</a>).  It is a BIG book, but a lot of it is fluff (like lesson reviews and such), and there&#8217;s plenty you can skip if you feel comfortable with the material.  The book comes with a 15% off test voucher making the test $106 or so (down from $125).</p>
<p>It&#8217;s not a bad idea to take tons of practice tests from different places &#8212; I saw a link from MS that says they&#8217;ll pay for your second test if you fail the first time, but why take them up on the offer?</p>
<p>Regarding the test itself, it&#8217;s pretty straight forward save for a couple things.  For the most part, it&#8217;s multiple choice with 4 choices (though some questions have a bunch of checkboxes and you might have to choose 2 or 3 options out of the lot).  Now on every multiple-choice question there are 2 answers that if you aren&#8217;t completely brand new to ASP.NET you can throw out right away; that leaves 2 possible choices for each question.</p>
<p>Sometimes they are kind of tricky like if they ask something where you have 2 code snippets that look EXACTLY the same except one reads has something about &#8220;DataSource=&#8221; and one has &#8220;DataSourceID=&#8221;.  When there&#8217;s a lot of filler above and below that line it&#8217;s hard to see that line though.  That kind of stuff is what I mean by tricky.  Especially because the test is kind of new, that kind of thing made me think &#8220;wait, is there a mistake here?  these two answers are exactly the same!&#8221; until I re-read and re-read and re-read.</p>
<p>One of my biggest complaints about the practice tests I took was in regards to the questions that ask you to choose multiple answers.  The test tells you how many to choose (e.g. there are 7 options, choose 2), but some practice tests don&#8217;t do this.</p>
<p>Also, there was definitely 1 question on the test that was easy.  I mean really easy.  Too easy actually.  And having 4 choices I was very tempted to double-guess myself because it was just too easy.  You figure MS is tricking you.  But the test in that regard is pretty straight forward.  I got that one right by not over analyzing, so just keep that in mind.  If it&#8217;s the answer, it&#8217;s the answer.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=119&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/08/24/mcts-test-information/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>Now MCTS</title>
		<link>http://noahblu.wordpress.com/2009/08/18/now-mcts/</link>
		<comments>http://noahblu.wordpress.com/2009/08/18/now-mcts/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 17:47:05 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/?p=117</guid>
		<description><![CDATA[Passed the 70-562 this morning.  Officially Microsoft Certified Technology Specialist in ASP.NET 3.5<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=117&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Passed the 70-562 this morning.  Officially Microsoft Certified Technology Specialist in ASP.NET 3.5</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=117&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/08/18/now-mcts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>Noah Blumenthal is an MCP</title>
		<link>http://noahblu.wordpress.com/2009/08/03/noah-blumenthal-is-an-mcp/</link>
		<comments>http://noahblu.wordpress.com/2009/08/03/noah-blumenthal-is-an-mcp/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 17:12:03 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/2009/08/03/noah-blumenthal-is-an-mcp/</guid>
		<description><![CDATA[I’m now a Microsoft Certified Professional!&#160; I took the 70-536 (.NET Framework Application Development Foundation) test this morning and aced it .&#160; Next up, 70-562 I think… I’m excited!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=116&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’m now a Microsoft Certified Professional!&#160; I took the 70-536 (.NET Framework Application Development Foundation) test this morning and aced it <img src='http://s2.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .&#160; Next up, 70-562 I think…</p>
<p>I’m excited!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=116&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/08/03/noah-blumenthal-is-an-mcp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery $.extend() method with plugin called multiple times (note to self: RTFM!)</title>
		<link>http://noahblu.wordpress.com/2009/07/27/jquery-extend-method-with-plugin-called-multiple-times-note-to-self-rtfm/</link>
		<comments>http://noahblu.wordpress.com/2009/07/27/jquery-extend-method-with-plugin-called-multiple-times-note-to-self-rtfm/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 16:22:36 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/2009/07/27/jquery-extend-method-with-plugin-called-multiple-times-note-to-self-rtfm/</guid>
		<description><![CDATA[&#160; jQuery’s $.extend() method is used to merge two (or more) objects.&#160; It’s very useful in plugin development since it can be used to merge user defined options with default options for a plugin.&#160; I ran into an issue today trying to debug a plugin I wrote (jquery inline row editor) whereby settings were getting [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=115&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>jQuery’s $.extend() method is used to merge two (or more) objects.&#160; It’s very useful in plugin development since it can be used to merge user defined options with default options for a plugin.&#160; I ran into an issue today trying to debug a plugin I wrote (<a href="http://code.google.com/p/jquery-inline-editor/">jquery inline row editor</a>) whereby settings were getting all screwed up if it was used multiple times on a page (ie a page with multiple editable tables).&#160; I’m ashamed to say it, but it took me a while of debugging before realized what the issue was.&#160; Note to self: RTFM!!!</p>
<p>Take the following snippet:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> $.fn.inplacerowedit = <span style="color:#0000ff;">function</span>(options) {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>     <span style="color:#0000ff;">var</span> ops = $.extend($.fn.inplacerowedit.defaults, options);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>     .....</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Now what I didn’t take into account is that the $.extend() method doesn’t just spit out a merged object based on all the parameters, it merges all objects sent in as parameters <strong><em>into</em></strong> the first parameter.&#160; So in this example above, <strong>ops == $.fn.inplacerowedit.defaults</strong> which itself is a combination of what it started out as and the <em>options</em> parameter.&#160; Well that now makes sense why things got screwed up when this was called multiple times, huh?</p>
<p>So the solution was to set the first parameter of the $.extend() method to a blank object {} and have jQuery append EVERYTHING to that and set THAT to ops like so:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> $.fn.inplacerowedit = <span style="color:#0000ff;">function</span>(options) {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>     <span style="color:#0000ff;">var</span> ops = $.extend({}, $.fn.inplacerowedit.defaults, options);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>     .....</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>OR I suppose you could just declare ops and then use that as the first parameter.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=115&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/07/27/jquery-extend-method-with-plugin-called-multiple-times-note-to-self-rtfm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery plugin to edit table row (inline)</title>
		<link>http://noahblu.wordpress.com/2009/07/10/jquery-plugin-to-edit-table-row-inline/</link>
		<comments>http://noahblu.wordpress.com/2009/07/10/jquery-plugin-to-edit-table-row-inline/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 18:00:30 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/?p=112</guid>
		<description><![CDATA[I just uploaded a jQuery plugin to turn a regular (non-souped-up) table&#8217;s rows into inline editable.  The url is http://code.google.com/p/jquery-inline-editor/ There are some instructions there too.  Feel free to modify. Pretty simple but might save you some time if you&#8217;re going in this direction.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=112&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just uploaded a jQuery plugin to turn a regular (non-souped-up) table&#8217;s rows into inline editable.  The url is <a href="http://code.google.com/p/jquery-inline-editor/">http://code.google.com/p/jquery-inline-editor/</a></p>
<p>There are some instructions there too.  Feel free to modify.</p>
<p>Pretty simple but might save you some time if you&#8217;re going in this direction.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=112&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/07/10/jquery-plugin-to-edit-table-row-inline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
		<item>
		<title>Retrieve OR Instantiate ModelBinder</title>
		<link>http://noahblu.wordpress.com/2009/07/10/retrieve-or-instantiate-modelbinder/</link>
		<comments>http://noahblu.wordpress.com/2009/07/10/retrieve-or-instantiate-modelbinder/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 02:25:04 +0000</pubDate>
		<dc:creator>noahblu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://noahblu.wordpress.com/2009/07/10/retrieve-or-instantiate-modelbinder/</guid>
		<description><![CDATA[Sometimes you want your model binder to retrieve an object if it exists or instantiate it if it doesn’t.&#160; For instance I have a create page and an edit page for my models so on the create page I want the model to be instantiated but I also have an edit page that posts back [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=111&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes you want your model binder to retrieve an object if it exists or instantiate it if it doesn’t.&#160; For instance I have a create page and an edit page for my models so on the create page I want the model to be instantiated but I also have an edit page that posts back the ID of the model and I’d love the entity to be retrieved from the DB for further edits.&#160; SO…..</p>
<p>I created a ModelBinder that actually takes two different model binders and tries to bind with each.&#160; If it works the first time, great, otherwise try the backup.&#160; In my case that’s Retrieval with a backup of Instantiate.&#160; This could be used for many different purposes though, so don’t let the class name throw you off:</p>
<div style="border-bottom:silver 1px solid;text-align:left;border-left:silver 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&#39;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;border-top:silver 1px solid;cursor:text;border-right:silver 1px solid;margin:20px 0 10px;padding:4px;" id="codeSnippetWrapper">
<div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;" id="codeSnippet">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> RetrieveOrInstantiateModelBinder : IModelBinder</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>     <span style="color:#0000ff;">private</span> IModelBinder _retrievalBinder;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>     <span style="color:#0000ff;">private</span> IModelBinder _instantiationBinder;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>     <span style="color:#0000ff;">public</span> RetrieveOrInstantiateModelBinder(IModelBinder retrievalBinder, IModelBinder instantiationBinder)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span>         _retrievalBinder = retrievalBinder;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span>         _instantiationBinder = instantiationBinder;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span>     <span style="color:#cc6633;">#region</span> IModelBinder Members</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  12:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">object</span> BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  13:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  14:</span>         <span style="color:#0000ff;">object</span> obj = _retrievalBinder.BindModel(controllerContext, bindingContext);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  15:</span>         <span style="color:#0000ff;">if</span> (obj == <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  16:</span>             obj = _instantiationBinder.BindModel(controllerContext, bindingContext);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  17:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  18:</span>         <span style="color:#0000ff;">return</span> obj;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  19:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  20:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  21:</span>     <span style="color:#cc6633;">#endregion</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&#39;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  22:</span> }</pre>
<p><!--CRLF--></div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/noahblu.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/noahblu.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/noahblu.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/noahblu.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/noahblu.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/noahblu.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/noahblu.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/noahblu.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/noahblu.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/noahblu.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/noahblu.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/noahblu.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/noahblu.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/noahblu.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=noahblu.wordpress.com&amp;blog=4971484&amp;post=111&amp;subd=noahblu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://noahblu.wordpress.com/2009/07/10/retrieve-or-instantiate-modelbinder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b4700665d2e068834b5ec213596a067c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">noahblu</media:title>
		</media:content>
	</item>
	</channel>
</rss>
