<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Los Techies</title><link>http://www.lostechies.com/blogs/</link><description>LosTechies.com was originally discussed a few years ago, over a couple of adult beverages whose name sounds very similar to l(D)os t(E)quies. Anyway the thought was to create a public forum where technical ideas and thoughts can be shared in the same way we all get together around a good meal and drinks. Ideas and thoughts are cultivated in discussion, and brought to fruition through professional debate and laughter. Sounds good in theory, well read our thoughts and ideas, take part in our debates and rejoice in our laughter.</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/LosTechies" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Happy Hack-o-ween: Electronics and a microcontroller spice up the haunt</title><link>http://feedproxy.google.com/~r/LosTechies/~3/RNaKSUaqU74/happy-hack-o-ween-electronics-and-a-microcontroller-spice-up-the-haunt.aspx</link><pubDate>Sun, 08 Nov 2009 16:27:00 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:30142</guid><dc:creator>Sharon J. Cichelli</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Ah, Halloween, when a young woman's fancy turns to love. And zombies.&lt;/p&gt;
&lt;p&gt;I had two personal requirements for the costume I would build this year:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It shall be spooky.&lt;/li&gt;
&lt;li&gt;It shall blink.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I'll tell you about the final result, the electronics and the software that went into it, plus the techniques I used to achieve wearable electronics. I'll introduce you to the &lt;a href="http://www.arduino.cc/"&gt;Arduino&lt;/a&gt;, an open-source microcontroller prototyping platform, which is an exhilarating tool/toy for making your software skills manifest in the physical world.&lt;/p&gt;
&lt;p&gt;My husband and I have been teaching ourselves electronics. A few months ago, Dad taught me to solder. I recently read Syuzi Pakhchyan's excellent primer on wearable electronics and smart materials, &lt;a href="http://www.librarything.com/work/5874825/book/47829579"&gt;&lt;i&gt;Fashioning Technology&lt;/i&gt;&lt;/a&gt;. And I've been &lt;a href="http://blog.makezine.com/archive/2009/10/ambient_led_flowerpot_clock.html"&gt;making things&lt;/a&gt; with my Arduino. All these ideas were swirling and combining in my head to inspire this year's Halloween project. Er, &lt;em&gt;costume&lt;/em&gt;. Same difference.&lt;/p&gt;
&lt;p&gt;What was I? I was a nightmare... the thing under your bed... the reason for your well developed sense of paranoia...&lt;br /&gt;
&lt;a href="http://www.flickr.com/photos/spyderella/sets/72157622735987434/"&gt;&lt;img src="http://farm3.static.flickr.com/2609/4076005063_851a85338f_m.jpg" width="161" height="240" alt="The thing under your bed" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I sported a crop of writhing eyeballs erupting from my head. Each eyeball has an LED inside it, and they blink randomly and independently, until I trigger a hidden switch, which causes the blinky ones to go dark and two red eyes to pulse menacingly. In the &lt;a href="http://www.flickr.com/photos/spyderella/sets/72157622735987434/"&gt;Flickr photoset&lt;/a&gt;, you can see the construction process.&lt;/p&gt;
&lt;h2&gt;The Arduino Sketch&lt;/h2&gt;
&lt;p&gt;The term "Arduino" is overloaded to mean:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;a particular chip and circuit board which you can buy or build;&lt;/li&gt;
&lt;li&gt;the IDE in which you write programs for the chip;&lt;/li&gt;
&lt;li&gt;the language, which is C-flavored;&lt;/li&gt;
&lt;li&gt;fun.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Arduino programs are called sketches. Every sketch must contain two functions: setup (runs once) and loop (runs continuously). Here's my sketch, with extra explanatory comments, that blinks the six regular eyeballs and responds to the switch by pulsing the red eyeballs.&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 8pt; color: black; background: white; border: 1px solid #ccc; overflow: auto; width: 600px; height: 400px;"&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;#define&lt;/span&gt; SWITCH 8&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;int&lt;/span&gt; ledPins[] = {2, 3, 4, 5, 6, 7};&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; ledPinsCount = 6;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;int&lt;/span&gt; redEyePins[] = {10, 11};&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; redEyePinsCount = 2;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;6&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;long&lt;/span&gt; durations[ledPinsCount];&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;int&lt;/span&gt; ledStates[ledPinsCount];&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;long&lt;/span&gt; previousTimes[ledPinsCount];&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;int&lt;/span&gt; i;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;11&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;void&lt;/span&gt; setup()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&lt;/span&gt;&amp;nbsp;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;13&lt;/span&gt;&amp;nbsp;&amp;nbsp; pinMode(SWITCH, INPUT); &lt;span style="color: green;"&gt;//Specify the switch pin as an input.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;14&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt; (i = 0; i &amp;lt; redEyePinsCount; i++)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;16&lt;/span&gt;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;17&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; pinMode(redEyePins, OUTPUT); &lt;span style="color: green;"&gt;//Specify each red-eye LED pin as an output.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&lt;/span&gt;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;19&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(i = 0; i &amp;lt; ledPinsCount; i++)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;21&lt;/span&gt;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;22&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; pinMode(ledPins, OUTPUT); &lt;span style="color: green;"&gt;//Specify each regular LED pin as an output.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;23&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; ledStates = random(1); &lt;span style="color: green;"&gt;//Randomly set the LEDs to on or off (1 or 0).&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;24&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; durations = GetRandomDuration(); &lt;span style="color: green;"&gt;//Define a random duration for each LED to stay in that state.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;25&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; previousTimes = 0; &lt;span style="color: green;"&gt;//At time of setup, the "last time we changed" is at 0 milliseconds, the start of time.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&lt;/span&gt;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;27&lt;/span&gt;&amp;nbsp;}&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;28&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;29&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;void&lt;/span&gt; loop()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&lt;/span&gt;&amp;nbsp;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;31&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (digitalRead(SWITCH) == HIGH)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;32&lt;/span&gt;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;33&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; TurnOffLeds();&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; PulseRedEyes();&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&lt;/span&gt;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;36&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;37&lt;/span&gt;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;38&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(i = 0; i &amp;lt; redEyePinsCount; i++)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;39&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;40&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; digitalWrite(redEyePins, LOW); &lt;span style="color: green;"&gt;//Turn the red eyes all the way off.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;41&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;42&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;43&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(i = 0; i &amp;lt; ledPinsCount; i++) &lt;span style="color: green;"&gt;//For each LED:&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;44&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (millis() - previousTimes &amp;gt; durations)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;46&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;47&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ChangeLed(i); &lt;span style="color: green;"&gt;//If this one's duration is up, then flip it.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;48&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;49&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&lt;/span&gt;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;51&lt;/span&gt;&amp;nbsp;}&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;52&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;53&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;void&lt;/span&gt; TurnOffLeds()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;54&lt;/span&gt;&amp;nbsp;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;55&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(i = 0; i &amp;lt; ledPinsCount; i++)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;56&lt;/span&gt;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;57&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; digitalWrite(ledPins, LOW);&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;58&lt;/span&gt;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;59&lt;/span&gt;&amp;nbsp;}&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;60&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;61&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;void&lt;/span&gt; PulseRedEyes()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;62&lt;/span&gt;&amp;nbsp;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;63&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;//Fade on, then off.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;64&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;int&lt;/span&gt; j;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;65&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(j = 0; j &amp;lt; 255; j+=5)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;66&lt;/span&gt;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;67&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(i = 0; i &amp;lt; redEyePinsCount; i++)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;68&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;69&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; analogWrite(redEyePins, j);&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;70&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay(10);&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;71&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;72&lt;/span&gt;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;73&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(j = 255; j &amp;gt; 0; j-=5)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;74&lt;/span&gt;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;75&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;for&lt;/span&gt;(i = 0; i &amp;lt; redEyePinsCount; i++)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;76&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;77&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; analogWrite(redEyePins, j);&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;78&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; delay(10);&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;79&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;80&lt;/span&gt;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;81&lt;/span&gt;&amp;nbsp;}&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;82&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;83&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;void&lt;/span&gt; ChangeLed(&lt;span style="color: blue;"&gt;int&lt;/span&gt; ledPin)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;84&lt;/span&gt;&amp;nbsp;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;85&lt;/span&gt;&amp;nbsp;&amp;nbsp; previousTimes[ledPin] = millis(); &lt;span style="color: green;"&gt;//Update the "last time we changed" to now.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;86&lt;/span&gt;&amp;nbsp;&amp;nbsp; durations[ledPin] = GetRandomDuration(); &lt;span style="color: green;"&gt;//Give it a new random duration.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;87&lt;/span&gt;&amp;nbsp;&amp;nbsp; ledStates[ledPin] = 1 - ledStates[ledPin]; &lt;span style="color: green;"&gt;//Flip the state between on and off.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;88&lt;/span&gt;&amp;nbsp;&amp;nbsp; digitalWrite(ledPins[ledPin], ledStates[ledPin]); &lt;span style="color: green;"&gt;//Set the LED to that state.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;89&lt;/span&gt;&amp;nbsp;}&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;90&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;91&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;long&lt;/span&gt; GetRandomDuration()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;92&lt;/span&gt;&amp;nbsp;{&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;93&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;//Random number between 1 and 10, then multiplied by 400 to give it a detectable duration.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;94&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt; random(1, 10) * 400;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&lt;span style="color: #2b91af;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;95&lt;/span&gt;&amp;nbsp;}&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;I like the way the eyes blink independently. If they all flashed in unison, they would look like Christmas lights, and you would notice that two were "special" because they weren't flashing. Instead, the duration that any given eyeball is lit or dark constantly changes.&lt;/p&gt;
&lt;p&gt;The blinking is managed by a collection of arrays. One array represents each of my LED pins, so that I can address them in a for loop. The three other arrays hold: the state (on/off) of each LED; the duration each LED should stay in that state; the reading from the millisecond counter when the LED last flipped its state. Each time the loop function executes, if the switch is not connected, then I look at each LED; if the difference between the current time and the time when it previously changed is greater than its duration, flip its state (from off to on, or from on to off), randomly assign it a new duration, and record "now" as the new "previously changed" time. If the switch &lt;em&gt;is&lt;/em&gt; connected, then I make the red eyes fade on and fade off.&lt;/p&gt;
&lt;h2&gt;Fading with PWM&lt;/h2&gt;
&lt;p&gt;PWM (Pulse-Width Modulation) is a technique for making a digital component (one that turns on or off) simulate analog behavior (be a little bit on, and then a little bit more on). If you turn an LED off and on really quickly, you won't perceive the flickering, but it will look half as bright, because it is actually off for half the time. If you let it spend a little more time off than on, it will appear even dimmer. So by varying the width of the pulses, you can control how bright the LED looks.&lt;/p&gt;
&lt;p&gt;The Arduino comes with built-in PWM functions; some pins are already set up to be PWM pins. If you plug an LED into one of the PWM pins, then you can write to it as if it were an analog component. That's why, in my sketch above, I set the brightness of the red eyes using &lt;em&gt;analogWrite()&lt;/em&gt;, instead of digitalWrite(). My for loop increments the counter j from 0 to 255, and sets the brightness of both red eyes to the value of j. The Arduino takes care of (imperceptibly) flickering the LEDs with the right ratio of on-time and off-time to achieve a j amount of brightness. So the eyes get gradually brighter, then gradually dimmer. (Then control returns to the main loop function, but if my switch is still connected, the red eyes will throb again.)&lt;/p&gt;
&lt;h2&gt;Snaps: Wearable Plugs&lt;/h2&gt;
&lt;p&gt;A metal sewable snap is like a plug for your clothing, an interface between the world of textiles and the world of wires. This is handy when you need the electronics to be separate while you are getting into the clothing, or if you want to wash the clothing. My Arduino hung out at the base of my neck, to be near the LEDs on my head but hidden underneath my wig, but my control switch was near my hip. I could have run a wire down to the switch, but conductive thread was more subtle and more comfortable.&lt;/p&gt;
&lt;p&gt;To complete the connection, I soldered a short wire to one side of the snap. That wire plugged into a pin on the Arduino. The conductive thread ran from the switch at my hip up to the back of my dress near the Arduino, and I sewed that conductive thread to the other half of the snap. When the two halves are snapped together, the wire and the thread make a complete connection, as if they were one continuous wire.&lt;br /&gt;
&lt;a href="http://www.flickr.com/photos/spyderella/4085497865/" title="Soldered snaps / Sewn snaps by Spyderella, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2584/4085497865_a50e4e45d1_m.jpg" width="240" height="180" alt="Soldered snaps / Sewn snaps" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I had two threads (going out to the switch and back), so I encased them each in a bias tape tube, to prevent them from touching each other and shorting out.&lt;/p&gt;
&lt;p&gt;I've been saying "switch," but actually, I simplified at the 11th hour. I tied each thread around a safety pin, and stuck the pins to my dress. When the safety pins touched each other, they completed the circuit, which the Arduino sketch interpreted as triggering the switch&amp;mdash;cue red-eye glare.&lt;/p&gt;
&lt;h2&gt;What's Next&lt;/h2&gt;
&lt;p&gt;Soldering and sewing are both liberating skills to possess&amp;mdash;they free up your creativity to make wilder and more integrated stuff. If you are currently proficient with only one, ask around and see if you can find a buddy who's good at the other, and teach each other.&lt;/p&gt;
&lt;p&gt;The Arduino comes with a great community of hackers and makers, lots of people to learn from and collaborate with. Definitely check it out. There is lots of fun to be had, and blinking LEDs is the barest beginning of what it can do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=Happy+Hack-o-ween%3a+Electronics+and+a+microcontroller+spice+up+the+haunt&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fsharoncichelli%2farchive%2f2009%2f11%2f08%2fhappy-hack-o-ween-electronics-and-a-microcontroller-spice-up-the-haunt.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fsharoncichelli%2farchive%2f2009%2f11%2f08%2fhappy-hack-o-ween-electronics-and-a-microcontroller-spice-up-the-haunt.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=30142" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/23258D2FE3F087E35338325DEBB3132CFF6FE4C9"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/23258D2FE3F087E35338325DEBB3132CFF6FE4C9"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=RNaKSUaqU74:E_4YBAmsTYw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=RNaKSUaqU74:E_4YBAmsTYw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=RNaKSUaqU74:E_4YBAmsTYw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=RNaKSUaqU74:E_4YBAmsTYw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/RNaKSUaqU74" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/sharoncichelli/archive/tags/arduino/default.aspx">arduino</category><category domain="http://www.lostechies.com/blogs/sharoncichelli/archive/tags/electronics/default.aspx">electronics</category><feedburner:origLink>http://www.lostechies.com/blogs/sharoncichelli/archive/2009/11/08/happy-hack-o-ween-electronics-and-a-microcontroller-spice-up-the-haunt.aspx</feedburner:origLink></item><item><title>Using MSDeploy to automate your Enterprise Application remote deployments.</title><link>http://feedproxy.google.com/~r/LosTechies/~3/_nfNP-Tnt7k/using-msdeploy-to-automate-your-enterprise-application-remote-deployments.aspx</link><pubDate>Fri, 06 Nov 2009 17:00:00 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29992</guid><dc:creator>erichexter</dc:creator><slash:comments>7</slash:comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;MsDeploy is a newish technology that is a bit schizophrenic.&amp;#160; What I mean is that it is a tool that is useful to both Developers and Administrators but it is not clear from the documentation how to best use the technology and how to approach it. I believe it stated as a Server Administrator tool and the team was able to work in an integration with Visual Studio which made it into a more robust framework, but at the same time left is command line interface with so many options that it is challenging to get a grasp on.&amp;#160; To top that off the Web Platform Installer uses the MsDeploy packages as a way to distribute packages through that tool.&amp;#160; After working through some various ways to use the technology I have settled into some commands that work well for our projects. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Let me set the context of how we are using the tool and what we already had in place so that you can better understand if my use of MsDeploy will work for you. At &lt;a href="http://www.headspringsystems.com/"&gt;Headspring&lt;/a&gt; we use Continuous Integration on all of our projects and as a result, once our software is built by our build server the next logical step is to deploy our software to a server and than run User Interface tests against the application. Most of our projects are web applications running on ASP.Net MVC using Sql Server as the back end.&amp;#160; We install our software using a lightweight zipfile that contains the web application files, database migration scripts and a deployment script which can poke config files and execute our database migration tool.&amp;#160; We already have all the pieces in place to deploy our application on a local machine.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Up until know we have used two methods to deploy instances to remote machines.&amp;#160; The first methods was to install Cruise Control.Net on the server and have it monitor our source control repository for a new installation package being committed to the repository. Once it sees a new package CCNet will pull down the package, install it locally and go on its merry way.&amp;#160; The second method, is to kick off the deployment from the build server and connect over the network to the target database to run upgrades and then xcopy the files to a unc share.&amp;#160; Both of these methods require setting up some configuration on our target servers. My goal with our deployments is to reduce the amount of per server configuration we do on each server and use some conventions to make each server look similar to one from a different project.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Using MSDeploy allows us to do the following.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1. Remove the need to install cruise control on the target server and update the configuration for cruise control on each target server.&amp;#160; We do have to install MSDeploy on each server but we do not have to mess with any configuration after that.&lt;/p&gt;    &lt;p&gt;2. We do not have to mess with setting up unc shares and deal with the mess.&amp;#160; It sounds like a silly thing but by getting away from the unc share we can also test our deployments from any machine and msdeploy is actually firewall friendly.&amp;#160; xcopy to a unc share is not firewall friendly which means that we cannot use it for all of our clients which means variations between our projects.&amp;#160; &lt;/p&gt;    &lt;p&gt;3. We use msdeploy as a mechanism to distribute our deployment packages and then remotely execute the packages.&amp;#160; This means I can have a single instance of our Continuous Integration server which reduces the number of places to maintain configuration.&amp;#160; That is a big win.&amp;#160; This also means the log files for all of the deployments can be tracked in a single place.&lt;/p&gt;    &lt;p&gt;4. Another benefit of using msdeploy to push our deployments means that I can easily setup new instances of a test configuration and push it to multiple servers without having to log into each machine.. This is good for efficiency.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt; Our use of MSDeploy now boils down to two steps.&amp;#160; Distribute and Execute.&amp;#160; We have some of our scripts in NAnt and we are in the process of migrating to PowerShell now that version 2.0 is available from the older operating systems.&amp;#160; Below is a sample of executing msdeploy from a NAnt script.&lt;/p&gt;  &lt;p&gt;Calling MsDeploy from Nant&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_4912CCA3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_19E0E10C.png" width="1028" height="249" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;dirPath&lt;/strong&gt;&amp;#160; command tells MSDeploy to synchronize a directory from the source computer a target computer. This is a pretty easy command to understand.&lt;/p&gt;  &lt;p&gt;The second command is the &lt;strong&gt;runCommand&lt;/strong&gt; this command was added between the RC and 1.0 release of MSDeploy and I am so happy they added it. The run command is told to execute a command on the remote machine.&amp;#160; Since we are running installation scripts, they do not execute instantly and as a result the waitInterval and waitAttempts need to be specified so that the command does not timeout before it has completed running. other than that the output of the console application is piped back to the source computer.&amp;#160; The one caveat about the run command is that when it starts it runs from the C:\windows\system32 directory.&amp;#160; In order to work around this issue I have found that passing the directory of the command into the batch file that I run allows my batch files to first cd to that directory as its first step.&amp;#160; This is a pretty harmless thing to do and works pretty well.&lt;/p&gt;  &lt;p&gt;This is what a sample deployment batch files looks like.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;cd %1     &lt;br /&gt;rd ..\codeToDeploy\ /s /q      &lt;br /&gt;applicationNamePackage.exe -o..\CodeToDeploy\ -y      &lt;br /&gt;cd ..\CodeToDeploy\      &lt;br /&gt;cmd /c %systemroot%\system32\inetsrv\appcmd stop site applicationName_dev      &lt;br /&gt;iisreset      &lt;br /&gt;call dev.bat      &lt;br /&gt;cmd /c %systemroot%\system32\inetsrv\appcmd start site applicationName_dev&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This is pretty basic and does some IIS commands as well.&amp;#160; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I am sure I left some information out, but I wanted to get a brain dump of our use of MSDeploy.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Long term I would like to see the use of PowerShell driving msdeploy and adding some configuration around each Server Role in an application and tie it to the servers needed for each environment.&amp;#160; I have started a project to put this together called psTrami but I have not put any of the code together yet, just some small spikes to prove it out.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;More to come sometime soon…..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=Using+MSDeploy+to+automate+your+Enterprise+Application+remote+deployments.&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f06%2fusing-msdeploy-to-automate-your-enterprise-application-remote-deployments.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f06%2fusing-msdeploy-to-automate-your-enterprise-application-remote-deployments.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29992" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/DC5506424A84B71C0B7EC7BC3D84306E84B07D25"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/DC5506424A84B71C0B7EC7BC3D84306E84B07D25"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=_nfNP-Tnt7k:ii2ScNduSqA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=_nfNP-Tnt7k:ii2ScNduSqA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=_nfNP-Tnt7k:ii2ScNduSqA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=_nfNP-Tnt7k:ii2ScNduSqA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/_nfNP-Tnt7k" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Asp.Net/default.aspx">Asp.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/CC.Net/default.aspx">CC.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/continous+integration/default.aspx">continous integration</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Tools/default.aspx">Tools</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Open+Source+Software/default.aspx">Open Source Software</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/MSDeploy/default.aspx">MSDeploy</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Deployment/default.aspx">Deployment</category><feedburner:origLink>http://www.lostechies.com/blogs/hex/archive/2009/11/06/using-msdeploy-to-automate-your-enterprise-application-remote-deployments.aspx</feedburner:origLink></item><item><title>Hang in there baby birds, I'll feed you</title><link>http://feedproxy.google.com/~r/LosTechies/~3/ZMeYNL0JZPw/hang-in-there-baby-birds-i-ll-feed-you.aspx</link><pubDate>Thu, 05 Nov 2009 20:19:29 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:30063</guid><dc:creator>Scott C Reynolds</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Quick housekeeping note - How We Do Things series is not cancelled, I haven't given up on it or run out of steam, it will still press forward.&lt;/p&gt;
&lt;p&gt;Trying to get a lot wrapped up both at home and at work in preparation for my move to New York, so I lapsed a bit, but I will be back on it soon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=Hang+in+there+baby+birds%2c+I%27ll+feed+you&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fscottcreynolds%2farchive%2f2009%2f11%2f05%2fhang-in-there-baby-birds-i-ll-feed-you.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fscottcreynolds%2farchive%2f2009%2f11%2f05%2fhang-in-there-baby-birds-i-ll-feed-you.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=30063" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/C60B4DC4580CAA86EF9DF89C3202C3EADA16C987"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/C60B4DC4580CAA86EF9DF89C3202C3EADA16C987"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=ZMeYNL0JZPw:aCLwbTtJ6MM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=ZMeYNL0JZPw:aCLwbTtJ6MM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=ZMeYNL0JZPw:aCLwbTtJ6MM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=ZMeYNL0JZPw:aCLwbTtJ6MM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/ZMeYNL0JZPw" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.lostechies.com/blogs/scottcreynolds/archive/2009/11/05/hang-in-there-baby-birds-i-ll-feed-you.aspx</feedburner:origLink></item><item><title>Automapper Auto Profile Registration.</title><link>http://feedproxy.google.com/~r/LosTechies/~3/yBJxCxOGC8Q/automapper-auto-profile-registration.aspx</link><pubDate>Thu, 05 Nov 2009 03:24:15 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:30035</guid><dc:creator>erichexter</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;On some of our projects we have been experimenting with smaller AutoMapper profiles.&amp;#160; The idea is that it is easier to digest a smaller profile. We have gone so far as creating a profile for each Domain object and handle all of the mappings to and from the domain object.&amp;#160; We are also trying out a Profile per scenario.&amp;#160; While these smaller profiles are easier to dig in and understand, the registration of them are a little painful.&amp;#160; So I put together a quick way to auto register all the profiles for automapper.&amp;#160; Below is the code to discover all the profiles in an assembly than register them with AutoMapper.&amp;#160; There is nothing fancy here and I could certainly spend more time making it better performing, but realistically this is startup code that runs once at application start up.&amp;#160; That being said I would rather focus performance optimization efforts on places that actually make a difference to the End User Experience. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Here is the sample.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_1C949FF2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_344BD758.png" width="1028" height="337" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;It is important to know that we have full code coverage over our application including integration tests, so that if something were to break as a result of loading this in a non deterministic order, we would know before we commit our changes to source control. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Here is the code for the ForEach extension method, since I breezed over it.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_322ED88F.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_3875AF1D.png" width="1028" height="169" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This is a smaller post than I normally put together.. is this small of a post useful? &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=Automapper+Auto+Profile+Registration.&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f04%2fautomapper-auto-profile-registration.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f04%2fautomapper-auto-profile-registration.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=30035" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/A24734D2C6556C1C07A76A0540C722C3E8017A8B"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/A24734D2C6556C1C07A76A0540C722C3E8017A8B"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=yBJxCxOGC8Q:bOnVnK1EFqc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=yBJxCxOGC8Q:bOnVnK1EFqc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=yBJxCxOGC8Q:bOnVnK1EFqc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=yBJxCxOGC8Q:bOnVnK1EFqc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/yBJxCxOGC8Q" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/hex/archive/tags/c_2300_/default.aspx">c#</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/.Net/default.aspx">.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Open+Source+Software/default.aspx">Open Source Software</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/AutoMapper/default.aspx">AutoMapper</category><feedburner:origLink>http://www.lostechies.com/blogs/hex/archive/2009/11/04/automapper-auto-profile-registration.aspx</feedburner:origLink></item><item><title>A Time For Change</title><link>http://feedproxy.google.com/~r/LosTechies/~3/ke1CCcdXZDc/a-time-for-change.aspx</link><pubDate>Wed, 04 Nov 2009 15:36:03 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:30014</guid><dc:creator>derick.bailey</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Change comes in groups of three, right? Well, I have &lt;a href="http://www.lostechies.com/blogs/derickbailey/archive/2009/10/08/the-ultimate-hello-world.aspx"&gt;a 4 week old baby girl&lt;/a&gt; (I can hardly believe she’s 4 weeks old already). That would be change #1.&amp;#160; For change #2, I turned in my two week notice to &lt;a href="http://www.mclaneat.com"&gt;my current employer&lt;/a&gt; on Monday.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 5px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derickbailey/image_5F00_32033071.png" width="180" height="37" /&gt;&lt;/p&gt;  &lt;p&gt;Starting on November 16th, I’ll be joining up with fellow LosTechie, &lt;a href="http://www.lostechies.com/blogs/joeydotnet/default.aspx"&gt;Joey Beninghove&lt;/a&gt;, over at &lt;a href="http://trackabout.com"&gt;TrackAbout.com&lt;/a&gt;.&amp;#160; I’m excited about the opportunity. There’s a great bunch of developers on that team and it should be a lot of fun and a significant challenge for me, at the same time.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now I just have to wait and see what change #3 is going to be…&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=A+Time+For+Change&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fderickbailey%2farchive%2f2009%2f11%2f04%2fa-time-for-change.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fderickbailey%2farchive%2f2009%2f11%2f04%2fa-time-for-change.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=30014" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/7ED137F862F65FC66C2A485482CA901AC9A8BC60"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/7ED137F862F65FC66C2A485482CA901AC9A8BC60"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=ke1CCcdXZDc:tE2c8IVA4_I:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=ke1CCcdXZDc:tE2c8IVA4_I:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=ke1CCcdXZDc:tE2c8IVA4_I:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=ke1CCcdXZDc:tE2c8IVA4_I:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/ke1CCcdXZDc" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.lostechies.com/blogs/derickbailey/archive/2009/11/04/a-time-for-change.aspx</feedburner:origLink></item><item><title>ASP.Net MVC Portable Area – Part 4 IoC framework support.</title><link>http://feedproxy.google.com/~r/LosTechies/~3/PKYYqEQSLMY/asp-net-mvc-portable-area-part-4-ioc-framework-support.aspx</link><pubDate>Wed, 04 Nov 2009 05:00:00 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29898</guid><dc:creator>erichexter</dc:creator><slash:comments>3</slash:comments><description>&lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx"&gt;Part 1 – Introduction&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/02/asp-net-mvc-portable-areas-part-2.aspx"&gt;Part 2 – Sample Portable Area&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/03/asp-net-mvc-portable-areas-part-3.aspx"&gt;Part 3 – Using of a Portable Area&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Part 4 – Using an Inversion of Control Framework.&amp;#160; (this post) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Using an Inversion of Control Container is a common scenario that would be needed by a Message Handler.&amp;#160; The Bus has an extensibility point to create the handlers. The model for this should feel similar to the ControllerFactory extension point in the ASP.Net MVC framework.&amp;#160; The sample below shows how to create a Message Handler factory for the StructureMap framework.&amp;#160; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_600BF09E.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_2CCFB735.png" width="644" height="179" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The SetMessageHandlerFactory method should be called once at application startup.&amp;#160;&amp;#160; Other than that … this is a pretty simple way to add a Dependency Injection Framework support to the Portable Area infrastructure.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;This makes it pretty simple for your message handlers to use constructor injection to manage their dependencies.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=ASP.Net+MVC+Portable+Area+%e2%80%93+Part+4+IoC+framework+support.&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f04%2fasp-net-mvc-portable-area-part-4-ioc-framework-support.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f04%2fasp-net-mvc-portable-area-part-4-ioc-framework-support.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29898" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/1103C809368D0BC980CC4819F9CD00E0D955EC8A"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/1103C809368D0BC980CC4819F9CD00E0D955EC8A"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=PKYYqEQSLMY:b2W03fw8C3s:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=PKYYqEQSLMY:b2W03fw8C3s:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=PKYYqEQSLMY:b2W03fw8C3s:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=PKYYqEQSLMY:b2W03fw8C3s:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/PKYYqEQSLMY" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Asp.Net/default.aspx">Asp.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Asp.Net+MVC/default.aspx">Asp.Net MVC</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Portable+Area/default.aspx">Portable Area</category><feedburner:origLink>http://www.lostechies.com/blogs/hex/archive/2009/11/04/asp-net-mvc-portable-area-part-4-ioc-framework-support.aspx</feedburner:origLink></item><item><title>ASP.Net MVC Portable Areas – Part 3</title><link>http://feedproxy.google.com/~r/LosTechies/~3/AzYKPWLtz68/asp-net-mvc-portable-areas-part-3.aspx</link><pubDate>Tue, 03 Nov 2009 17:00:00 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29897</guid><dc:creator>erichexter</dc:creator><slash:comments>10</slash:comments><description>&lt;h1&gt;Using a Portable Area&lt;/h1&gt;
&lt;p&gt;This is the third part in a series about using a Portable Area (PA) using MvcContrib.&amp;nbsp; This sample walks through the Host Application side of consuming the Login Portable area.&amp;nbsp; This example demonstrates how&amp;nbsp;a portable area such as a login can send messages and recieve responses from the host application.&amp;nbsp; This allows the host application to control the core of the application and lets the Portable Area solve the User Interface portion of the Login.&amp;nbsp; While this is a pretty simple example it is important to look at the concept of what a Portable Area could solve.&amp;nbsp; A portable Area could just handling wiring up multiple user interface screens and deal with simple form validation while leaving a lot of from for the host application to control the parts that are important to the application.&amp;nbsp; Or a Portable Area could provide an entire self contained piece of functionality like a Blog engine, or mulit-instance forum.&amp;nbsp; There is a large spectrum for how much the Portable Area could provide.&amp;nbsp; This example focuses on an example where the Portable Area provides the UI and lets the host application own the domain logic.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx"&gt;Part 1 &amp;ndash; Introduction&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/02/asp-net-mvc-portable-areas-part-2.aspx"&gt;Part 2 &amp;ndash; Sample Portable Area&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Part 3 &amp;ndash; Using of a Portable Area&amp;nbsp; (this post) &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/04/asp-net-mvc-portable-area-part-4-ioc-framework-support.aspx"&gt;Part 4 &amp;ndash; Using an Inversion of Control Framework.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to use a Portable Area (PA), the following references need to be added to your MVC project: &lt;a target="_blank" href="http://www.mvccontrib.org"&gt;MvcContrib&lt;/a&gt; &amp;amp; the assembly of the Portable Area.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_77F3C39A.png"&gt;&lt;img height="218" width="244" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_3E70B3A3.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Wiring up the Portable Area to the application is done at startup.&amp;nbsp; Portable Areas use the message bus as a way to communicate between the PA and the application. The main method for integrating with a portable area is to register a Message Handler. The sample below demonstrates wiring up a LogAllMessagesObserver,&amp;nbsp;LoginHandler, and a ForgotPassword Handler&amp;nbsp;for the Login Portable Area.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The call to the InputBuilder.Bootstrap() is required to initialize the Embedded Resource view engine used by this Portable Area infrastructure.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_1D7D40FC.png"&gt;&lt;img height="289" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_14AD38B0.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Here is an example of an Observer message handler.&amp;nbsp; This handler simply logs the message to the debugger. This could be used to collect metrics about the system, or log messages to a loggin framework.&amp;nbsp; The idea of an observer is that it is looking at the base message and not modifying the state of the message.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_52C65361.png"&gt;&lt;img height="198" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_2AB3A442.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The Login Message Handler receives the login request and than sets the result object which is part of the contract that is specified by the LoginPortableArea from Part 2.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_02A0F523.png"&gt;&lt;img height="290" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_210B360C.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In this example the main logic for login is still in a authentication service.&amp;nbsp; The handler is just used to wire up the message and response of the portable area to the host applications domain services.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Whats Next?&lt;/h2&gt;
&lt;p&gt;The constructor of the LoginHandler takes an IAuthenticationService as a dependency and my next post will walk through how an Inversion of Control container can be connected to the Bus to allow the framework of your choice to put your pieces together.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=ASP.Net+MVC+Portable+Areas+%e2%80%93+Part+3&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f03%2fasp-net-mvc-portable-areas-part-3.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f03%2fasp-net-mvc-portable-areas-part-3.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29897" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/B9AECACB853BD52B64A39FDC28976654271C3076"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/B9AECACB853BD52B64A39FDC28976654271C3076"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=AzYKPWLtz68:bp659Roen-8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=AzYKPWLtz68:bp659Roen-8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=AzYKPWLtz68:bp659Roen-8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=AzYKPWLtz68:bp659Roen-8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/AzYKPWLtz68" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Asp.Net/default.aspx">Asp.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/.Net/default.aspx">.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Asp.Net+MVC/default.aspx">Asp.Net MVC</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Portable+Area/default.aspx">Portable Area</category><feedburner:origLink>http://www.lostechies.com/blogs/hex/archive/2009/11/03/asp-net-mvc-portable-areas-part-3.aspx</feedburner:origLink></item><item><title>ASP.Net MVC Portable Areas – Part 2</title><link>http://feedproxy.google.com/~r/LosTechies/~3/MPRIpzOSGRY/asp-net-mvc-portable-areas-part-2.aspx</link><pubDate>Mon, 02 Nov 2009 17:00:00 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29877</guid><dc:creator>erichexter</dc:creator><slash:comments>11</slash:comments><description>&lt;h1&gt;Sample Portable Area&lt;/h1&gt;
&lt;p&gt;This is the second part in a series about creating a Portable Area (PA) using MvcContrib&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx"&gt;Part 1 &amp;ndash; Introduction&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Part 2 &amp;ndash; Sample Portable Area (this post)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/03/asp-net-mvc-portable-areas-part-3.aspx"&gt;Part 3 &amp;ndash; Usage of a Portable Area&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/04/asp-net-mvc-portable-area-part-4-ioc-framework-support.aspx"&gt;Part 4 - IoC Framework Support&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;To create a Portable Area, the first step is to create a separate class library project for the Portable Area.&amp;nbsp; The output assembly is the single file needed to add this functionality to applications which wish to consumer it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;The minimal references required for the Portable Area are shown below: &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;/span&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_39B36C13.png"&gt;&lt;img height="393" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_7C43078B.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;While DataAnnotations is not required to build a PA, using DataAnnotations for Model validation makes distribution of the PA very easy, since the MVC2 DefaultModelBinder supports the DataAnnotations validation out of the box. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;If you choose a different validation framework than you would need to distribute those assemblies or possible IL Merge them into your PA.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;The sample PA in the MvcContrib project is a Login Portable Area, this is a pretty simple example, but demonstrates how a PA and application can integrate.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This is also a piece of functionality that most applications need.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;Below is the code listing and structure for the project.&amp;nbsp; It looks identical to a mulit-project ASP.Net MVC Area.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_27A72886.png"&gt;&lt;img height="385" width="318" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_0000AC5C.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;The first difference between creating a Portable Area and a standard area from the files perspective is how the Views are registered with the project. The views Build Action should be changed from content to an &lt;a href="http://msdn.microsoft.com/en-us/library/0c6xyb66.aspx"&gt;&lt;span style="color: #669966; mso-bidi-font-size: 11.0pt;"&gt;Embedded Resource&lt;/span&gt;&lt;/a&gt;. This allows the views to be embedded into the output assembly so that they view folders and files to not have to be manually copied into each application that uses it.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Instead a special view engine will pull these views out of the assembly at run time and render them the same way that a physical view would be rendered.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_585A3031.png"&gt;&lt;img height="365" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_7E4FE087.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;The second item that is needed to create a Portable Area is a specialized registration class for the that inherits from PortableAreaRegistration. This class provides an extended RegisterArea method that sends in the MVC AreaRegistrationContext and a IApplicationBus object to the method.&amp;nbsp; The IApplicationBus &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;is the mechanism&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;that a Portable Area uses to send messages to the hosting application during. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;The use of the bus during registration is not required, but it is available in case and specific start up logic is needed to correctly configure the Portable Area. &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;The last line of the method show how the Portable Area registers the embedded views with the view engine, using the call to the RegisterTheViewsInTheEmmeddedViewEngine method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;An important caveat around the setup of the Registration class is to make sure that the Registration class is sitting in the same Namespace as the controllers and views.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;If the Namespaces do not match the views will not be able to be located. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;Since the namespace for the Embedded Resource views cannot be specified declaratively they are created using the Assemblies Default Namespace and the folder structure that they are stored in.&amp;nbsp; So keeping all of these properties consistent will make everything work.&amp;nbsp; If you change the default namespace of the project, you will need to update the namespace of your registration and controller classes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;/span&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_0998F4C5.png"&gt;&lt;img height="398" width="1028" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_68394F28.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;The first call in this registration method sends a message to the hosting application.&amp;nbsp; This is a contrived example but it demonstrates sending a tracing message that can be used by an observer message handler to log the registration activity.&amp;nbsp; This tracing can be useful since the Portable Areas use the built in MVC registration mechanism for auto discovery and there is not a lot of visibility into the built in registration process. This example shows how a message can be sent between the PA and the hosting application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_10F4B472.png"&gt;&lt;img height="335" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_2C2D0D73.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;The LoginController demonstrates the functionality needed to handle displaying the login form and then handling the form post. There are two Actions in the controller, one to render a Login View and a second Action to process the form post and redirect the user on success or , in the case of a login failure, display the login error messages to the user.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;/span&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_35A5CBE9.png"&gt;&lt;img height="428" width="1028" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_2937A8C0.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;The message bus is the main mechanism for communicating between a portable area and the hosting application.&amp;nbsp;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This is a very simplistic mechanism that allows the Portable Areas to communicate with the hosting application in a synchronous manner. &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;For some scenarios, like when the area should not implement its own database, the host application can own how the domain model is persisted in data storage and the Portable Area can worry about handling the multi-page user interface and other user interface concerns like validating simple data types.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;The messages that are passed to the Bus are shown below.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;/span&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_38F73DC4.png"&gt;&lt;img height="172" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_29E05EEA.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;The LoginInput represents the data that is collected from the Login screen. It is using the built in &lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;DataAnnotations attributes to handle the simple validation rules.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;&lt;/span&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_7DC361F8.png"&gt;&lt;img height="220" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_484A9FD3.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="line-height: 115%; font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;"&gt;The result object is used to determine if the credentials were valid for the host application and are then used to either display the error message or redirect to a protected page. Since the LoginInputMessage is passed to the bus with a reference, the handlers in the host application can change the Result object's state and the portable area can than access the Result and determine the correct logic to perform given that result.&amp;nbsp; The implementation for the handlers will be in the next post in this series.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_7C129624.png"&gt;&lt;img height="253" width="644" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_22747970.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Trebuchet MS','sans-serif'; font-size: 10.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"&gt;The Index view for the login uses the MvcContrib Input Builders to render a standard form to the page.&amp;nbsp; The use of the Input Builder allows an host application to override any of the html mark up using the Input Builder partials.&amp;nbsp; This means that the Portable Area and Input Builders play very nicely with each other.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_4C0844A3.png"&gt;&lt;img height="203" width="1028" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_51E2E83C.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This is what the view looks like in a browser.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_4912DFF0.png"&gt;&lt;img height="772" width="899" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_072BFAA2.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This is the validation errors that are handled by the Portable Area, using the MVC 2 default model binder.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_0A7D6C7D.png"&gt;&lt;img height="772" width="899" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_1D51F027.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This shows an error message that is passed back from the resulting application. Other rules could be applied as well.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_2B60B957.png"&gt;&lt;img height="772" width="899" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_57310D46.png" alt="image" border="0" title="image" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is the approach for creating a Portable Area (PA) using the MvcContrib Portable Area feature.&amp;nbsp; Let me know what you think about this approach, we tried to stay with the simplest approach that could possible work, and focused on making it easy to both develop and consume the Portable Areas.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please leave your comments on what you think of the approach.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=ASP.Net+MVC+Portable+Areas+%e2%80%93+Part+2&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f02%2fasp-net-mvc-portable-areas-part-2.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f02%2fasp-net-mvc-portable-areas-part-2.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29877" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/EFD08A5F402C1ED2C296157DD3226C2D802F5AAA"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/EFD08A5F402C1ED2C296157DD3226C2D802F5AAA"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=MPRIpzOSGRY:4CsHAgBUG7Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=MPRIpzOSGRY:4CsHAgBUG7Q:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=MPRIpzOSGRY:4CsHAgBUG7Q:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=MPRIpzOSGRY:4CsHAgBUG7Q:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/MPRIpzOSGRY" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/hex/archive/tags/mvc/default.aspx">mvc</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/mvccontrib/default.aspx">mvccontrib</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Asp.Net/default.aspx">Asp.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/.Net/default.aspx">.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Asp.Net+MVC/default.aspx">Asp.Net MVC</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Portable+Area/default.aspx">Portable Area</category><feedburner:origLink>http://www.lostechies.com/blogs/hex/archive/2009/11/02/asp-net-mvc-portable-areas-part-2.aspx</feedburner:origLink></item><item><title>ASP.Net MVC Portable Areas via MvcContrib</title><link>http://feedproxy.google.com/~r/LosTechies/~3/dvbhb7aVIhM/asp-net-mvc-portable-areas-via-mvccontrib.aspx</link><pubDate>Sun, 01 Nov 2009 18:00:00 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29649</guid><dc:creator>erichexter</dc:creator><slash:comments>19</slash:comments><description>&lt;p&gt;This is a multi post series on ASP.Net MVC Portable Areas&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Part 1 &amp;ndash; Introduction &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/02/asp-net-mvc-portable-areas-part-2.aspx"&gt;Part 2 &amp;ndash; Sample Portable Area&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/03/asp-net-mvc-portable-areas-part-3.aspx"&gt;Part 3 &amp;ndash; Usage of a Portable Area&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.lostechies.com/blogs/hex/archive/2009/11/04/asp-net-mvc-portable-area-part-4-ioc-framework-support.aspx"&gt;Part 4 - IoC framework support&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;What is a Portable Area?&lt;/h2&gt;
&lt;p&gt;A Portable Area is a set of reusable multi page functionality can be dropped into an application to provide rich functionality without having to custom build functionality that is literally the same in every application. This could be considered a plug-in or add-in type of functionality.&amp;nbsp; The &lt;strong&gt;portable &lt;/strong&gt;portion of this approach is that the area can be distributed as a single assembly rather than an assembly and a host of other files, like views or other html assets that need to be managed and maintained over time.&amp;nbsp; By making a portable area totally self contained in a single assembly, this should allow for easier reuse and upgrades to the area.&amp;nbsp; The challenge for doing something like this has been how do you allow enough control over the User Interface by the application yet still allow the actual views to be packaged with the logic.&lt;/p&gt;
&lt;h2&gt;Why Now?&lt;/h2&gt;
&lt;p&gt;There has been some discussion in the past on the MvcContrib mailing list about creating an plug-in framework and plugins but I do not think we had enough of the pieces in place to do this properly.&amp;nbsp;&amp;nbsp; I believe that with MVC 2 we have those missing pieces figured out.&amp;nbsp; The first enabler is the inclusion of Areas into the MVC 2 feature set. This includes having the Area and Controller namespace become part of the route data which is used both for Controller/Action selection but this also flows down to the selection of a view. The second enabler is some of the work that came out of MvcContrib and the Input Builders.&amp;nbsp; While implementing that feature we came up with a way to pull views from an assembly as an embedded resource.&amp;nbsp; This with the ability to override the default view engine in a way that allows an application developer to place their own version of a view in a folder so that they have the option to change the view to their needs was huge.&amp;nbsp; The last enabler really comes from what we have learned from all of the SOA greats and see how frameworks like nServiceBus and MassTransit have demonstrated that a messaging approach for integration can keep our concerns separated.&lt;/p&gt;
&lt;p&gt;The other why now is that my company, &lt;a href="http://www.headspring.com"&gt;Headspring&lt;/a&gt;, has found that in order to make our practice more successful, we need the ability to drop in some of the essentials for an application, we would prefer to do this in a binary form that is easy to upgrade and does not leave us with copy and pasted code between our various projects.&amp;nbsp; We would like to see that if we learn something from one project that we have the potential to apply those learning's to projects that are still in flight. We all prefer that rather than waiting for the next project to start so that we can apply what we have learned to the new project.&amp;nbsp; This approach will be much better for us as developers and our client will benefit as well.&amp;nbsp; We could take the approach of working on this in a bubble but by putting this out for the community we can learn from every else and potentially help others in the process and raise the collective bar for the industry, in our own little way.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Logical View of a Portable Area&lt;/h2&gt;
&lt;p&gt;Below is a logic view of a Portable Area.&amp;nbsp; It shows how the &lt;span style="color: #80ff00;"&gt;Green block&lt;/span&gt; is an application.&amp;nbsp; Inside the application the blocks in &lt;span style="color: #004080;"&gt;dark blue&lt;/span&gt; are framework components in ASP.Net MVC 2 and MvcContrib.&amp;nbsp; These blocks provide some minimal framework support for registration view resolution and communication between the application and the portable area.&amp;nbsp; The light blue blocks represent code the developer create.&amp;nbsp; The code in the Portable Area is created by the Portable Area developer. The code in the application block is coded by&amp;hellip; you guessed it. The application developer.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_176A60E0.png"&gt;&lt;img height="480" width="614" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_35686ED4.png" alt="image" border="0" title="image" style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Thanks for the Pictures but where is the code?&lt;/h2&gt;
&lt;p&gt;The code is currently available in the MvcContrib MVC 2 Branch.&amp;nbsp; You can get the latest binary from our (TeamCity/CodeBetter) build server here:&amp;nbsp; &lt;a href="http://teamcity.codebetter.com/guestAuth/repository/download/bt83/.lastSuccessful/MVCContrib.release.zip" title="http://teamcity.codebetter.com/guestAuth/repository/download/bt81/.lastPinned/MVCContrib.release.zip"&gt;http://teamcity.codebetter.com/guestAuth/repository/download/bt83/.lastSuccessful/MVCContrib.release.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There is a sample application you can download here: &lt;a href="http://teamcity.codebetter.com/guestAuth/repository/download/bt83/.lastSuccessful/MVCContrib.Extras.release.zip" title="http://teamcity.codebetter.com/guestAuth/repository/download/bt83/.lastSuccessful/MVCContrib.Extras.release.zip"&gt;http://teamcity.codebetter.com/guestAuth/repository/download/bt83/.lastSuccessful/MVCContrib.Extras.release.zip&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;or from the code repository on GitHub:&amp;nbsp; &lt;a href="http://github.com/mvccontrib/MvcContrib/zipball/mvc2"&gt;Download the source as a zip&lt;/a&gt;.&amp;nbsp;&amp;nbsp;or &lt;a href="http://github.com/mvccontrib/MvcContrib/tree/mvc2"&gt;Fork it on GitHub&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=ASP.Net+MVC+Portable+Areas+via+MvcContrib&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f01%2fasp-net-mvc-portable-areas-via-mvccontrib.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f11%2f01%2fasp-net-mvc-portable-areas-via-mvccontrib.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29649" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/3E3CB8828187F3E88C1BC76068F9E6CF910A7A6D"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/3E3CB8828187F3E88C1BC76068F9E6CF910A7A6D"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=dvbhb7aVIhM:RZKuVxXsdYk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=dvbhb7aVIhM:RZKuVxXsdYk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=dvbhb7aVIhM:RZKuVxXsdYk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=dvbhb7aVIhM:RZKuVxXsdYk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/dvbhb7aVIhM" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/hex/archive/tags/mvc/default.aspx">mvc</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/mvccontrib/default.aspx">mvccontrib</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/.Net/default.aspx">.Net</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Asp.Net+MVC/default.aspx">Asp.Net MVC</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/OSS/default.aspx">OSS</category><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Open+Source+Software/default.aspx">Open Source Software</category><feedburner:origLink>http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx</feedburner:origLink></item><item><title>Building a Service Gateway Using MassTransit, Part 3</title><link>http://feedproxy.google.com/~r/LosTechies/~3/AXLkDhqFmOQ/building-a-service-gateway-using-masstransit-part-3.aspx</link><pubDate>Sun, 01 Nov 2009 02:58:25 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29858</guid><dc:creator>Chris Patterson</dc:creator><slash:comments>12</slash:comments><description>&lt;p&gt;&lt;em&gt;This post is the third in a series on building a highly available service gateway. The implementation will be built in C# using &lt;a href="http://code.google.com/p/masstransit/"&gt;MassTransit&lt;/a&gt;, &lt;a href="http://structuremap.sourceforge.net/Default.htm"&gt;StructureMap&lt;/a&gt;, &lt;a href="http://www.asp.net/mvc/"&gt;ASP.NET MVC&lt;/a&gt;, and &lt;a href="http://nhforge.org/"&gt;NHibernate&lt;/a&gt;.&lt;/em&gt;
&lt;/p&gt;
&lt;h3&gt;Did somebody say code?&lt;/h3&gt;
&lt;p&gt;
The past two posts began to explain how to build a service gateway using MassTransit. In this post, I'm going to share some of the initial code that makes up the gateway service. The gateway itself consists of two components. The first implements the communication to the external service with a set of messages that are only used internally by the service. The second is the saga that provides the interface to the service gateway.
&lt;/p&gt;
&lt;h3&gt;Service Contract&lt;/h3&gt;
&lt;p&gt;The interface exposed to the application consists of two messages, the first for the command and the second for the response. The message contracts are defined using interfaces, allowing the class for the message to be an internal implementation detail.
&lt;/p&gt;&lt;p&gt;
The message contract representing a request for order details includes the CustomerId and the OrderId. 
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public interface RetrieveOrderDetails
{
	string OrderId { get; }
	string CustomerId { get; }
}
&lt;/pre&gt;
&lt;p&gt;
When the order details are received, the following message is published.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public interface OrderDetailsReceived
{
	string OrderId { get; }
	string CustomerId { get; }
	DateTime Created { get; }
	OrderStatus Status { get; }
}

public enum OrderStatus
{
	Unknown = 0,
	Submitted = 1,
	Accepted = 2,
	InProcess = 3,
	Complete = 4,
}
&lt;/pre&gt;
&lt;p&gt;
The CustomerId and OrderId are the same as the values passed in the request. Created is when the order was created, and Status is an enum representing the status of the order. Notice that no internal values are included -- no primary key from the order table and no primary key from the customer table. The request and response are correlated on identifiers that make sense in the application domain. While SQL purists will point out that numeric primary keys are quicker for retrieving rows in a database, they make for a very fragile interface with other components in the system. Reliance on a primary key outside of the context of the system storing the order details is a path to friction or outright failure.
&lt;/p&gt;
&lt;h3&gt;Time To Make the Saga&lt;/h3&gt;
&lt;p&gt;
At this point in the design of our service, the need for a saga to manage the request state is not entirely obvious. While the TDD purists might want to call YAGNI at this point, let me assure you that "it will all be... revealed!" So for now, let us take a look at the first pass of our saga definition.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public class OrderDetailsRequestSaga :
	SagaStateMachine&amp;lt;OrderDetailsRequestSaga&amp;gt;,
	ISaga
{
	static OrderDetailsRequestSaga()
	{
		Define(Saga);
	}
&lt;/pre&gt;
&lt;p&gt;
Our saga state machine uses a static initializer to define the states, events, and transitions of a saga. The previous code merely defines our class as a saga and calls our saga initialization method (shown below).
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
	private static void Saga()
	{
		Correlate(RequestReceived)
			.By((saga, message) =&amp;gt; saga.CustomerId == message.CustomerId &amp;amp;&amp;amp;
			                       saga.OrderId == message.OrderId &amp;amp;&amp;amp;
			                       saga.CurrentState == WaitingForResponse);

		Correlate(ResponseReceived)
			.By((saga, message) =&amp;gt; saga.CustomerId == message.CustomerId &amp;amp;&amp;amp;
			                       saga.OrderId == message.OrderId &amp;amp;&amp;amp;
			                       saga.CurrentState == WaitingForResponse);
&lt;/pre&gt;
&lt;p&gt;
Since our request criteria include our customer id and our order id, we use those to correlate the message to the saga. We also include the state of the saga to ensure that we do not match to a request that has already completed. We will look at some other ways we can enhance the performance of the service later on by using some additional states.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
	public static State Initial { get; set; }
	public static State WaitingForResponse { get; set; }
	public static State Completed { get; set; }
&lt;/pre&gt;
&lt;p&gt;
The three states we have defined, including an initial state when a new saga instance is created, a waiting for response state one our request has been sent to the service, and a completed state once the response has been received and published.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
	public static Event&amp;lt;RetrieveOrderDetails&amp;gt; RequestReceived { get; set; }
	public static Event&amp;lt;OrderDetailsResponse&amp;gt; ResponseReceived { get; set; }
	public static Event&amp;lt;OrderDetailsRequestFailed&amp;gt; RequestFailed { get; set; }
&lt;/pre&gt;
&lt;p&gt;
The three events that we have defined, including the message contract that maps to the event. The subscription logic for the saga will automatically map message handlers for these events that will invoke the actions depending upon the current state of the saga.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
		Initially(
			When(RequestReceived)
				.Then((saga, request) =&amp;gt;
					{
						saga.OrderId = request.OrderId;
						saga.CustomerId = request.CustomerId;
					})
				.Publish((saga, request) =&amp;gt; new SendOrderDetailsRequest
					{
						RequestId = saga.CorrelationId,
						CustomerId = saga.CustomerId,
						OrderId = saga.OrderId,
					})
				.TransitionTo(WaitingForResponse));
&lt;/pre&gt;
&lt;p&gt;
The first event handler, RequestReceived, is invoked when the saga is created in response to the RetrieveOrderDetails message. The handler copies the properties of the request, and then publishes the request message to the proxy that will call the external web service. After the message is published, the state of the saga transitions to the waiting for response state. When using transactional queues, the receipt of the message, creation of the saga in the database, sending of the command message to the proxy, and saving the saga are all part of a single distributed transaction. This ensures that everything completes as a single operation to ensure no requests are lost.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
		During(WaitingForResponse,
			When(ResponseReceived)
				.Then((saga, response) =&amp;gt;
					{
						saga.OrderCreated = response.Created;
						saga.OrderStatus = response.Status;
					})
				.Publish((saga, request) =&amp;gt; new OrderDetails
					{
						CustomerId = saga.CustomerId,
						OrderId = saga.OrderId,
						Created = saga.OrderCreated.Value,
						Status = saga.OrderStatus,
					})
				.TransitionTo(Completed));
	}
&lt;/pre&gt;
&lt;p&gt;
The second event handler, ResponseReceived, is invoked when the OrderDetailsResponse message is received. The results of the request are stored in the saga and a message is published containing the details of the order back to the original requestor. Another approach would be to capture the requestor address (via the ResponseAddress header from the message) and then resolve that address using the endpoint factory to send the response directly to the requestor. I don't really encourage this approach without having a truly unique identifier for each request. 
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
	public OrderDetailsRequestSaga(Guid correlationId)
	{
		CorrelationId = correlationId;
	}

	protected OrderDetailsRequestSaga()
	{
	}

	public virtual string CustomerId { get; set; }
	public virtual string OrderId { get; set; }
	public virtual OrderStatus OrderStatus { get; set; }
	public virtual DateTime? OrderCreated { get; set; }
	
	public virtual Guid CorrelationId { get; set; }
	public virtual IServiceBus Bus { get; set; }
}
&lt;/pre&gt;
&lt;p&gt;
The rest of the saga class is shown above for completeness. The properties are part of the saga and get saved when the saga is persisted (using the NHibernate saga persister, or in the case of the sample the in-memory implementation). The constructor with the Guid is used to initialize the saga when a new one is created, the protected one is there for NHibernate to be able to persist the saga.
&lt;/p&gt;
&lt;h3&gt;The Service Proxy&lt;/h3&gt;
&lt;p&gt;
The saga uses the external service proxy to perform the actual work, which is shown in the proxy class below.
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
public class OrderDetailsWebServiceProxy :
	Consumes&amp;lt;SendOrderDetailsRequest&amp;gt;.All
{
	public void Consume(SendOrderDetailsRequest request)
	{
		// make the call to the service to get the order details here

		var details = new OrderDetailsResponse
			{
				OrderId = request.OrderId,
				CustomerId = request.CustomerId,
				Created = (-1).Days().FromUtcNow(),
				Status = OrderStatus.InProcess,
			};

		CurrentMessage.Respond(details, x =&amp;gt; x.ExpiresAt(5.Minutes().FromNow()));
	}
}
&lt;/pre&gt;
&lt;p&gt;
The message handler uses the criteria from the SendOrderDetailsRequest message (which was published by the saga) to call the external service and retrieve the order details. The details are then returned to the saga in the form of an OrderDetailsResponse message which is internal to the service (and therefore not part of the interface assembly that is provided to applications that want to use the order details service).
&lt;/p&gt;
&lt;h3&gt;Test That Thang&lt;/h3&gt;
&lt;p&gt;
Now that our saga has been developed, we need to be able to test it. A unit test will be created that creates a testing instance of the service bus (see the sample for the implementation details) and verifies that the saga responds properly to the request. To request order details, a very simple client would subscribe to the response message and then publish the request. 
&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
const string orderId = "ABC123";
const string customerId = "12345";

LocalBus.Subscribe&amp;amp;lt; OrderDetailsReceived &amp;gt;(message =&amp;gt;
	{
		response.Set(message);
	},
	x =&amp;gt; x.OrderId == orderId &amp;amp;&amp;amp; x.CustomerId == customerId);

RetrieveOrderDetails request = new RetrieveOrderDetailsRequest(customerId, orderId);
LocalBus.Publish(request, x =&amp;gt; x.SendResponseTo(LocalBus.Endpoint));
&lt;/pre&gt;
&lt;p&gt;
The subscribe method used above specifies that when a message of type OrderDetailsReceived is received, if the contents of the message match the predicate specified (which in this case, is checking the OrderId and CustomerId contained in the message) then the statement specified should be called. Our example is from the integration test (built using NUnit) that verifies the service performs from end-to-end.
&lt;/p&gt;&lt;p&gt;
The syntax above is functional, and it will work, but it does not represent the most scalable approach. In the next post, I'll start to explain how to build a much more scalable method of handling thousands of concurrent requests on a single machine using IIS.
&lt;/p&gt;&lt;p&gt;
In the meantime, the sample code is available in the MassTransit trunk as a standalone solution. You can find it in the trunk\src\Samples\ServiceGatewaySample folder. There are unit tests that verify the calling syntax shown above and a service that hosts the services (both the saga, and the proxy service).
&lt;/p&gt;





&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=Building+a+Service+Gateway+Using+MassTransit%2c+Part+3&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fchris_patterson%2farchive%2f2009%2f10%2f31%2fbuilding-a-service-gateway-using-masstransit-part-3.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fchris_patterson%2farchive%2f2009%2f10%2f31%2fbuilding-a-service-gateway-using-masstransit-part-3.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29858" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/FB3191FAEC159837AA8D2D1F1A6AEFF4AC61252E"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/FB3191FAEC159837AA8D2D1F1A6AEFF4AC61252E"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=AXLkDhqFmOQ:FpByhKEjpqU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=AXLkDhqFmOQ:FpByhKEjpqU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=AXLkDhqFmOQ:FpByhKEjpqU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=AXLkDhqFmOQ:FpByhKEjpqU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/AXLkDhqFmOQ" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/chris_patterson/archive/tags/masstransit/default.aspx">masstransit</category><feedburner:origLink>http://www.lostechies.com/blogs/chris_patterson/archive/2009/10/31/building-a-service-gateway-using-masstransit-part-3.aspx</feedburner:origLink></item><item><title>“Productization”</title><link>http://feedproxy.google.com/~r/LosTechies/~3/o2gUY75L1rs/productization.aspx</link><pubDate>Fri, 30 Oct 2009 16:37:08 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29653</guid><dc:creator>chadmyers</dc:creator><slash:comments>14</slash:comments><description>&lt;p&gt;I need some ‘wisdom of the crowd’ here.&lt;/p&gt;  &lt;p&gt;I’m guessing just about ever single one of you (at least the software developer types) reading this have deployed software to a production environment at least once in your career. One of the products we’re working on is getting near to a major milestone and will start seeing wider deployments than the beta and preview deployments we’ve seen so far. I’m in charge of developing a list of different things we’ll need to do to the product to start wrapping it in a bow for wider distribution and deployment.&lt;/p&gt;  &lt;p&gt;What sorts of things, in your opinion and experience, should I be most concerned about?&amp;#160; Some of things I have on my list are:&amp;#160; Good logging and error reporting, well-defined and practiced strategy for handling updates and patches going forward (including incremental DB schema migration), etc.&lt;/p&gt;  &lt;p&gt;I’m also looking for any “Whatever you do, DO NOT do *this*” where *this* is some thing you tried and ended up being a terrible idea or blew up in your face.&lt;/p&gt;  &lt;p&gt;If you comment, please keep your advice short and to the point.&amp;#160; Though I would encourage you, if you have a funny and/or insightful story to share, to blog and link it back to this post for me and others to read!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=%e2%80%9cProductization%e2%80%9d&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fchad_myers%2farchive%2f2009%2f10%2f30%2fproductization.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fchad_myers%2farchive%2f2009%2f10%2f30%2fproductization.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29653" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/EB31BF3FE78485ECDC714630A8B2135C2C9DE6CC"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/EB31BF3FE78485ECDC714630A8B2135C2C9DE6CC"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=o2gUY75L1rs:eV_YJ7uEuVM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=o2gUY75L1rs:eV_YJ7uEuVM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=o2gUY75L1rs:eV_YJ7uEuVM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=o2gUY75L1rs:eV_YJ7uEuVM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/o2gUY75L1rs" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/chad_myers/archive/tags/Advice/default.aspx">Advice</category><category domain="http://www.lostechies.com/blogs/chad_myers/archive/tags/Deployment/default.aspx">Deployment</category><feedburner:origLink>http://www.lostechies.com/blogs/chad_myers/archive/2009/10/30/productization.aspx</feedburner:origLink></item><item><title>What I have been up to.</title><link>http://feedproxy.google.com/~r/LosTechies/~3/SNQkchDyEOQ/what-i-have-been-up-to.aspx</link><pubDate>Fri, 30 Oct 2009 03:36:02 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29468</guid><dc:creator>erichexter</dc:creator><slash:comments>4</slash:comments><description>&lt;p&gt;I have been pretty busy over the last few weeks. I just wanted to document what I have been doing.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_6BC1E25E.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 10px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_04517FAF.png" width="244" height="66" /&gt;&lt;/a&gt; I co-presented a free Advanced ASP.Net MVC half day with Jeffrey Palermo in Austin.&amp;#160; We had a good group of people show up to the Austin Microsoft office.&amp;#160; As I was preparing and presenting the session, it has become very obvious how much &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_4ED8BD89.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 10px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_1555AD92.png" width="244" height="123" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I co-presented with &lt;a href="http://twitter.com/jacksonh"&gt;Jackson Harper&lt;/a&gt; from the Mono team at &lt;a href="http://monospace.us/"&gt;Monospace&lt;/a&gt; on Mono and the Web ASP .NET MVC, WebForms, Tools, and Servers.&amp;#160; In preparation for this session I took the code camp server, codebase and got it running with Mono on openSuse… yeah that Linux, That means that ASP.Net MVC, StructureMap, NHibernate, Automapper, Castle Validators, and MvcContrib all work on mono and are &lt;strong&gt;binary compatible&lt;/strong&gt;!&amp;#160; I was able to compile the application in Visual Studio and using the MonoVS plugin deploy a vm.&amp;#160; We also demonstrated ftping the bits to a Linode and Jackson showed how to get is all setup.&amp;#160; He even made a Virtual Appliance that when you start it up in vmware it will be running the application on the web server..&amp;#160; You can get the slides, link to the mono version of the source code, download the virtual appliance from the mini site that was setup for the talk. &lt;a href="http://MonoOnTheWeb.info"&gt;http://MonoOnTheWeb.info&lt;/a&gt; .&amp;#160; I thought it was pretty cool seeing all of this stuff work.&amp;#160; It was a great way to prove out that the application stack that Headspring uses can be deployed on a wide range of platforms which ultimately opens up our potential customer base.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_1B9C8420.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 5px 0px 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://www.lostechies.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hex/image_5F00_thumb_5F00_141114B3.png" width="244" height="143" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;I had the chance to present &lt;strong&gt;Database Change Management&lt;/strong&gt; as the InnoTech conference.&amp;#160; It was pretty good to get out and see a group of people that I have not seen before.&amp;#160; I sometimes feel like I am in the Austin .Net bubble so while I presented some code samples in .Net using SQL server I really tried to present the information as being agnositc of you database platform.&amp;#160; Good development techniques can transcend technology and platforms.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=What+I+have+been+up+to.&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f10%2f29%2fwhat-i-have-been-up-to.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fhex%2farchive%2f2009%2f10%2f29%2fwhat-i-have-been-up-to.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29468" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/6A12B8567A90A50F3405870E6A683E4DDCAAB70C"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/6A12B8567A90A50F3405870E6A683E4DDCAAB70C"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=SNQkchDyEOQ:lrFJAJ_K9Ko:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=SNQkchDyEOQ:lrFJAJ_K9Ko:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=SNQkchDyEOQ:lrFJAJ_K9Ko:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=SNQkchDyEOQ:lrFJAJ_K9Ko:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/SNQkchDyEOQ" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/hex/archive/tags/Community/default.aspx">Community</category><feedburner:origLink>http://www.lostechies.com/blogs/hex/archive/2009/10/29/what-i-have-been-up-to.aspx</feedburner:origLink></item><item><title>Building a Service Gateway Using MassTransit, Part 2</title><link>http://feedproxy.google.com/~r/LosTechies/~3/_7OKiYX1wro/building-a-service-gateway-using-masstransit-part-2.aspx</link><pubDate>Thu, 29 Oct 2009 22:34:21 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29367</guid><dc:creator>Chris Patterson</dc:creator><slash:comments>5</slash:comments><description>&lt;p&gt;&lt;em&gt;This post is the second in a series on building a highly available service gateway. The implementation will be built in C# using MassTransit, StructureMap, ASP.NET MVC, and NHibernate.&lt;/em&gt;
&lt;/p&gt;
&lt;h3&gt;Continued...&lt;/h3&gt;
&lt;p&gt;
In part one, I discussed two exchange patterns that are often exposed as a web service. In this installment, I'm going to cover a more complex exchange pattern that including makes a request to an external system in response to a request on our web service.
&lt;/p&gt;&lt;p&gt;
&lt;em&gt;&lt;blockquote&gt;One of the comments on the previous post raised the question of using messaging for queries. Udi, Ayende, and I agree that this so-called "Data-SOA" is a bad thing. The queries I am presenting in this article are made against an external service and not an internal database. In many cases, this service might have limited availability and limited throughput, making it important to isolate our service to increase availability.&lt;/blockquote&gt;
&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;Complex Request&lt;/h3&gt;
&lt;p&gt;In the simple request, order status is a small enough data point that caching it at the web service makes sense. The details of an order, however, are much more involved and it is not practical to keep the details cached in case they are requested (which in this case, is much less often that the order status). To support the order detail request, we will apply a pattern that separates the inbound request from the outbound request, ensures that requests are performed only once (minimizing the click, click, click refresh mentality of some users), and even retain requests if the outbound service is unavailable until the request expires or the outbound service becomes available.
&lt;/p&gt;&lt;p&gt;
The first thing we want to build is the service that will be responsible for calling the external web service. To start, we'll define two messages representing the happy path of calling the service. The first message contains the criteria of the request (such as the order id and perhaps the customer id) and the second message contains the details of the order that were returned by the web service. In addition to the messages on the happy path, we may also define additional messages used to publish exception information related to the request.
&lt;/p&gt;&lt;p&gt;
Once the message contracts are defined to call the web service, we need to build a service that will handle the request messages. To do this, we'll build a message consumer for the request message, host it inside Topshelf, and subscribe to a service bus bound to the input queue of the service.
The message handler will use the request message properties to prepare the request to the external web service and produce the response message once the request returns. In this example, the external web service only supports synchronous requests (in a later article I will try to cover calling remote services that support asynchronous requests).
&lt;/p&gt;&lt;p&gt;
At this point, we have a service that responds to a command message (the request) and produces a result depending upon the outcome of the request. What we need now is a way to coordinate the requests to the service to ensure that requests are not lost due to an unavailable service, errors are retried once a failed service becomes available, and duplicate requests are ignored.
&lt;/p&gt;&lt;p&gt;
To coordinate the service requests, a saga will be created to manage the state of each request. A new message will be created to initiate the saga containing the same data that is needed to produce the request message that is sent to our gateway service. And as with the service, messages will be created to return the results of the request to the consumer of the external service. The saga will use our state machine driven saga syntax, making the business logic understandable at a glance. The saga will also define the retry parameters that should be used to recover from service outages by specifying an exception policy. The messages that are used by the requester to interact with the saga will become the interface that is used by our system to make requests to the external service. This includes the web service we are in turn providing to our customers. The internal messages used to communicate between the saga and the gateway service are not intended for use outside of our gateway service component.
&lt;/p&gt;&lt;p&gt;
&lt;em&gt;&lt;blockquote&gt;A nice side benefit of this architecture involves the actual call made by the gateway service. Since the interface is defined by the messages that are orchestrated by the saga, the backing implementation can be changed without impacting the consumers of the saga-based front end. This can be a huge benefit when it comes time to change service providers or bring an external service in-house either through acquisition or new product developments.&lt;/blockquote&gt;
&lt;/em&gt;&lt;/p&gt;&lt;p&gt;
With the saga in place (and for this example, we will go ahead and host it in the same process that we are hosting the gateway service), we are now ready to build the web service request handler. Rather than go straight into that now, I think I'm going to stop here and save that for part three. After part three is finished, I'll start posting some of the code for the examples and include it in the samples folder to make it easy to pull down and experiment with on your own machine.
&lt;/p&gt; 
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=Building+a+Service+Gateway+Using+MassTransit%2c+Part+2&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fchris_patterson%2farchive%2f2009%2f10%2f29%2fbuilding-a-service-gateway-using-masstransit-part-2.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fchris_patterson%2farchive%2f2009%2f10%2f29%2fbuilding-a-service-gateway-using-masstransit-part-2.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29367" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/A0A1DAA794AD9F1D23C9C8CDCE9B3421FD225E03"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/A0A1DAA794AD9F1D23C9C8CDCE9B3421FD225E03"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=_7OKiYX1wro:PhO69CpjItM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=_7OKiYX1wro:PhO69CpjItM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=_7OKiYX1wro:PhO69CpjItM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=_7OKiYX1wro:PhO69CpjItM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/_7OKiYX1wro" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/chris_patterson/archive/tags/masstransit/default.aspx">masstransit</category><feedburner:origLink>http://www.lostechies.com/blogs/chris_patterson/archive/2009/10/29/building-a-service-gateway-using-masstransit-part-2.aspx</feedburner:origLink></item><item><title>Building A Service Gateway Using MassTransit, Part 1</title><link>http://feedproxy.google.com/~r/LosTechies/~3/NgZDuIb8ImE/building-a-service-gateway-using-masstransit-part-1.aspx</link><pubDate>Thu, 29 Oct 2009 03:18:58 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:29068</guid><dc:creator>Chris Patterson</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;&lt;em&gt;This post is the first in a series on building a highly available service gateway. The implementation will be built in C# using MassTransit, StructureMap, ASP.NET MVC, and NHibernate.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;Introduction&lt;/h3&gt;
&lt;p&gt;A common way of applying a messaging solution to an existing system is to find a tightly coupled service reference in the system and insulate the system from that dependency. For example, the system may utilize a web service via a call from the user interface, blocking the user interface until the web service request completes. Another situation might involve a web service provided by the system which in turn calls another web service to complete the request. While these two examples are common in systems today, it is important consider how the system is using a dependent service when determining how best to insulate the system from that service.
&lt;/p&gt;&lt;p&gt;
To help make that decision, allow me to share some common exchange patterns implemented using a web service. While most web services are modeled after the request/response pattern, there are actually several types of exchanges that can occur within a web service method.
&lt;/p&gt;
&lt;h3&gt;Drop Box&lt;/h3&gt;
&lt;p&gt;If the web service is called by the client to provide information to the application, availability is likely the most important concern. Clients may have limited connectivity (such as a wireless client), limited resources (such as an embedded system that is unable to store data for future delivery), or a combination of these and other factors. To deal with these limitations, the web service should be designed for maximum availability to avoid failed requests due to an outage behind the web service boundary.
&lt;/p&gt;&lt;p&gt;
To support this high availability, the web service should count on the only thing that is available at the time web service method is invoked -- the local machine. If the web service attempts to write the information to a database located on a server across the network that is not available, the information in the request may be lost. In this case, it would be a better choice to write a message that contains the request information to a local queue. By doing this, the request information is retained and can be processed separately from the web service request. This allows allows the web service method to return to the caller, keeping resources available for other clients to report.
&lt;/p&gt;&lt;p&gt;
Once the data from the request is safely stored in the queue, a separate service is built that consumes the messages from the queue and sends the information to the internal system, which in this case might be a database server. If the database server is unavailable, the message is left in the queue until the database is available. This new service can also be stopped and even updated without disrupting the web service from receiving requests.
&lt;/p&gt;
&lt;h3&gt;Simple Request&lt;/h3&gt;
&lt;p&gt;If we look at another scenario, one where the request contains search criteria and the response includes the data specified matching the request. In order to break this down in different way, we will look at two different types of requests. First, we will define a request to retrieve the status of an order. Second, we will define a request to retrieve the details of an order.
&lt;/p&gt;&lt;p&gt;
When only the status of the order is requested, we are dealing with a relatively small amount of data per order -- in this case, the order id and the status of the order. If this consisted of maybe 50 bytes of data per order, we could easily store the status of 100,000 orders in only 5 megabytes of RAM. Since users might check the status of an order often, at least once an hour, this could generate thousands of requests an hour. Since the status of an order may only change once or twice a day, the need to query the database each time the order status is checked can put an unnecessary strain on the database server. In addition, the order status request service is now tightly coupled to the database, making the availability of the service dependent upon the availability of the database. This dependency chain can get even longer as more complex systems are designed, so limiting the dependencies of a service is a key parameter in increasing availability.
&lt;/p&gt;&lt;p&gt;
To reduce database load, eliminate the dependency on the database, and increase the availability of our order status web service, we can design our service to subscribe to order status updates. When the status of an order is updated, the update will publish a message containing the new status. As the status of orders are updated, our service would update an in-memory cache containing the status of every order in the system (well, every is not necessarily every -- it could just be the orders placed over the last week that have not yet been received by the customer). On startup, the web service would query the database for the status of all orders placed and use the results of that query to seed the cache. Once the cache is seeded, as new orders are added and order status updates occur, the cache would update dynamically in response to the update messages. Since the cache is local to the web service, requests need only check the status by querying the cache and immediately returning the status of the order to the caller. In the case of an status request for an order that does not exist in the cache, the service could queue a request to get the order status from the database which would then publish that orders status so that it could be returned. If the order is not found, the service could return an unknown order response to the caller with instructions to perhaps try their request again later. 
&lt;/p&gt;
&lt;h3&gt;Up Next&lt;/h3&gt;
&lt;p&gt;
The two exchanges described above are relatively easy to implement using messaging (and likewise, using MassTransit). The next exchange pattern I'm going to cover is the more complex request where the dependent service must be called to complete the request. Due to that complexity, I'm going to wait until the next installment to describe that in greater detail. After that, I'll start to share some code as we build a solution to these exchanges.
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=Building+A+Service+Gateway+Using+MassTransit%2c+Part+1&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fchris_patterson%2farchive%2f2009%2f10%2f28%2fbuilding-a-service-gateway-using-masstransit-part-1.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fchris_patterson%2farchive%2f2009%2f10%2f28%2fbuilding-a-service-gateway-using-masstransit-part-1.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=29068" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/F26F400F1F5273FF069FECB605CFDAA6AEC403F6"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/F26F400F1F5273FF069FECB605CFDAA6AEC403F6"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=NgZDuIb8ImE:eMv5PAbKp6A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=NgZDuIb8ImE:eMv5PAbKp6A:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=NgZDuIb8ImE:eMv5PAbKp6A:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=NgZDuIb8ImE:eMv5PAbKp6A:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/NgZDuIb8ImE" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/chris_patterson/archive/tags/masstransit/default.aspx">masstransit</category><feedburner:origLink>http://www.lostechies.com/blogs/chris_patterson/archive/2009/10/28/building-a-service-gateway-using-masstransit-part-1.aspx</feedburner:origLink></item><item><title>MVC Best Practices</title><link>http://feedproxy.google.com/~r/LosTechies/~3/2TW4o4UVPoM/mvc-best-practices.aspx</link><pubDate>Wed, 28 Oct 2009 12:45:26 GMT</pubDate><guid isPermaLink="false">ded273ab-9e87-4979-8222-e4e2e46f1b46:28845</guid><dc:creator>bogardj</dc:creator><slash:comments>13</slash:comments><description>&lt;p&gt;Simone has a great post (as usual) on &lt;a href="http://codeclimber.net.nz/archive/2009/10/27/12-asp.net-mvc-best-practices.aspx"&gt;12 ASP.NET MVC Best Practices&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Controller:&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;1 - Delete the AccountController&lt;/p&gt;    &lt;p&gt;2 - Isolate controllers from the outside world&lt;/p&gt;    &lt;p&gt;3 - Use an IoC Container&lt;/p&gt;    &lt;p&gt;4 - So NO to “magic strings”&lt;/p&gt;    &lt;p&gt;5 - Build your own personal conventions&lt;/p&gt;    &lt;p&gt;6 - Pay attention to the verbs&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;Model:&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;7 – Domain Model != ViewModel&lt;/p&gt;    &lt;p&gt;8 – Use ActionFilters for “shared” data&lt;/p&gt;    &lt;p&gt;&lt;strong&gt;View:&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;9 – NEVER use code-behind&lt;/p&gt;    &lt;p&gt;10 – Write HTML each time you can&lt;/p&gt;    &lt;p&gt;11 – If there is an if, write an HtmlHelper extension&lt;/p&gt;    &lt;p&gt;12 – Choose your ViewEngine carefully&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This is a fantastic list, and of course I have my own additions/suggestions :)&amp;#160; First, I’m not a fan of action filters for shared data.&amp;#160; If we’re doing strongly-typed views, using action filters for shared data puts us back into the magic string land, where we have to either use inheritance in our ViewModels, or the dictionary part of ViewData.&amp;#160; I don’t like either approach, I’d &lt;a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/06/18/the-filter-viewdata-anti-pattern.aspx"&gt;rather go with something like RenderAction&lt;/a&gt; to truly enforce SRP in my ViewModels.&amp;#160; Not everyone appreciates the elegance of this approach, but I’m sure they’ll agree eventually.&lt;/p&gt;  &lt;p&gt;I also don’t like writing an HtmlHelper extension just because I have logic in the view.&amp;#160; For a half-decent view engine, it shouldn’t be that problematic to have view logic in the view.&amp;#160; HtmlHelper extensions enforce the Helper object anti-pattern – a bunch of procedural logic hanging off one static class.&amp;#160; Instead, we went the route of building intelligent input builders for input elements, and only really using HtmlHelper when we want to eliminate duplication between multiple views.&amp;#160; I see these constructs:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;HtmlHelper&lt;/li&gt;    &lt;li&gt;Partials&lt;/li&gt;    &lt;li&gt;Master Pages&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All as means of eliminating duplication in our views, but not much more.&amp;#160; If there’s logic in a view, that’s fine by me as long as it’s not duplicated.&amp;#160; It’s not my fault that C# looks downright bizarre mixed in with HTML markup, but that’s what &lt;a href="http://sparkviewengine.com/"&gt;other view engines are for&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Finally, if there was an award for How Not to Design a Controller, the AccountController would be the runaway champ.&amp;#160; I still can’t imagine why it’s necessary, and the idea of &lt;a href="http://jeffreypalermo.com/blog/mvccontrib-working-on-portable-areas/"&gt;portable areas&lt;/a&gt; would be a better fit for its functionality than the Thing We Always Delete with Extreme Prejudice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;a href="http://www.dotnetkicks.com/kick/?title=MVC+Best+Practices&amp;url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fjimmy_bogard%2farchive%2f2009%2f10%2f28%2fmvc-best-practices.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.lostechies.com%2fblogs%2fjimmy_bogard%2farchive%2f2009%2f10%2f28%2fmvc-best-practices.aspx" border="0" alt="Kick It on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;img src="http://www.lostechies.com/aggbug.aspx?PostID=28845" width="1" height="1"&gt;&lt;p&gt;&lt;a target="_blank" href="http://theloungenet.com/feeds/redirect/DOTNETRSS/LOSTECHIES/113FF14593B48EB99987CE73A4FA53D26DFCE896"&gt;&lt;img src="http://theloungenet.com/feeds/img/DOTNETRSS/LOSTECHIES/113FF14593B48EB99987CE73A4FA53D26DFCE896"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=2TW4o4UVPoM:G1F0GlxOeFw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=2TW4o4UVPoM:G1F0GlxOeFw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?i=2TW4o4UVPoM:G1F0GlxOeFw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/LosTechies?a=2TW4o4UVPoM:G1F0GlxOeFw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/LosTechies?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/LosTechies/~4/2TW4o4UVPoM" height="1" width="1"/&gt;</description><category domain="http://www.lostechies.com/blogs/jimmy_bogard/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><feedburner:origLink>http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/10/28/mvc-best-practices.aspx</feedburner:origLink></item></channel></rss>
