<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Where's Lou</title>
	
	<link>http://whereslou.com</link>
	<description>It works on my machine</description>
	<lastBuildDate>Thu, 11 Oct 2012 01:39:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/WheresLou" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="whereslou" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Happy Birthday, OWIN</title>
		<link>http://whereslou.com/2012/10/10/happy-birthday-owin</link>
		<comments>http://whereslou.com/2012/10/10/happy-birthday-owin#comments</comments>
		<pubDate>Thu, 11 Oct 2012 01:39:55 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[owin]]></category>
		<category><![CDATA[OWIN]]></category>

		<guid isPermaLink="false">http://whereslou.com/2012/10/10/happy-birthday-owin</guid>
		<description><![CDATA[You’re one verson old today! 1.0 on 10/10. :) After much effort, input, conversation, writing prototypes, re-writing prototypes, and much churn: OWIN v1.0.0 is now fully baked. Expect to see and hear much more about this. It’s a good thing.]]></description>
			<content:encoded><![CDATA[<p><img style="margin-left: 0px; display: inline; margin-right: 0px" alt="Cake.jpg" align="right" src="http://images2.wikia.nocookie.net/__cb20100416151308/half-life/en/images/thumb/a/a1/Cake.jpg/250px-Cake.jpg" />You’re one verson old today! 1.0 on 10/10. :)</p>
<p>After much effort, input, conversation, writing prototypes, re-writing prototypes, and much churn: <a href="http://owin.org/spec/owin-1.0.0.html">OWIN v1.0.0</a> is now fully baked.</p>
<p>Expect to see and hear much more about this. It’s a good thing.</p>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/S0OHAh-SKNY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2012/10/10/happy-birthday-owin/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OWIN – compile once and run on any server</title>
		<link>http://whereslou.com/2012/05/14/owin-compile-once-and-run-on-any-server</link>
		<comments>http://whereslou.com/2012/05/14/owin-compile-once-and-run-on-any-server#comments</comments>
		<pubDate>Mon, 14 May 2012 19:29:31 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[owin]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[katana]]></category>
		<category><![CDATA[nancy]]></category>
		<category><![CDATA[OWIN]]></category>
		<category><![CDATA[webapi]]></category>

		<guid isPermaLink="false">http://whereslou.com/?p=929</guid>
		<description><![CDATA[Hello all! This blog post is about OWIN and we&#8217;ll look at an owin-sandbox repo that has been created to help test drive the draft spec to bring it closer to a release point. But first there a few notes about things that have been renamed. The generic self-host process Ghost.exe has been renamed Katana.exe [...]]]></description>
			<content:encoded><![CDATA[<p>Hello all! This blog post is about OWIN and we&#8217;ll look at an <a href="https://github.com/owin/owin-sandbox/" target="_blank">owin-sandbox</a> repo that has been created to help test drive the draft spec to bring it closer to a release point. But first there a few notes about things that have been renamed.</p>
<p><span id="more-929"></span>
<p>The generic self-host process <strong>Ghost.exe</strong> has been renamed <strong>Katana.exe</strong> and moved to its own its own git repo. It was originally in the Gate solution but that didn&#8217;t make a lot of sense in the end.</p>
<p>Secondly the C# http server Dragonfly.dll has been renamed Firefly.dll. There are simply too many software projects named Dragonfly. :)</p>
<p>Now! To jump right into a diagram. </p>
<p><a href="http://whereslou.com/wp-content/uploads/2012/05/image3.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://whereslou.com/wp-content/uploads/2012/05/image_thumb3.png" width="505" height="585" /></a></p>
<p>Here is what it looks like when you have a process with a startup that wires the OWIN call up to the middleware and web frameworks you are using. At that point you have requests from the world call through that stack to your code.</p>
<p>Something very important here is the orange line which is the OWIN event horizon. The significance: if you want to achieve the goal of everything above the orange line being re-hostable on different server implementations, then you can&#8217;t directly reference anything from a specific server&#8217;s implementation which is below the line.</p>
<p>How is that accomplished in practice? By adding the Startup class to your code which is passed an IAppBuilder as an argument. Your Startup class is free to reference any web frameworks you want to use, and can chain in any middleware, and will do other one-time initialization things like construct your IoC container and configure routing. The only thing you want to avoid is compiling directly against the specifics of a particular web server, like HttpListener, Kayak, Firefly, IIS, or others. Here&#8217;s a simple example from the owin-sandbox:</p>
<pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">using Gate.Adapters.Nancy;
using Nancy;
using Owin;
using Utils;

namespace Case05_JustNancy
{
    public class Startup
    {
        public void Configuration(IAppBuilder builder)
        {
            builder
                .Use&lt;AppTaskDelegate&gt;(Middleware.LogRequests)
                .RunNancy();
        }
    }

    public class HomeModule : NancyModule
    {
        public HomeModule()
        {
            Get[&quot;/&quot;] = _ =&gt; &quot;Hello world!&quot;;
        }
    }
}</pre>
<p>This project compiles as a class library and in a bin subfolder. Why do that? Well &#8211; frankly &#8211; that way you are compatible with IIS and you can use existing ASP.NET hosting providers, or deploy to your existing corporate servers, without any headaches. </p>
<p>But beyond that, what if you want to run this same web app as a self-hosted executable without changing anything or even recompiling? That&#8217;s exactly where Katana.exe comes in. It loads and calls your Startup class directly, and also loads the http server assembly of your choosing based on a server command-line argument or OWIN_SERVER environment variable.</p>
<p>A quick way to see this working in the owin-sandbox is to <a title="Download as zip" href="https://github.com/owin/owin-sandbox/zipball/master">Download as zip</a> an extract all the files. In the base there is a <strong>click-to-start.cmd</strong> file which will compile and start all of the case studies simultaneously.</p>
<p><a href="http://whereslou.com/wp-content/uploads/2012/05/image6.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://whereslou.com/wp-content/uploads/2012/05/image_thumb6.png" width="582" height="317" /></a></p>
<p><a href="http://whereslou.com/wp-content/uploads/2012/05/image7.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://whereslou.com/wp-content/uploads/2012/05/image_thumb7.png" width="551" height="175" /></a></p>
<p>Or, if you prefer, you can also install Katana.exe with Chocolatey and run your web app from the command line directly.</p>
<pre class="brush: text; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">cinst katana
git clone https://github.com/owin/owin-sandbox.git
cd owin-sandbox\src\Case05_JustNancy
msbuild
katana --server kayak</pre>
<p>And if you don&#8217;t have <a href="http://chocolatey.org/" target="_blank">Chocolatey</a> installed yet, you need to fix that situation right away! :) Run the following one-liner from an admin cmd prompt:</p>
<p><tt>@powershell -NoProfile -ExecutionPolicy unrestricted -Command &quot;iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))&quot;</tt></p>
<p>Well, thanks again, and I hope this works well for you. The next blog post should probably be a recap of the different components that are connected to this sandbox, OWIN, Gate, Katana, Coral, Sake, etc. and talking a bit about what they do and where they live at the moment.</p>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/dNCXeJbKlDc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2012/05/14/owin-compile-once-and-run-on-any-server/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Testing Live Writer</title>
		<link>http://whereslou.com/2012/05/13/testing-live-writer</link>
		<comments>http://whereslou.com/2012/05/13/testing-live-writer#comments</comments>
		<pubDate>Sun, 13 May 2012 06:21:36 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[meta]]></category>

		<guid isPermaLink="false">http://whereslou.com/?p=899</guid>
		<description><![CDATA[I always wrote posts online, and without a wysiwyg editor&#8230; Trying Live Writer for a change. Looks really nice so far! Can’t believe how effective it is&#8230; Ah! You can turn off all of the &#34;smart quote&#34; and emoticon replacement business. :). That&#8217;s good. Now &#8211; let’s try a code block&#8230; Yep &#8211; there&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>I always wrote posts online, and without a wysiwyg editor&#8230; Trying Live Writer for a change.</p>
<p>Looks really nice so far! Can’t believe how effective it is&#8230; Ah! You can turn off all of the &quot;smart quote&quot; and emoticon replacement business. :). That&#8217;s good. Now &#8211; let’s try a code block&#8230; </p>
<p><span id="more-899"></span>
<p>Yep &#8211; there&#8217;s a <a title="Windows Live Writer" href="http://writer.live.com/" target="_blank">live writer</a> <a title="Windows Live Writer Source Code plugin for SyntaxHighlighter" href="http://sourcecodeplugin.codeplex.com/" target="_blank">plugin</a> for <a title="SyntaxHighlighter" href="http://alexgorbatchev.com/wiki/SyntaxHighlighter" target="_blank">syntaxhighlighter</a>. Here goes:</p>
<pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">namespace Case02_JustGate
{
    public class Startup
    {
        public void Configuration(IAppBuilder builder)
        {
            builder
                .Use&lt;AppTaskDelegate&gt;(Middleware.LogRequests)
                .RunDirect(App);
        }

        private void App(Request req, Response res)
        {
            res.ContentType = &quot;text/plain&quot;;
            res.Write(&quot;You did a {0} at {1}&quot;, req.Method, req.Path);
            res.End();
        }
    }
}</pre>
<p>Also &#8211; my request to the world &#8211; if you&#8217;re going to have an emoticon graphic in your app &#8211; please make it as simple as possible. No boggle-eyed animated yellow smiley faces donning sunglasses and whistling please. What would be wrong with taking just the characters themselves, rotating them 90 degrees, and let them keep the same color and stroke weight as the normal font?</p>
<p>:) becomes <a href="http://whereslou.com/wp-content/uploads/2012/05/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://whereslou.com/wp-content/uploads/2012/05/image_thumb1.png" width="17" height="13" /></a> &#8211; know what I mean? <a href="http://whereslou.com/wp-content/uploads/2012/05/image2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://whereslou.com/wp-content/uploads/2012/05/image_thumb2.png" width="17" height="15" /></a></p>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/IJjw584vkJc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2012/05/13/testing-live-writer/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ghost.exe – a generic host for OWIN applications</title>
		<link>http://whereslou.com/2012/02/20/ghost-exe-a-generic-host-for-owin-applications</link>
		<comments>http://whereslou.com/2012/02/20/ghost-exe-a-generic-host-for-owin-applications#comments</comments>
		<pubDate>Mon, 20 Feb 2012 19:50:33 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[owin]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Gate]]></category>
		<category><![CDATA[OWIN]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://whereslou.com/?p=882</guid>
		<description><![CDATA[Hello again! Now let&#8217;s talk about Ghost.exe. As you may be aware &#8211; OWIN can be thought of as a port of Rack or WSGI specification to .NET, and Gate can be thought of as a reference implementation the of Rack utility and middleware library. If you&#8217;ve used Rack then you&#8217;re probably familiar with the [...]]]></description>
			<content:encoded><![CDATA[<p>Hello again! Now let&#8217;s talk about <strong>Ghost.exe</strong>.</p>
<p>As you may be aware &#8211; OWIN can be thought of as a port of Rack or WSGI specification to .NET, and Gate can be thought of as a reference implementation the of Rack utility and middleware library.</p>
<p>If you&#8217;ve used Rack then you&#8217;re probably familiar with the <strong>rackup</strong> executable. It provides a way to load a web site and run it on a web server that doesn&#8217;t provide it&#8217;s own executable. That is more or less the role Ghost.exe plays in the overall OWIN/Gate suite.</p>
<p>By now you&#8217;re thinking, &#8220;That&#8217;s awesome, stop typing and tell me how to get some of that!&#8221; and the easiest way is with <a href="http://chocolatey.org/">Chocolatey</a> &#8211; a nuget-based software distribution mechanism. The easiest way to get Chocolatey is from the VS Package Manager Console.<br />
<span id="more-882"></span><br />
Step one: <strong>get Chocolatey</strong></p>
<pre class="brush: plain; title: ;">
PM&gt; Install-Package chocolatey
Successfully installed 'chocolatey 0.9.8.14'.

PM&gt; Initialize-Chocolatey
The repository is set up at 'C:\NuGet'.
The packages themselves go to 'C:\NuGet\lib' (i.e. C:\NuGet\lib\yourPackageName).
Run chocolatey /? for a list of functions.

PM&gt; Uninstall-Package chocolatey
Successfully uninstalled 'chocolatey 0.9.8.14'.
</pre>
<p>The output text is heavily edited down &#8211; it does mention you may need to restart powershell for path changes to take effect. Actually &#8211; let&#8217;s leave VS and jump right to a new command prompt which should avoid that problem.</p>
<p>Step two: <strong>install ghost</strong></p>
<pre class="brush: plain; title: ;">
C:\Users\lodejard&gt;chocolatey install ghost
=====================================================
Chocolatey (0.9.8.14) is installing ghost (from http://chocolatey.org/api/feeds/
 OR https://go.microsoft.com/fwlink/?LinkID=206669) to &quot;C:\NuGet\lib&quot;
=====================================================
</pre>
<p>Step three: <strong>run ghost</strong></p>
<p>This is using the OWIN web app we made in the <a href="http://whereslou.com/2012/02/20/gate-adds-owin-support-for-the-new-asp-net-web-api-beta">last post</a>.</p>
<pre class="brush: plain; title: ;">
C:\Users\lodejard&gt;cd \Projects\Experiments\HelloEverything\HelloEverything

C:\Projects\Experiments\HelloEverything\HelloEverything&gt;ghost --server kayak
Started at http://+:8080/
</pre>
<p>Press <strong>Esc</strong> when you want to exit the Ghost.exe &#8211; but other than that you can browse to http://localhost:8080 and see the quickstart web site we created in the last blog post in all its glory. This should work if you run Ghost with the current directory at the base path for a &#8220;web app&#8221; or &#8220;class library&#8221; project which (a) compiles it&#8217;s output to a bin directory, and (b) one of the assemblies has a public Startup class in that assembly&#8217;s base namespace.</p>
<p>You need to follow the (b) convention if you don&#8217;t name the Startup method on the command line. Otherwise you can start an alternate environment by providing that. In fact &#8211; let&#8217;s add simple trace logging to the Startup.Debug method. This can be edited right into the example file the quickstart added to the project.</p>
<pre class="brush: csharp; title: ;">
public void Debug(IAppBuilder builder)
{
    // added to trace some request values as they pass through
    builder.Use(ShowRequests);

    builder.UseShowExceptions();
    Configuration(builder);
}

// simple user-middleware
AppDelegate ShowRequests(AppDelegate app)
{
    // this delegate is called per request
    return (env, result, fault) =&gt;
    {
        // use a light wrapper class to access env dictionary as properties
        var req = new Request(env);

        // trace out some info
        req.TraceOutput.WriteLine(
            &quot;{0} {1}{2} {3}&quot;, req.Method, req.PathBase, req.Path, req.QueryString);

        // and then pass all request along
        app(env, result, fault);
    };
}
</pre>
<p>You can select that configuration by running it as follows. Let&#8217;s use the firefly server this time.</p>
<pre class="brush: plain; title: ;">
C:\...\HelloEverything&gt;ghost --server firefly HelloEverything.Startup.Debug
Started at http://+:8080/
GET /
GET /wilson
GET /wilson flip=crash
</pre>
<p>Also be sure to run <code>Ghost /?</code> to check out the options as well. Currently supported http servers include the default HttpListener (the default), Kayak, and Firefly. Remember to set the url acls for your port if you&#8217;re going to be using HttpListener.</p>
<pre class="brush: plain; title: ;">
C:\Projects\Experiments\HelloEverything\HelloEverything&gt;ghost /?
Usage: Ghost [options] [&lt;application&gt;]
Runs &lt;application&gt; on an http server
Example: Ghost -p8080 HelloWorld.Startup

Options:
  -s, --server=VALUE         Load assembly named &quot;Gate.Hosts.TYPE.dll&quot; to
                               determine http server to use. TYPE defaults to
                               HttpListener.
  -u, --url=VALUE            May be used to set --scheme, --host, --port, and
                               --path options with a combined URIPREFIX value.
                               Format is '&lt;scheme&gt;://&lt;host&gt;[:&lt;port&gt;]&lt;path&gt;/'.
  -S, --scheme=VALUE         Determine which socket protocol server should
                               bind with. SCHEME may be 'http' or 'https'.
                               Defaults to 'http'.
  -h, --host=VALUE           Which host name or IP address to listen on. NAME
                               defaults to '+' for all IP addresses.
  -p, --port=VALUE           Which TCP port to listen on. NUMBER defaults to
                               8080.
  -P, --path=VALUE           Determines the virtual directory to run use as
                               the base path for &lt;application&gt; requests. PATH
                               must start with a '/'.
  -o, --output=VALUE         Writes any errors and trace logging to FILE.
                               Default is stderr.
  -v, --verbose              Increase the output verbosity.
  -?, --help                 Show this message and exit.

Environment Variables:
PORT                         Changes the default TCP port to listen on when
                               both --port and --url options are not provided.
OWIN_SERVER                  Changes the default server TYPE to use when
                               the --server option is not provided.
</pre>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/-2rvPUx1SHU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2012/02/20/ghost-exe-a-generic-host-for-owin-applications/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Gate adds OWIN support for the new ASP.NET Web API beta</title>
		<link>http://whereslou.com/2012/02/20/gate-adds-owin-support-for-the-new-asp-net-web-api-beta</link>
		<comments>http://whereslou.com/2012/02/20/gate-adds-owin-support-for-the-new-asp-net-web-api-beta#comments</comments>
		<pubDate>Mon, 20 Feb 2012 18:34:13 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[owin]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Gate]]></category>
		<category><![CDATA[OWIN]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[webapi]]></category>

		<guid isPermaLink="false">http://whereslou.com/?p=857</guid>
		<description><![CDATA[Hello again, everyone! As I&#8217;m sure you already know, ASP.NET MVC 4 beta is available and it has some fantastic stuff in it! One of the interesting bits is the latest ASP.NET Web API. Looking at that, I&#8217;m absolutely certain you&#8217;re thinking the same thing Glenn Block was saying on Twitter: @gblock: hmm I really [...]]]></description>
			<content:encoded><![CDATA[<p>Hello again, everyone! As I&#8217;m sure you already know, <a href="http://weblogs.asp.net/scottgu/archive/2012/02/19/asp-net-mvc-4-beta.aspx">ASP.NET MVC 4 beta</a> is available and it has some fantastic stuff in it! One of the interesting bits is the latest <a href="http://nuget.org/packages/AspNetWebApi">ASP.NET Web API</a>.</p>
<p>Looking at that, I&#8217;m absolutely certain you&#8217;re thinking the same thing Glenn Block was <a href="http://twitter.com/gblock/statuses/171124835810942976">saying on Twitter</a>:</p>
<blockquote><p>
<a href="http://twitter.com/gblock">@gblock</a>: hmm I really wish there was an <a href="http://owin.org">Owin</a> adapter for <a href="http://twitter.com/search/%23aspnetwebapi">#aspnetwebapi</a>! /cc:<a href="http://twitter.com/loudej">@loudej</a>
</p></blockquote>
<p>Wish no longer! Gate has a new drop available, version 0.3.4, and it contains a Get.Adapters.AspNetWebApi package which does exactly that &#8211; enabling you to mix the Web API into your OWIN based web applications.</p>
<p>Let&#8217;s take a look at how that feels. That should be even easier than before because of a few more things that are new in Gate &#8211; a handful of Quickstart nuget packages, and a Ghost &#8220;generic host&#8221; process which lets you use any of the available OWIN http servers interchangeably. Neat, right? Let&#8217;s jump right into that!<br />
<span id="more-857"></span><br />
First &#8211; start with a new &#8220;ASP.NET Empty Web Application&#8221; </p>
<p><a href="http://whereslou.com/wp-content/uploads/2012/02/NewWebProject1.png"><img src="http://whereslou.com/wp-content/uploads/2012/02/NewWebProject1.png" alt="" title="New ASP.NET Empty Web Application" width="663" height="469" class="alignnone size-full wp-image-866" /></a></p>
<p>Then &#8211; to make it &#8220;really empty&#8221; &#8211; let&#8217;s remove a <strong>bunch</strong> of references. This step is optional, but should be very satisfying if you want to see some minimalism in action. Quickest way is to select the last assembly reference and lean on the &#8220;delete&#8221; key.</p>
<p><a href="http://whereslou.com/wp-content/uploads/2012/02/RemoveReferences.png"><img src="http://whereslou.com/wp-content/uploads/2012/02/RemoveReferences.png" alt="" title="Remove References" width="600" height="443" class="alignnone size-full wp-image-868" /></a></p>
<p>Finally let&#8217;s add the meta-package <strong>Gate.Quickstart.AspNetWebApi</strong> from Nuget.org.</p>
<pre class="brush: plain; title: ;">
PM&gt; Install-Package Gate.Quickstart.AspNetWebApi
Attempting to resolve dependency 'Gate.Quickstart.Core (≥ 0.3.4)'.
Attempting to resolve dependency 'Gate.Hosts.AspNet (≥ 0.3.4)'.
Attempting to resolve dependency 'Gate.Builder (≥ 0.3.4)'.
Attempting to resolve dependency 'Owin (≥ 0.7.0)'.
Attempting to resolve dependency 'Microsoft.Web.Infrastructure (≥ 1.0.0.0)'.
Attempting to resolve dependency 'Gate.Middleware (≥ 0.3.4)'.
Attempting to resolve dependency 'Gate (≥ 0.3.4)'.
Attempting to resolve dependency 'Gate.Adapters.AspNetWebApi (≥ 0.3.4)'.
Attempting to resolve dependency 'AspNetWebApi.Core (≥ 4.0.20126.16343)'.
Attempting to resolve dependency 'System.Net.Http.Formatting (≥ 4.0.20126.16343)'.
Attempting to resolve dependency 'System.Net.Http (≥ 2.0.20126.16343)'.
Attempting to resolve dependency 'System.Web.Http.Common (≥ 4.0.20126.16343)'.
Attempting to resolve dependency 'System.Json (≥ 4.0.20126.16343)'.
</pre>
<p>You can now press F5 and see this run. The quickstart adds an example Startup class -which is using a partial class trick because I wanted you to be able to add more then one demo to the same project. But that&#8217;s not really necessary &#8211; in your own projects a simpler Startup class like this would work exactly the same.</p>
<pre class="brush: csharp; title: ;">
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Gate.Adapters.AspNetWebApi;
using Owin;

namespace HelloEverything
{
    public class Startup
    {
        public void Configuration(IAppBuilder builder)
        {
            var config = new HttpConfiguration(new HttpRouteCollection(&quot;/&quot;));

            config.Routes.MapHttpRoute(
                &quot;Default&quot;,
                &quot;{controller}&quot;,
                new {controller = &quot;Main&quot;});

            builder
                .RunHttpServer(config);
        }

        public void Debug(IAppBuilder builder)
        {
            builder.UseShowExceptions();
            Configuration(builder);
        }
    }

    public class MainController : ApiController
    {
        public HttpResponseMessage Get()
        {
            return new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(&quot;Hello, AspNetWebApi!&quot;)
            };
        }
    }
}
</pre>
<p>Next you should try adding the meta-meta-package <strong>Gate.Quickstart.All</strong>. Then you&#8217;ll be able to press F5 to see a demo of everything and the kitchen sink: <a href="http://www.asp.net/web-api">Web API</a>, <a href="http://www.nancyfx.org/">Nancy</a>, <a href="https://github.com/SignalR/SignalR">SignalR</a>, Gate &#8220;test page&#8221;, and Direct output from code (res.Write style).</p>
<p>Direct output is kind of interesting, looks like this:</p>
<pre class="brush: csharp; title: ;">
    public class Startup
    {
        public void Configuration(IAppBuilder builder)
        {
            builder.RunDirect((req,res) =&gt;
            {
                res.ContentType = &quot;text/plain&quot;;
                res.Write(&quot;Hello, &quot;).Write(req.PathBase).Write(req.Path).Write(&quot;!&quot;);
                res.End();
            });
        }
    }
</pre>
<p>Well &#8211; that&#8217;s probably long enough for this post. Next topic &#8211; hopefully soon &#8211; will be about using the Ghost.exe &#8220;generic host&#8221; to run this web application on HttpListener, Kayak, or Firefly.</p>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/XM7kCXjmX1o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2012/02/20/gate-adds-owin-support-for-the-new-asp-net-web-api-beta/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Introducing Dragonfly – another .NET HTTP server</title>
		<link>http://whereslou.com/2012/01/24/introducing-dragonfly-another-net-http-server</link>
		<comments>http://whereslou.com/2012/01/24/introducing-dragonfly-another-net-http-server#comments</comments>
		<pubDate>Tue, 24 Jan 2012 06:40:55 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[dragonfly]]></category>
		<category><![CDATA[OWIN]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://whereslou.com/?p=837</guid>
		<description><![CDATA[Two posts in a month! Hard to believe. This one is to introduce Dragonfly &#8211; which is another 100% C# HTTP server. It&#8217;s designed from the ground up to be an OWIN host, of course, and is entirely non-blocking. This is similar to other open source managed web servers like Kayak and to some extent [...]]]></description>
			<content:encoded><![CDATA[<p>Two posts in a month! Hard to believe.</p>
<p>This one is to introduce <a href="http://loudej.github.com/dragonfly">Dragonfly</a> &#8211; which is another 100% C# HTTP server. It&#8217;s designed from the ground up to be an OWIN host, of course, and is entirely non-blocking. This is similar to other open source managed web servers like <a href="http://kayakhttp.com/">Kayak</a> and to some extent others like <a href="https://github.com/jacksonh/manos">Manos</a>.</p>
<p>Why start another C# HTTP server? Well, to some extent this started as an exercise to have another test harness to help troubleshoot and validate Gate and OWIN, rather than as a functional HTTP server of its own. It has from that grown into something that I felt had enough value to share as a standalone project.<br />
<span id="more-837"></span><br />
So! To try this in a console project:</p>
<pre class="brush: plain; title: ;">
PM&gt; Install-Package Dragonfly
Attempting to resolve dependency 'Gate.Owin (≥ 0.2.1)'.
Successfully installed 'Gate.Owin 0.2.1'.
Successfully installed 'Dragonfly 0.2'.

PM&gt; Install-Package Gate
Attempting to resolve dependency 'Gate.Owin (≥ 0.2.1)'.
Successfully installed 'Gate 0.2.1'.
</pre>
<p>And here&#8217;s a little sample. </p>
<pre class="brush: csharp; title: ;">
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Gate.Owin;

namespace DragonflySample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Sinking the trace is optional, just wanted to show it
            var server = new Dragonfly.Http.ServerFactory(new ConsoleTrace());

            // Create takes an OWIN AppDelegate and port or endpoint.
            // It returns an IDisposable.
            using (server.Create(App, 8080))
            {
                Console.WriteLine(&quot;Running at http://localhost:8080/&quot;);
                Console.WriteLine(&quot;Press enter to exit&quot;);
                Console.ReadLine();
            }
        }

        class ConsoleTrace : Dragonfly.Utils.IServerTrace
        {
            public void Event(TraceEventType type, Dragonfly.Utils.TraceMessage message)
            {
                Console.WriteLine(&quot;[{0} {1}]&quot;, type, message);
            }
        }

        static void App(
            IDictionary&lt;string, object&gt; env,
            ResultDelegate result,
            Action&lt;Exception&gt; fault)
        {
            // some classes in Gate.dll make using OWIN directly a bit easier
            // but in practice you'll probably use a web framework rather than
            // write directly like this

            var request = new Gate.Request(env);
            var response = new Gate.Response(result);

            response.Headers[&quot;X-Foo&quot;] = new[] { &quot;Bar&quot; };
            response.ContentType = &quot;text/html&quot;;

            response
                .Write(&quot;&lt;html&gt;&quot;)
                .Write(&quot;&lt;head&gt;&lt;title&gt;Hello Dragonfly&lt;/title&gt;&lt;/head&gt;&quot;)
                .Write(&quot;&lt;body&gt;&quot;)
                .Write(&quot;&lt;h1&gt;Hello Dragonfly&lt;/h1&gt;&quot;)
                .Write(&quot;&lt;p&gt;You are looking at &quot;)
                .Write(request.Path) // NOTE: this is not url encoded!!!
                .Write(&quot;&lt;/p&gt; &lt;!-- thanks, Nick --&gt;&quot;)
                .Write(&quot;&lt;/body&gt;&quot;)
                .Write(&quot;&lt;/html&gt;&quot;);

            response.Finish();
        }
    }
}
</pre>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/F7cGEdtl1ec" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2012/01/24/introducing-dragonfly-another-net-http-server/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Gate 0.2.1 implementation of OWIN online at NuGet</title>
		<link>http://whereslou.com/2012/01/16/gate-0-2-1-implementation-of-owin-online-at-nuget</link>
		<comments>http://whereslou.com/2012/01/16/gate-0-2-1-implementation-of-owin-online-at-nuget#comments</comments>
		<pubDate>Mon, 16 Jan 2012 19:56:11 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Gate]]></category>
		<category><![CDATA[OWIN]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://whereslou.com/?p=823</guid>
		<description><![CDATA[Hello everyone! First &#8211; to break the cardinal rule of posting on stale blogs &#8211; it&#8217;s been nine months!? Time flies! Okay, now that&#8217;s out of the way. The topic of this post is OWIN &#8211; specifically the 0.2.1 refresh of the Gate reference implementation which has been released to NuGet.org. You can test-drive these [...]]]></description>
			<content:encoded><![CDATA[<p>Hello everyone! First &#8211; to break the cardinal rule of posting on stale blogs &#8211; it&#8217;s been nine months!? Time flies! Okay, now that&#8217;s out of the way. </p>
<p>The topic of this post is <a href="http://owin.org/">OWIN</a> &#8211; specifically the 0.2.1 refresh of the <a href="https://github.com/owin/gate">Gate reference implementation</a> which has been <a href="http://nuget.org/packages/Gate">released to NuGet.org</a>. </p>
<p>You can test-drive these bits yourself, if you would like, from a simple C# console application. I&#8217;m assuming <a href="http://nuget.org/">you have NuGet installed</a>, right? Good! So in a new console app (HelloWorld.exe in my case) from the <strong>Package Manager Console</strong> install either <strong>Gate.Stack.Kayak.Nancy</strong> or <strong>Gate.Stack.HttpListener.Nancy</strong>. You can also right-click the project and select <strong>Manage NuGet Packages&#8230;</strong> to accomplish the same thing. The various Gate.Stack.* you will find are umbrella packages that pull in several dependencies and add a few example source files.<br />
<span id="more-823"></span></p>
<pre class="brush: csharp; title: ;">
Package Manager Console Host Version 1.6.21215.9133

Type 'get-help NuGet' to see all available NuGet commands.

PM&gt; Install-Package Gate.Stack.Kayak.Nancy
Attempting to resolve dependency 'Gate.Hosts.Kayak (≥ 0.2.1)'.
Attempting to resolve dependency 'Gate.Builder (≥ 0.2.1)'.
Attempting to resolve dependency 'Gate.Owin (≥ 0.2.1)'.
Attempting to resolve dependency 'Kayak (≥ 0.7.2)'.
Attempting to resolve dependency 'Gate.Adapters.Nancy (≥ 0.2.1)'.
Attempting to resolve dependency 'Nancy (≥ 0.9.0)'.
Attempting to resolve dependency 'Gate.Middleware (≥ 0.2.1)'.
Attempting to resolve dependency 'Gate (≥ 0.2.1)'.
</pre>
<p>You&#8217;ll also notice <strong>Example-Startup.cs</strong> and <strong>Example-KayakStarter.cs</strong> have been added. We can look at those in a bit &#8211; but first let&#8217;s add some code to the Program.Main method.</p>
<pre class="brush: csharp; title: ;">
namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(&quot;Running on http://localhost:8080/&quot;);
            KayakStarter.Start(8080, true);
        }
    }

    public class HomeModule : Nancy.NancyModule
    {
        public HomeModule()
        {
            Get[&quot;/&quot;] = _ =&gt; &quot;Hello, Kayak and Nancy!&quot;;
        }
    }
}
</pre>
<p>Now you can run with F5 and browse to http://localhost:8080/ &#8211; Bam! I won&#8217;t spoil the surprise about what you should expect to see. Let&#8217;s also take a quick look at what the two example files are doing.</p>
<pre class="brush: csharp; title: ;">
using System;
using System.Net;
using Kayak;

namespace HelloWorld
{
    public class KayakStarter : ISchedulerDelegate
    {
        public static void Start(int port, bool debug)
        {
            Gate.Hosts.Kayak.KayakGate.Start(
                new KayakStarter(),
                new IPEndPoint(IPAddress.Any, port),
                debug ? &quot;HelloWorld.Startup.Debug&quot; : &quot;HelloWorld.Startup&quot;);
        }

        public void OnException(IScheduler scheduler, Exception e)
        {
        }

        public void OnStop(IScheduler scheduler)
        {
        }
    }
}
</pre>
<p>This is the static <code>Start</code> method we&#8217;re calling from <code>Main</code>. It&#8217;s calling the Gate host glue for Kayak, and it also implements the <code>ISchedulerDelegate</code> interface to be notified of a few critical events from the Kayak server. The final string argument is also interesting &#8211; it is passed to the Gate.Builder assembly and is used to discover and call the Startup method. Let&#8217;s take a look at that Startup method next.</p>
<pre class="brush: csharp; title: ;">
using Gate.Adapters.Nancy;
using Gate.Middleware;
using Gate.Owin;

namespace HelloWorld
{
    public static class Startup
    {
        public static void Configuration(IAppBuilder builder)
        {
            builder
                .RunNancy();
        }

        public static void Debug(IAppBuilder builder)
        {
            builder
                .UseShowExceptions()
                .RunNancy();
        }
    }
}
</pre>
<p>Beautiful, no? :)</p>
<p>The <code>IAppBuilder</code> is the only interface defined by the OWIN reference implementation assembly (Gate.Owin.dll) and it really only has two methods named <code>Use</code> and <code>Build</code>. Your Startup method doesn&#8217;t call those directly, rather you will use the extension methods coming from Middleware and Framework Adapter assemblies you have chosen to add to your application. <code>UseShowExceptions</code> comes from Gate.Middleware.dll and <code>RunNancy</code> comes from Gate.Adapters.Nancy.</p>
<p>In terms of timing you can think of this as the OWIN version of the <code>Global.asax</code>&#8216;s <code>Application_Start</code> method. The <code>IAppBuilder</code> itself is simply stitching together a pipeline, and is something you can think of as the moral equivalent of <a href="https://github.com/rack/rack">Ruby&#8217;s Rack</a>, or <a href="https://github.com/senchalabs/Connect">Node&#8217;s Connect</a> module. It&#8217;s the result of the efforts of the <a href="http://groups.google.com/group/net-http-abstractions">.NET HTTP Abstractions</a> group endeavoring to establish a comparable standard for .NET platform.</p>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/tIVaRLVlh7o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2012/01/16/gate-0-2-1-implementation-of-owin-online-at-nuget/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Is this thing still on?</title>
		<link>http://whereslou.com/2011/04/23/is-this-thing-still-on</link>
		<comments>http://whereslou.com/2011/04/23/is-this-thing-still-on#comments</comments>
		<pubDate>Sat, 23 Apr 2011 23:49:59 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://whereslou.com/2011/04/23/is-this-thing-still-on</guid>
		<description><![CDATA[Hello all! Or at least all of you still tuned in after this huge gap in posting. :) It&#8217;s spring again, Easter weekend, and we&#8217;re celebrating with Brenda&#8217;s sister Michelle and niece Azaria. They&#8217;re staying with us while they transition to Washington. Other news on a professional front, Orchard 1.1 has been released! Time to [...]]]></description>
			<content:encoded><![CDATA[<p>                Hello all! Or at least all of you still tuned in after this huge gap in posting. :)</p>
<p>It&#8217;s spring again, Easter weekend, and we&#8217;re celebrating with Brenda&#8217;s sister Michelle and niece Azaria. They&#8217;re staying with us while they transition to Washington. </p>
<p>Other news on a professional front, Orchard 1.1 has been released! Time to dig in for 2.0 scope and ideas. </p>
<p>Ah! Also will be in Atlanta for a TechEd presentation on &#8220;Writing an ASP.NET MVC ViewEngine&#8221; so if you&#8217;re in town be sure to check that out.</p>
<p>Another thing going on is some community development participation work on the Gate reference implementation of the OWIN spec. It&#8217;s a lot if fun &#8211; you should check that out. </p>
<p>Well, that&#8217;s good for now. Lets see if this mobile blog app actually posts. :)</p>
<p>Posted from WordPress for Windows Phone</p>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/J0hpp7zxU8I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2011/04/23/is-this-thing-still-on/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notes on The Big View Engine Comparison</title>
		<link>http://whereslou.com/2010/11/09/notes-on-the-big-view-engine-comparison</link>
		<comments>http://whereslou.com/2010/11/09/notes-on-the-big-view-engine-comparison#comments</comments>
		<pubDate>Tue, 09 Nov 2010 20:22:36 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[spark]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://whereslou.com/?p=787</guid>
		<description><![CDATA[There was another very interesing comparison of several view engines recently. Some of the Spark syntax isn&#8217;t exactly how I would have done things, so I thought I would respond with some of those notes. I was going to add a comment, but wanted to be able to preview code samples. So here are some [...]]]></description>
			<content:encoded><![CDATA[<p>There was another very interesing <a href="http://www.ironshay.com/post/The-Big-View-Engine-Comparison-e28093-Razor-vs-Spark-vs-NHaml-vs-Web-Forms-View-Engine.aspx">comparison of several view engines </a>recently. Some of the Spark syntax isn&#8217;t exactly how I would have done things, so I thought I would respond with some of those notes. I was going to add a comment, but wanted to be able to preview code samples. </p>
<p>So here are some thoughts.<br />
<span id="more-787"></span></p>
<h3>Displaying Variable Content</h3>
<p>Original</p>
<pre class="brush: xml; title: ;">
${Html.Encode(ViewData[&quot;Message&quot;])}
</pre>
<p>Spark auto-encodes if you enabled that, so you wouldn&#8217;t need the Html.Encode.</p>
<pre class="brush: csharp; title: ;">
${ViewData[&quot;Messages&quot;]}
</pre>
<p>You can also declare property accessors to view data dictionary.</p>
<pre class="brush: csharp; title: ;">
&lt;viewdata Messages=&quot;string&quot;/&gt;
${Messages}
</pre>
<h3>Conditions</h3>
<p>Original</p>
<pre class="brush: xml; title: ;">
&lt;if condition='DateTime.Now.Hour &gt; 20 || DateTime.Now.Hour &lt; 6'&gt;
  &lt;p&gt;It's bed time!&lt;/p&gt;
&lt;/if&gt;
&lt;else&gt;
  &lt;p&gt;Party!&lt;/p&gt;
&lt;/else&gt;
</pre>
<p>There&#8217;s yet another way of doing conditions when else/if and else are involved that I kind of prefer, personally.</p>
<pre class="brush: xml; title: ;">
&lt;test if='DateTime.Now.Hour &gt; 20 || DateTime.Now.Hour &lt; 6'&gt;
  &lt;p&gt;It's bed time!&lt;/p&gt;
&lt;else/&gt;
  &lt;p&gt;Party!&lt;/p&gt;
&lt;/test&gt;
</pre>
<p>and there&#8217;s also inline code support if you prefer</p>
<pre class="brush: xml; title: ;">
# if(DateTime.Now.Hour &gt; 20 || DateTime.Now.Hour &lt; 6) {
  &lt;p&gt;It's bed time!&lt;/p&gt;
# } else {
  &lt;p&gt;Party!&lt;/p&gt;
# }
</pre>
<h3>Loops</h3>
<p>Original</p>
<pre class="brush: xml; title: ;">
&lt;var list='new List&lt;String&gt;() { &quot;WebForms&quot;, &quot;Razor&quot;, &quot;Spark&quot;, &quot;NHaml&quot; }'/&gt;
&lt;ul&gt;
  &lt;li each='var item in list'&gt;
    ${item}
  &lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Loops looks pretty good, though (as always) if you prefer to inline code you could also use something like the following</p>
<pre class="brush: xml; title: ;">
# var list = new List&lt;string&gt;() { &quot;WebForms&quot;, &quot;Razor&quot;, &quot;Spark&quot;, &quot;NHaml&quot; };
&lt;ul&gt;
# foreach (var item in list) {
  &lt;li&gt;${item}&lt;/li&gt;
# }
&lt;/ul&gt;
</pre>
<h3>Displaying a Form</h3>
<p>Original</p>
<pre class="brush: xml; title: ;">
&lt;viewdata model=&quot;MvcApplication1.Models.LogOnModel&quot;/&gt;

# using (Html.BeginForm()) {
    ${Html.ValidationSummary(true, &quot;Login was unsuccessful.&quot;)}
    &lt;div&gt;
        &lt;fieldset&gt;
            &lt;legend&gt;Account Information&lt;/legend&gt;

            &lt;div class=&quot;editor-label&quot;&gt;
                ${Html.LabelFor(m =&gt; m.UserName)}
            &lt;/div&gt;
            &lt;div class=&quot;editor-field&quot;&gt;
                ${Html.TextBoxFor(m =&gt; m.UserName)}
                ${Html.ValidationMessageFor(m =&gt; m.UserName)}
            &lt;/div&gt;

            &lt;div class=&quot;editor-label&quot;&gt;
                ${Html.LabelFor(m =&gt; m.Password)}
            &lt;/div&gt;
            &lt;div class=&quot;editor-field&quot;&gt;
                ${Html.PasswordFor(m =&gt; m.Password)}
                ${Html.ValidationMessageFor(m =&gt; m.Password)}
            &lt;/div&gt;

            &lt;div class=&quot;editor-label&quot;&gt;
                ${Html.CheckBoxFor(m =&gt; m.RememberMe)}
                ${Html.LabelFor(m =&gt; m.RememberMe)}
            &lt;/div&gt;

            &lt;p&gt;
                &lt;input type=&quot;submit&quot; value=&quot;Log On&quot; /&gt;
            &lt;/p&gt;
        &lt;/fieldset&gt;
    &lt;/div&gt;
# }
</pre>
<p>This one is particularly interesting if you use the new bindings feature to create tags for your favorite helpers.</p>
<pre class="brush: xml; title: ;">
&lt;viewdata model=&quot;MvcApplication1.Models.LogOnModel&quot;/&gt;

&lt;Form&gt;
    &lt;ValidationSummary ExcludePropertyErrors=&quot;true&quot;&gt;
        Login was unsuccessful.
    &lt;/ValidationSummary&gt;
    &lt;div&gt;
        &lt;fieldset&gt;
            &lt;legend&gt;Account Information&lt;/legend&gt;

            &lt;div class=&quot;editor-label&quot;&gt;
                &lt;Label For=&quot;UserName&quot;/&gt;
            &lt;/div&gt;
            &lt;div class=&quot;editor-field&quot;&gt;
                &lt;TextBox For=&quot;UserName&quot;/&gt;
                &lt;ValidationMessage For=&quot;UserName&quot;/&gt;
            &lt;/div&gt;

            &lt;div class=&quot;editor-label&quot;&gt;
                &lt;Label For=&quot;Password&quot;/&gt;
            &lt;/div&gt;
            &lt;div class=&quot;editor-field&quot;&gt;
                &lt;Password For=&quot;Password&quot;/&gt;
                &lt;ValidationMessage For=&quot;Password&quot;/&gt;
            &lt;/div&gt;

            &lt;div class=&quot;editor-label&quot;&gt;
                &lt;CheckBox For=&quot;RememberMe&quot;/&gt;
                &lt;Label For=&quot;RememberMe&quot;/&gt;
            &lt;/div&gt;

            &lt;p&gt;
                &lt;input type=&quot;submit&quot; value=&quot;Log On&quot; /&gt;
            &lt;/p&gt;
        &lt;/fieldset&gt;
    &lt;/div&gt;
&lt;/Form&gt;
</pre>
<h3>Conclusions</h3>
<p>So &#8211; as with all things &#8211; each of the view engines will have lots of ways to approach any problem. Just wanted to add some of my own personal preferences to the mix for the Spark column out of band. Thanks again to <a href="http://twitter.com/ironshay">Shay Friedman</a> for writing up the comparison, and also for his work supporting IronRuby.</p>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/8xod8kawwuo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2010/11/09/notes-on-the-big-view-engine-comparison/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Orchard moving along nicely</title>
		<link>http://whereslou.com/2010/09/12/orchard-moving-along-nicely</link>
		<comments>http://whereslou.com/2010/09/12/orchard-moving-along-nicely#comments</comments>
		<pubDate>Mon, 13 Sep 2010 03:01:36 +0000</pubDate>
		<dc:creator>Louis</dc:creator>
				<category><![CDATA[orchard]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://whereslou.com/?p=771</guid>
		<description><![CDATA[There are three cornerstones to a content management platform &#8211; extensibility, storage, and display. The first milestone of Orchard revolved around the first two and the next push is taking a look at the third. It takes a large leap of faith to retrofit the rendering system of an application. If the retrofit is based [...]]]></description>
			<content:encoded><![CDATA[<p>There are three cornerstones to a content management platform &#8211; extensibility, storage, and display. The first milestone of Orchard revolved around the first two and the next push is taking a look at the third.</p>
<p>It takes a large leap of faith to retrofit the rendering system of an application. If the retrofit is based on significantly different concepts you don&#8217;t really have a choice but to enter a period of almost total loss of functionality. So here we are &#8211; jumping the canyon &#8211; looking forward to getting all of the modules back online over a new display system.</p>
<p>There are a lot of things we want to accomplish with what&#8217;s being designed. Trying to capture as many of the simple qualities you&#8217;d want from a direct template based approach along with the flexibility, power, and control you&#8217;ll need in a system like Orchard.<br />
<span id="more-771"></span><br />
To that end we&#8217;re taking a lot of proven concepts and patterns, and bringing them all together as cleanly and transparently as possible with the tools we have at our disposal. Much of this will be leaning heavily on the IoC capabilities under Orchard&#8217;s extensibility story, and the dynamic capabilities provided by the upgrade to the latest dotnet fwk.</p>
<p><img class="alignright size-full" src="http://martinfowler.com/eaaCatalog/twoStageViewSketch.gif" alt="Two step view" /> At the heart of the beast are some very old patterns. The most significant one is the <a href="http://martinfowler.com/eaaCatalog/twoStepView.html">Two Step View</a> which: <em>Turns domain data into HTML in two steps: first by forming some kind of logical page, then rendering the logical page into HTML.</em> Looking at this one way you could think of this as a form of ViewModel. Looking at it another you could say this is a WebControl style approach. The goal is to be something in-between that&#8217;s not really one or the other.</p>
<p>This approach has very large implications in the way Orchard controllers and views relate to each other. There is a degree of overhead to using strongly typed view models &#8211; I like them myself but they are an additional class to create. An even larger problem &#8211; they are only meaningful to code that has a strongly typed compile time knowledge of their existence. Know what I mean? If you&#8217;re a module that wants to monitor or alter material as it&#8217;s displayed there&#8217;s not much you can do without getting heavily into reflection, and even then you&#8217;re not really free to alter the page results beyond manipulating the data within the bounds of the declared viewmodel structures.</p>
<p>For those reasons <a href="http://weblogs.asp.net/bleroy/archive/2010/08/16/clay-malleable-c-dynamic-objects-part-1-why-we-need-it.aspx">we explored and are delving into the use of dynamic object behaviors</a> layered on top of normal clr types as the basis of a &#8220;Shape&#8221; page object model. The idea of a shape is to be a representation of the domain model that&#8217;s halfway into the page display vernacular &#8211; it shows a hierarchy that reflects logically what will be rendered, carries forward the information from the domain model in a way that&#8217;s still connected to it&#8217;s source, and may carry forward some rendering-specific information (like css classes and additional html attributes) but stops short of determining or being connected to the specific html that will be produced.</p>
<p>That last point is key &#8211; and it is the quality that stops the page object model from being compared to a web control rendering approach. Each web control knows how to render itself, that&#8217;s its job, but in this case the task of converting the shapes into html is a seperate concern. Essentially implementing a <a href="http://www.netobjectives.com/PatternRepository/index.php?title=TheStrategyPattern">Strategy</a> and <a href="http://www.netobjectives.com/PatternRepository/index.php?title=TheAdapterPattern">Adapter</a> pattern, there is a display manager available via @Display(anyShape) which will use the appropriate template or method to render the given shape.</p>
<p>It&#8217;s really nice, too, the fact that it can be any template or method. So if you have a Message shape, for example, the realization of shapes of type &#8220;Message&#8221; could be bound against either a view template like Message.cshtml or a public method on an IoC component with the [Shape] attribute. You can override or augment the description of a shape&#8217;s binding in modules or in your theme as well &#8211; the [Shape] method for the default Message rendering method in a module can be overridden with a Message.cshtml template in the active theme. </p>
<p>Of course this doesn&#8217;t mean a page object model will be returned from all controller actions in Orchard &#8211; it would be counterproductive to go to that extreme. But it&#8217;s a great way of representing information that is meant to be explored and manipulated by code from other modules. Forms that are expected to be extensible, for example, or the contents of page zones like sidebars. Where to use it, and what set of core shapes and their granularity, is all part of the art of software design in comparing alternatives.</p>
<img src="http://feeds.feedburner.com/~r/WheresLou/~4/YZg1A0u_l_g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://whereslou.com/2010/09/12/orchard-moving-along-nicely/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
