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

<channel>
	<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Elegant Code &#187; web</title>
	<atom:link href="http://elegantcode.com/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 10:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Phenergan For Sale</title>
		<link>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-fancy-with-nancy-introduction</link>
		<comments>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 20:30:45 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/</guid>
		<description><![CDATA[Right from very first day that I announced Nancy Phenergan For Sale, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, buy cheap Phenergan, [...]]]></description>
			<content:encoded><![CDATA[<p> <p>Right from very first day that I announced <a title="Visit Nancy on Github" href="http://nancyfx.org" target="_blank">Nancy</a> <b>Phenergan For Sale</b>, to the world, the pace that things have moved forward has been nothing short of amazing. Nancy was always meant to be developed right out there with the community and let me tell you that I have not been disappointed, <b>buy cheap Phenergan</b>, <b>Phenergan wiki</b>, the community answered the call. Pull request nr, <b>australia, uk, us, usa</b>.  <b>Phenergan no prescription</b>, 116 was sent in the other day and over 26 people (with a couple of more having pending requests) have contributed code to Nancy – some of them on multiple occasions.</p>  <p>Since then Nancy has gained an impressive feature lists such as bootstrapping capabilities for all the major Inversion of Control containers, view engine support (spark, <b>is Phenergan safe</b>, <b>Low dose Phenergan</b>, razor, ndjango and a Nancy specific engine), <b>Phenergan brand name</b>, <b>Phenergan online cod</b>, hosts for asp.net, WCF, <b>online buying Phenergan</b>, <b>Buy Phenergan from mexico</b>, self-hosting and even one of the (if not THE) first OWIN compatible host, cookies, <b>Phenergan pharmacy</b>, <b>Phenergan used for</b>, sessions, embedded views, <b>where can i find Phenergan online</b>, <b>Phenergan without prescription</b>, pre- and post-request pipeline, security (authentication and authorization) and many many more, <b>Phenergan description</b>.  <b>Purchase Phenergan online no prescription</b>, The list keeps on growing.</p>  <p>There have also been several individual and companies that have started writing applications on Nancy, ranging from simple proof of concept applications to actually taking Nancy into a production environment is software that’s sold to customers, <b>where can i buy Phenergan online</b>. We’ve also gotten to see Nancy run on mac and Linux thanks to mono support and we think that’s just awesome!</p>  <h2>So what’s the fuzz all about?!</h2>  <p>The goal of Nancy is to provide a no fuzz, low ceremony framework for building web applications, <b>Phenergan For Sale</b>.  <b>Online buying Phenergan hcl</b>, One of the key concepts that’s applied when working on Nancy is that everything should have a “super-duper-happy-path” implementation, you shouldn’t have to jump though hops to write your websites there should be a sensible default for everything, <b>discount Phenergan</b>.  <b>Phenergan use</b>, Simplicity is key, but not at the expense of power.</p>  <p>At first glance you wouldn’t know it, <b>Phenergan without a prescription</b>, <b>Phenergan samples</b>, but pretty much everything in Nancy is customizable. It’s intentionally been designed to stay out of your way, <b>Phenergan alternatives</b>, <b>My Phenergan experience</b>, but should you find yourself in need to change a specific behavior Nancy will make it as frictionless as could be.</p>  <p>Right from the get go, Nancy was built to not rely on a specific environment to be able to run, <b>rx free Phenergan</b>.  <b>Phenergan schedule</b>, We built the concept of host adapters and they site right in between Nancy and what ever environment she might run on.  <b>Phenergan For Sale</b>, Out of the box we currently supply hosts for running on top of ASP.NET, WCF, OWIN and a self-host (built on httplistner), but the list is sure to expand and writing adapters is easy. </p>  <p>There is no dependency, <b>Phenergan canada, mexico, india</b>, <b>Phenergan from mexico</b>, what so ever, on System.Web from the Nancy core assembly so you can, <b>Phenergan reviews</b>, <b>Fast shipping Phenergan</b>, without any problem, embed Nancy in your applications and so on, <b>Phenergan photos</b>.  <b>Kjøpe Phenergan på nett, köpa Phenergan online</b>, ReST-based end-point in your application. Sure why not?, <b>cheap Phenergan</b>.  <b>Phenergan mg</b>, </p>  <h2>Bla, bla, <b>Phenergan blogs</b>, <b>Phenergan schedule</b>, bla – show me the codez!</h2>  <p>Alrighty then. To give you an idea of how it is to work with Nancy, we will be building a simple Hello World (surprise!) Nancy web application, <b>Phenergan For Sale</b>. The application will be built to run on ASP.NET, <b>purchase Phenergan online</b>, <b>Phenergan from mexico</b>, but it could just as easily have been running on any of the others hosts (just swap it out, no code changes needed).</p>  <p>To get started create a new <strong><em>ASP.NET Empty Web Application</em></strong> project (don’t worry, <b>buy generic Phenergan</b>, <b>Phenergan duration</b>, we have our own project template but let’s skip those and get right to the fun stuff). Once you’ve created the application it’s time to grab Nancy. You could visit <a title="Visit the Nancy respository at github" href="http://nancyfx.org" target="_blank">out repository</a> to download the source and build the binaries, or you could choose the easy way; use <a title="Visit the NuGet site" href="http://nuget.org" target="_blank">NuGet</a> to grab the bits we need.</p>  <p>We are going to go with the NuGet packages, so grab the <strong><em>Nancy.Hosting.Aspnet</em></strong> nuget. Not only will this install the adapter required to run Nancy on ASP.NET, but it will also register the adapter in your web.config <em>and</em> grab the Nancy core nuget.  </p>  <p> <b>Phenergan For Sale</b>, That’s it. You have the foundation of a Nancy application running on top of ASP.NET. Now you need contents. So let’s add a module to our project (modules can be added anywhere in your project, Nancy will find them for you).</p>  <p>[gist]<a title="http://gist.github.com/898770" href="http://gist.github.com/898770">http://gist.github.com/898770</a>[/gist]</p>  <p>What you are looking at is a module that responds to a GET request to the root path of your application. When an incoming requests matches those criterion, Nancy will respond with the text <em>“Hello World”</em>. Run the application and verify that I’m not kidding you – it really is as simple as that!</p>  <p>That’s all will show you in this post. In following posts I will be sure to take you on a journey in the world of Nancy and show you things like POST, PUT, DELETE and HEAD requests, injecting dependencies into modules, using response formatters, grabbing parameters from the requested route, complex route syntax, view engines, model binding, before/after request handling (both on request and module level) and much, much more.</p>  <h2>Nancy on the web.</h2>  <p>If you want to talk about Nancy you can find us on <a title="Visit Nancy on Google Groups" href="https://groups.google.com/forum/?pli=1#!forum/nancy-web-framework" target="_blank">Google Groups</a> or on Twitter using the <a title="Check out what people are saying about Nancy on Twitter" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag. You can also reach me on twitter <a href="http://twitter.com/thecodejunkie" target="_blank">@thecodejunkie</a></p>.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://elegantcode.com/?p=4426'>Buy Lexapro Without Prescription</a>. <a href='http://elegantcode.com/?p=4694'>Buy Human Growth Hormone Without Prescription</a>. <a href='http://elegantcode.com/?p=4859'>Buy Triamterene Without Prescription</a>. <a href='http://elegantcode.com/?p=5014'>Buy Quinine Without Prescription</a>. <a href='http://elegantcode.com/?p=4669'>Buy Ventolin Without Prescription</a>. <a href='http://elegantcode.com/?p=4392'>Where can i buy Lipitor online</a>. <a href='http://elegantcode.com/?p=4681'>Buy Betnovate from canada</a>. <a href='http://elegantcode.com/?p=4160'>Lasix price, coupon</a>. <a href='http://elegantcode.com/?p=4606'>Macrobid use</a>. <a href='http://elegantcode.com/?p=5076'>Herbal Retin-A</a>.<br />
<b>Trackbacks from:</b> <a href='http://www.thegriffonnews.com/?p=10159'>Phenergan For Sale</a>. <a href='http://www.independentworldreport.com/?p=1545'>Phenergan For Sale</a>. <a href='http://www.themusclecarplace.com/?p=5471'>Phenergan For Sale</a>. <a href='http://blog.farmland.org/?p=2642'>Phenergan For Sale</a>. <a href='http://home.officesnapshots.com/?p=257'>Phenergan For Sale</a>. <a href='http://www.quarterlives.com/?p=866'>Where can i buy Phenergan online</a>. <a href='http://www.greatgreengoods.com/?p=3503'>Canada, mexico, india</a>. <a href='http://www.macneilbmx.com/blog/?p=6299'>Phenergan for sale</a>. <a href='http://social-blend.com/?p=1259'>Where can i buy cheapest Phenergan online</a>. <a href='http://www.leaduganda.org/?p=505'>Order Phenergan online c.o.d</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/04/01/getting-fancy-with-nancy-introduction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nancy, the little community-powered framework that could</title>
		<link>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nancy-the-little-community-powered-framework-that-could</link>
		<comments>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:50:50 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/</guid>
		<description><![CDATA[Two months ago, on the day, I first announced Nancy here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled [...]]]></description>
			<content:encoded><![CDATA[<p>Two months ago, on the day, I first <a title="Read the Nancy announcement post" href="http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/" target="_blank">announced Nancy</a> here on Elegant Code as my new open-source project. I could never have anticipated the chain of events that would take place during the following two months. My tweet about the blog post got re-tweeted more times than I can remember and the post filled up with, mostly, awesome feedback.</p>  <p>It took about and week and then Nancy got the first pull request on <a title="Visit Nancy on Github" href="https://github.com/thecodejunkie/Nancy" target="_blank">her github account</a> and from there it started to build up momentum quite fast. At the time of this writing there’s been 53 pull requests, by about 20 different people, for all kinds of features, bug fixes, custom hosts… you name it. Not bad, eh?</p>  <p>Not only that, but Nancy has managed to pull together a nice little community, <a title="Visit the Google Group for Nancy" href="https://groups.google.com/forum/#!forum/nancy-web-framework" target="_blank">over at Google Groups</a>, where the future of Nancy is being discussed every day. She’s also getting some attention on Twitter and we’re trying to gather it all under the <a title="Checkout what&#39;s being said on Twitter with the #NancyFx hashtag" href="http://twitter.com/#search?q=%23NancyFx" target="_blank">#NancyFx</a> hashtag and seems like every day there is a new face popping up.</p>  <p>In the initial commit there were a couple of abstractions and light extension points in place for things like custom hosts, view engines and response formatters. These turned out to be a very smart move, because the community really embraced and ran with them. Let me recap some of the things that has happened since day zero</p>  <ul>   <li><strong>View engines;</strong> there are currently support for Spark, Razor, NDjango and Static templates. We did have support for NHaml for a while, but that community seems to have gone into hibernation, so the decision was made to pull it and not waste dev cycles on it until there was a demand </li>    <li><strong>Inversion of Control integration;</strong> this has been one of the big one. Right from the very first beginning I wanted Nancy to be a self composing framework, that is have a small internal container that glued the framework together at runtime. I also wanted the possibility to register module level dependencies. It took a while and a couple of iterations, but we finally settled on a design and made <a title="Checkout the TinyIoC repository on Github" href="https://github.com/grumpydev/TinyIoC" target="_blank">TinyIoC</a> the internal container. It was very important that it was a transparent experience to the end user and unless you have a need for it, you never know it’s there. Not only that, but thanks to community contributions we’ve managed to create hooks (known as bootstrappers in Nancy) for all of the major players such as StructureMap, Autofac, Unity, Ninject and Windsor. Using one of these container with Nancy is a very easy thing to do and only adds one more file to your project </li>    <li><strong>Response formatters;</strong> one of the powerful features in Nancy is the response model and how it lets you return different kinds of things and leverages implicit cast operators to hide the complexity behind it. Thanks to the awesome Nancy community we now have the capability to return JSON, XML, images and perform redirect responses. It’s super easy to write a response extension and hook it into Nancy, so if you have any ideas…. </li>    <li><strong>Bug fixes;</strong> yeah I know, it’s shocking, but it’s still true. Every now and then someone finds a bug but, more importantly, most of the time the same person is part of contributing a patch to resolve it! </li>    <li><strong>Hosts;</strong> Nancy has been designed with the idea of being able to run in multiple environments and shipped with a host to run on top of ASP.NET. Right now we have additional hosts for running Nancy on a WCF host and on a stand alone host. There are more of them on the way </li>    <li><strong>HEAD</strong> <strong>requests; </strong>the first release of Nancy supported GET, POST, PUT and DELETE requests, but thanks to a clever little contributions she now also serves up HEAD requests </li>    <li><strong>Cookies;</strong> not he ones you can eat…. </li>    <li><strong>Cookie based sessions; </strong>I think this is also self describing.. oh… yeah they are encrypted in case you were wondering! </li>    <li><strong>Mono;</strong> we’ve started to seriously look at getting Nancy to run on top of the up coming mono 2.10 release (we need the improvements they’ve made to the dynamic keyword) and have already managed to run the sample application on both Linux and Mac OSX. Moving forward mono is going to be a supported and equally priorities platform to support </li>    <li><strong>Visual Studio templates</strong>; these are still work in progress but right now I have the ability to new up a new Nancy project, based on the html5boilerplate … and we have a bare bone template in the making </li>    <li><strong>Buildscript;</strong> a couple of days a go we added what every self respecting open-source project needs; a build script. We choose to use Rake (that’s a ruby powered format, for those of you that’s never seen it before) and make use of the excellent <a title="Read more about Albacore on the project website" href="http://albacorebuild.net/" target="_blank">Albacore</a> gem, but the awesome <a title="Visit Derick Bailey on Twitter" href="http://twitter.com/derickbailey" target="_blank">Derick Bailey</a> </li> </ul>  <p>I’ve probably forgotten a bunch of things, there’s been so much going on that I can’t remember it all without looking at the commit history! That said, there are still things we want to put in place and there are already extensive discussions on the user group about them</p>  <ul>   <li>Security </li>    <li>Content negotiation </li>    <li>OWIN hosting (we’re keeping track of the <a title="Read more about OWIN on the .NET Abstractions User Group" href="https://groups.google.com/forum/#!forum/net-http-abstractions" target="_blank">OWIN 1.0</a> specification) </li>    <li>Self-hosting (<a title="Visit Benjamin van der Veen&#39;s website" href="http://bvanderveen.com/" target="_blank">Benjamin van der Veen</a>, if you are reading this – maybe Kayak can be a candidate!) </li> </ul>  <h2>The one thing that we can’t seem to pull of</h2>  <p>Is to find a designer to design a proper logo for the framework! We are in desperate need to get an awesome logo that we can put everywhere and start creating a website. So if you know any good designers that wouldn’t mind putting in some time in designing an awesome logo for an open-source project (read <em>pro bono</em>) and please tell them about us and about Nancy! A while back I created <a href="https://groups.google.com/d/msg/nancy-web-framework/DlTrYKdBCQI/qCjLvhCdL9MJ" target="_blank">a post about the Nancy logo</a> on our user group. It contains some information on the philosophy and goals for a logo for Nancy. I can’t stress enough how much I would appreciate if you took this and shared it with your designer friends!</p>  <p>As always, if you want to ping me either drop me a comment right here on the blog or find me on on Twitter account <a title="Find me on Twitter on my @TheCodeJunkie account" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a></p>  <p>… I can’t help to wonder what Nancy will be like in another two months! </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2011/01/28/nancy-the-little-community-powered-framework-that-could/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Introducing Nancy, a lightweight web framework inspired by Sinatra</title>
		<link>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra</link>
		<comments>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 14:57:13 +0000</pubDate>
		<dc:creator>Andreas Håkansson</dc:creator>
				<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[Nancy]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/</guid>
		<description><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, [...]]]></description>
			<content:encoded><![CDATA[For a couple of weeks I have been keeping myself busy with open-source stuff. One of the things has been to spike out a web framework idea and later on turn it into a real project. The project is inspired, but not a clone, by the Sinatra web framework built on Ruby. The name, Nancy, is a reference to Nancy Sinatra, the daughter of Frank Sinatra.

There are quite of lot of things that I want to put into the framework, but it is functional in its current state. One of the goals for Nancy is to make it run on other environment and platforms, other than ASP.NET / IIS and there are spikes taking place to run it on <a title="Read more about the mono project at their webpage" href="http://mono-project.com" target="_blank">Mono</a> with <a title="Read more about FastCGI on wikipedia" href="http://en.wikipedia.org/wiki/FastCGI" target="_blank">FastCGI</a>, making it possible to run on a bunch of other platforms. However, although this is the goal, the current source code does not provide any helpers to make that possible. Right now it only ships with an IHttpHandler that acts as an adaptor between ASP.NET / IIS and the Nancy engine.

The project is built using C# and makes use of <a title="Visit the xUnit project website" href="http://xunit.codeplex.com/" target="_blank">xUnit</a>, <a title="Visit the MSpec project website" href="https://github.com/machine/machine.specifications" target="_blank">MSpec</a> and <a title="Visit the FakeItEasy project website" href="http://code.google.com/p/fakeiteasy/" target="_blank">FakeItEasy</a>

The key component in a Nancy application is the modules. This is where you create actions, which are handlers for a given request type at a given path. Let me show you what I mean
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
What you are looking at here is the foundation of a very small application that will responde to GET requests to the root URL of the site, and DELETE requests to <em>/products/{id}</em> where <em>{id}</em> is a parameter placeholder. All parameters will be captured and injected into the action, like you see with <em>parameters.id<strong>.</strong></em>The entire route handling mechanism is swappable, so you could write your own handler that were able to interpreted the route syntax that you prefer. A module can also be declared with a <em>module path</em>, meaning that all action routes, that you declare in the module, will be relative the module path.

For example if you were to do
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module() : base("/foo")
    {
        Get["/"] = parameters =&gt; {
            return "This is the site route";
        };

        Delete["/product/{id}"] = parameters =&gt; {
            return string.Concat("You requested that the following product should be deleted: ", parameters.id);
        };
    }
}</pre>
The the application would respond to requests sent to <em>/foo</em> and <em>/foo/product/{id}</em>. You can of course have as many modules as you want. Nancy will detect them all and figure out which action that should be invoked. There are also some nice ticks in there for return values. In the examples above you get the impression that you are expected to return a <em>string</em>, and this is not the case. In fact each action returns an instance of a <em>Response</em> type. What you are seeing is the result of some implicit cast operators. There are a couple of them declared
<pre class="brush: csharp;">public class Module : NancyModule
{
    public Module()
    {
        Get["/"] = parameters =&gt; {
            return "Returning a string";
        };

        Get["/404"] = parameters =&gt; {
            return 404;
        };

        Get["/500"] = parameters =&gt; {
            return HttpStatusCode.NotFound;
        };
    }
}</pre>
All of these will work and send back a valid HttpResponse (including headers) to the client. You can of course explicitly return a <em>Response</em> instance which opens up for some nice customization. A module in Nancy also declares a pair of properties called <em>View</em> and <em>Response</em>. Both of these have an interface return type and each of them are empty marker interfaces that you can use to wire up extension methods. The <em>View</em> property is meant to be used for view engine integration and in an unpublished spike (still needs some more work) I’ve wired up the <a title="Read more about the spark viewengine" href="http://www.sparkviewengine.com/" target="_blank">http://www.sparkviewengine.com/</a> so that Nancy is able to process spark files. This is an example of what that looks like
<pre class="brush: csharp;">public class SparkModule : NancyModule
{
    public SparkModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return View.Spark("user.spark", parameters);
        };
    }
}</pre>
Of course all of this is work in progress and the syntax might change. The goal is to support all of the popular view engines and if you are up to the task of implementing support for one of those, please let me know – I would love the help!

The <em>Response</em> property is meant to be used for extensions that help format the response in different ways. A test I have running locally is an extension method that enables me to return json formatted data.
<pre class="brush: csharp;">public class JsonModule : NancyModule
{
    public JsonModule()
    {
        Get["/user/{name}"] = parameters =&gt; {
            return Response.AsJson(someObject);
        };
    }
}</pre>
Of course I would like for Nancy to ship with a healthy set of these response helpers, so feel free to chip in!

Oh, there is one last property that you can use and that is the <em>Request</em> property which gives you access to the current request information, so that you can use it from inside of your action handlers. Right now it is limited to the requested path and verb, but the goal is to have a rich representation of the current request – what stuff would you like to see in it?
<pre class="brush: csharp;">public class RequestModule : NancyModule
{
    public RequestModule()
    {
        Get["/"] = parameters =&gt; {
            return string.Format("You requested {0}", Request.Path);
        };
    }
}</pre>
One thing I would like to mention about the action handlers and their routes. If there are two or more routes that are a match to the current request, Nancy is going to select the one that has the most matching <em>static path segments</em> before a parameter placeholder is reached (but all segment has to be filled!). What does this mean? Take the following routes
<pre class="brush: csharp;">/foo/{value}
/foo/bar/{value}</pre>
The first route has one static path segment (/foo) and the second one has two (/foo/bar). So for a request to
<pre class="brush: csharp;">/foo/bar</pre>
The first route will be selected, but for
<pre class="brush: csharp;">/foo/bar/baz</pre>
the second route will be selected. It also important to understand that in Nancy, all path parameters are greedy, not like in ASP.NET MVC where you can have one greedy (indicated by a star *) and has to be at the end. If you define a route
<pre class="brush: csharp;">/foo/{value1}/bar/{value2}</pre>
you can invoke it with
<pre class="brush: csharp;">/foo/this/is/some/segments/bar/and/then/some/more</pre>
and you will end up with
<pre class="brush: csharp;">{value1} = /this/is/some/segments
{value2} = /and/then/some/more</pre>
Of course, like I said before, this is how the default route handler works and if you don’t like it you can write your own, all you have to do is implement a single interface and tell Nancy to use it.

So before I end this post, let me tell you about some of the things that are planned to be included in Nancy as soon as possible
<ul>
	<li>A much richer request object. Nancy uses it’s own Request object and is not tied down the the one found in ASP.NET. I want to support a rich and easy to use model for request information. If you have any suggestions on the structure of this object, please let me know</li>
	<li>The ability to inject dependencies into Nancy modules. I want you to be able to wire up Nancy to use your favorite IoC and have Nancy resolve constructor dependencies of Nancy modules</li>
	<li>Conditions on actions. I want to add an optional predicate on actions like <em>Get[“/foo”, () =&gt; somePredicate]</em>, to give Nancy the ability to select actionsat runtime. For example you might have two identical actions define, but you add a predicate on one of them that made sure that it was only selected if the client was a mobile device. Actions that has a predicate defines should have higher priority than those that do not</li>
	<li>View engine integration. Like I said, the Nancy modules comes with the <em>View</em> property, which is of the type <em>IViewEngine,</em> where you can hook up view engine support. All you need is an adapter that returns a string (or a Response instance). Please let me know if you want to chip in and help wire up one or more view engines</li>
	<li>Ship with a nice bunch of response formatters. These are created by attaching extension methods to the <em>IResponseFormatter</em> interface, which is the property type of the <em>Response</em> property on a Nancy module. I think the formatters should follow a naming convention where you name them <em>As&lt;something&gt;</em></li>
	<li>Self-composed framework. What is mean with this is that I want to build Nancy on top of a tiny, internal, IoC that is used to compose the framework at runtime. It should be exposed in a simple way so that you could swap out components (such as the route matcher, or module discovery mechanism) as you please</li>
	<li>Request and Response interception. The idea is to provide a lightweight way to intercept Nancy requests before they hit the Nancy application and let you either pass the request to the Nancy application or prematurely send back a reply. Combines with the ability to intercept Responses sent by the Nancy application, it should give a nice way of extending Nancy with features like logging and caching. You can think of this as a sort of IHttpModule mechanism</li>
	<li>NuGet presence</li>
	<li>Command line (powershell?) support for spawning up a Nancy application project</li>
	<li>Provide self-hosting somehow</li>
</ul>
There are a bunch of other stuff I have in my head, but I have to give them some more thought to distil proper ideas from them. But please, let me know if you can think of anything more! I want to keep Nancy lightweight and easy to use, so it will probably never be as open-ended as ASP.NET MVC, FubuMVC or Manos de Mano – but we’ll have to wait and see!

You can find the source code at <a title="Visit the Nancy repository at GitHub" href="https://github.com/thecodejunkie/Nancy" target="_blank">my Nancy repository at GitHub</a>. You can also reach me on Twitter at <a title="Visit me on Twitter" href="http://twitter.com/thecodejunkie" target="_blank">@TheCodeJunkie</a>. If you want to talk about Nancy drop me a line in the comments or on Twitter and we can move onto e-mail, gtalk, skype or messenger if needed! I hope you like where Nancy is going!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/11/28/introducing-nancy-a-lightweight-web-framework-inspired-by-sinatra/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>The Web is Not Platform Independent</title>
		<link>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-web-is-not-platform-independent</link>
		<comments>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 20:16:32 +0000</pubDate>
		<dc:creator>John Sonmez</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/</guid>
		<description><![CDATA[There was a time when you wrote a web site and you targeted IE6. That time has long passed. When you really only had to target IE6, you could pretend the web was platform independent. The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time when you wrote a web site and you targeted IE6.</p>  <p>That time has long passed.</p>  <p>When you really only had to target IE6, you could pretend the web was platform independent.</p>  <p>The truth is now the web is neither, nor will ever be platform independent.&#160; It’s just an illusion based on the simple notion that browsers basically just render HTML.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/08/pegi.jpg"><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="pegi" border="0" alt="pegi" src="http://elegantcode.com/wp-content/uploads/2010/08/pegi_thumb.jpg" width="438" height="517" /></a></p>  <h2>How many platforms are there then?</h2>  <p>This is a surprisingly difficult question to answer.</p>  <p>Back before the web really took off there were basically 3 platforms to develop an app for: Windows; Unix/Linux; and Mac.</p>  <p>When we answer this question for the web, really we have to look at browsers as if they are the operating system.&#160; Since the same browser exists on multiple base OS’s but could be different, we have to count each combination of browser and OS as a potentially separate version.</p>  <p>Windows: IE6, IE7, IE8, IE9 (beta), Firefox, Chrome, Safari</p>  <p>OSX: IE, Firefox, Safari (more?)</p>  <p>Linux: Firefox, Chrome</p>  <p>Android: Webkit</p>  <p>iPad, iPhone: Safari</p>  <p>I don’t have nearly every combination listed, but this is what I would consider a good coverage for any kind of public facing website.</p>  <p>Oh, don’t forget to cross this again with localization and globalization, because you might have a localization problem that only happens in a certain language in a certain browser on a certain OS.</p>  <h2>Not just rendering level differences</h2>  <p>It is also very interesting to consider that a web developer now has to consider how their site will not just render, but be used on a mobile platform.&#160; </p>  <p>Consider how Google released an iPad version of Gmail.&#160; And although, you may not really care if your site works on an iPhone or an Android phone, you probably should start caring about how it works on tablets like the iPad, because that market is only growing. </p>  <p><strong>If you have a website that doesn’t work on someone’s iPad when they are shopping online, do you think they will get up, go turn on the computer, and go to your site to make the purchase or they will buy from a different site with a few touches?</strong></p>  <p>With a phone size resolution, the considerations are even more important.</p>  <h2>Tools help me make the web platform independent</h2>  <p>No tool exists right now that can handle the non-technical aspects of platform independence for your web application, but let us imagine for a second that a library like JQuery really made your javascript platform independent.</p>  <p>If we were to hold onto that shaky assumption, we would need to make sure that we never wrote javascript that wasn’t written through the JQuery API.&#160; (Which happens to be an extremely leaky abstraction over javascript, CSS, and the DOM.) We would still have to make sure our HTML and CSS tags were platform independent.</p>  <p>So even if we could get parts of our development to be mostly platform independent, we would still need to test on all of the major platforms, because we could not rely on the platform independence.</p>  <p>Now, don’t get me wrong here.&#160; I love JQuery.&#160; It makes the job of a web developer so much easier.&#160; But, there is an important distinction.&#160; <strong>APIs and libraries like JQuery make it easier to write platform independent web code, but they don’t make our code platform independent.</strong></p>  <h2>What does all this mean?</h2>  <p>We’ve gotten to the point where the most platform independent technology you can use is either Flash or Silverlight.</p>  <p>I’m not sure if this is the future of development, but it very well might be.</p>  <p>One important point to draw from this realization is that we shouldn’t necessarily choose to make our application a web application, because we need it to be platform independent.&#160; It seems like about 5 years ago, the web became the default choice, because it was better to have platform independence than a rich UI.</p>  <p>Hopefully, for the sake of web developers some of these paths die off or converge, or that standards compliance becomes so good that you could really write code for one browser and expect it to work on all the others.</p>  <h6>As always, you can subscribe to this <a href="http://feeds2.feedburner.com/ElegantCode">RSS feed</a> to follow my posts on elegant code.&#160; Feel free to check out my main personal blog at <a href="http://simpleprogrammer.com">http://simpleprogrammer.com</a>, which has a wider range of posts, updated 2-3 times a week.&#160; Also, you can follow me on twitter <a href="http://twitter.com/jsonmez">here</a>.</h6>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/08/22/the-web-is-not-platform-independent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing oEmbed</title>
		<link>http://elegantcode.com/2010/03/05/introducing-oembed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introducing-oembed</link>
		<comments>http://elegantcode.com/2010/03/05/introducing-oembed/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 06:12:08 +0000</pubDate>
		<dc:creator>cory.isakson</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WebServices]]></category>
		<category><![CDATA[oembed]]></category>

		<guid isPermaLink="false">http://elegantcode.com/?p=3325</guid>
		<description><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s [...]]]></description>
			<content:encoded><![CDATA[Gadgets, widgets, flash, ActiveX, Silverlight, json, xml

With all of the competing technologies for content embedding and resource sharing on the web it can be difficult to determine which options to use.  Have you ever wished that you could embed YouTube videos and Flickr photos into your site just by knowing the consumer friendly URLi’s to them?  That is exactly what <a href="http://oembed.com">oEmbed</a> provides.  I would like to introduce you to the basics of the specification.  I hope the simplicity encourages you to support it as a provider and as a consumer when embedding resources from other providers.  Many popular sites already support it!
<blockquote>oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.</blockquote>
Lets take a look at each side of a provider and consumer scenario to illustrate how oEmbed provides and elegant solution for each.
<blockquote>Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation.</blockquote>
The publisher must determine what scheme(s) they support in very basic format.  Typically the scheme matches URLs that consumers would browse resources at normally.  The YouTube API, for example, supports URLs matching the scheme <a href="http://*.youtube.com/watch">http://*.youtube.com/watch</a>*

The API endpoint is simply an http URL at which consumers request oEmbed representations of the resources you provide.  Most of the current providers offer API endpoints with obvious URL’s like <a title="http://www.youtube.com/oembed" href="http://www.youtube.com/oembed">http://www.youtube.com/oembed</a> and <a title="http://www.flickr.com/services/oembed/" href="http://www.flickr.com/services/oembed/">http://www.flickr.com/services/oembed/</a>.

Once you have the endpoint you just need to host a service there that accepts 4 specific query parameters:

url : The urlencoded url that matches a supported provider defined scheme.
maxwidth : (optional) The maximum width you want for embedding the resource.
maxheight : (optional) The maximum height you want for embedding the resource.
format: (optional) xml or json are the possible values that determine the consumers desired response Content-Type.
<blockquote>Requests sent to the API endpoint must be HTTP GET requests, with all arguments sent as query parameters. All arguments must be urlencoded (as per RFC 1738).</blockquote>
oEmbed consumers make requests for the oEmbed representation of a resource by sending a basic GET request to an API endpoint with url query parameters and any optional parameters they choose.

A request to <a title="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ">http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D6lbDyXu7gUQ</a> results in a json response:
<pre>{
"provider_url": "http://www.youtube.com/",
"title": "Insert a YouTube Video With oEmbed Wordpress 2.9",
"html": "&lt;object width=\"480\" height=\"295\"&gt;
    &lt;param name=\"movie\" value=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\"&gt;&lt;/param&gt;
    &lt;param name=\"allowFullScreen\" value=\"true\"&gt;&lt;/param&gt;
    &lt;param name=\"allowscriptaccess\" value=\"always\"&gt;&lt;/param&gt;
    &lt;embed src=\"http://www.youtube.com/v/6lbDyXu7gUQ&amp;fs=1\" type=\"application/x-shockwave-flash\"
        width=\"480\" height=\"295\" allowscriptaccess=\"always\" allowfullscreen=\"true\"&gt;&lt;/embed&gt;&lt;/object&gt;",
"author_name": "adriarichards", "height": 295, "width": 480, "version": "1.0",
"author_url": "http://www.youtube.com/user/adriarichards",
"provider_name": "YouTube",
"type": "video"
}</pre>
Note the html property.  It contains everything you need to embed the video.  If this installation of WordPress was running version 2.9 I could paste a YouTube URL here and it would automatically get embeded as described in the video <a href="http://www.youtube.com/watch?v=6lbDyXu7gUQ">Insert a YouTube Video With oEmbed Wordpress 2.9</a>

oEmbed supports 4 result types including video, photo, link and rich.  The rich type allows for just about any html to be returned and thus embedded.
<blockquote>Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities.</blockquote>
To learn more and see a list of some current providers check it out at:

<a title="http://oembed.com/" href="http://oembed.com/">http://oembed.com/</a>

And for a few more implementations check out <a title="http://oohembed.com/" href="http://oohembed.com/">http://oohembed.com/</a>

I look forward to hearing how you end up using oEmbed!]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/03/05/introducing-oembed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JetBrains Web IDE</title>
		<link>http://elegantcode.com/2010/01/29/jetbrains-web-ide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jetbrains-web-ide</link>
		<comments>http://elegantcode.com/2010/01/29/jetbrains-web-ide/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 21:03:26 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[html]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/29/jetbrains-web-ide/</guid>
		<description><![CDATA[As I already mentioned in a previous blog post, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using [...]]]></description>
			<content:encoded><![CDATA[<p>As I already mentioned in a <a href="http://elegantcode.com/2010/01/26/css-basics-the-box-model/">previous blog post</a>, I’m kind of (re-)learning HTML and CSS. The best way for me to pick things up again is by getting my hands dirty and work myself through a simple example. So I decided to work on some sort of prototype of a web application without using any web framework like ASP.NET MVC, Fubu MVC, Ruby on Rails, etc. … Just plain old HTML and CSS, like the Internet gods intended. I also didn’t want to suck all the fun out of it either, so I decided to use <a href="http://www.jetbrains.com/webide/index.html">Web IDE</a> from <a href="http://www.jetbrains.com/index.html">JetBrains</a> as my IDE for churning out this prototype. </p>  <p>I must say that I was pleasantly surprised by some of the features that this IDE has to offer. The first and most obvious one is probably intellisense that just works as expected.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image9.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb9.png" width="553" height="385" /></a> </p>  <p>Also notice the on-the-fly code inspection (colored marker bar on the right) that should be familiar when you’re a Resharper addict like me. Web IDE provides W3C XHTML/CSS validation while working in the editor which is really useful. </p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image10.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb10.png" width="548" height="381" /></a> </p>  <p>Being the uncertain type, it was also nice to see all the familiar refactoring features from Resharper being available as well. Renaming a class or id is just a breeze. All the corresponding HTML or CSS files are consistently updated.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image11.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb11.png" width="546" height="382" /></a> </p>  <p>Navigation is there as well (CTRL-N and CTRL-SHIFT-N).</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image12.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb12.png" width="543" height="378" /></a> </p>  <p>This looks just like <a href="http://www.jetbrains.com/resharper/index.html">Resharper</a> for web developers, but there’s more. At first, I had all the HTML and CSS files including all the image file in the root folder of the project. I wanted to divide and conquer by putting the images and CSS files into their own separate folder. As I prepared myself to change all the references in the HTML files, Web IDE did that all for me when I dragged the files to their final destination. Now I didn’t had to go over all the HTML files and manually change the links. How cool is that!</p>  <p>Web IDE also provides source-control integration Subversion, Git, Perforce, etc … and that’s just the tip of the iceberg. While working on the prototype of the web application, I mostly focused on the layout and not so much on the behavior so I didn’t use much of the JavaScript capabilities. But I was told that it is comparable with the JavaScript features in <a href="http://www.jetbrains.com/ruby/index.html">RubyMine</a> as described by Peter in <a href="http://peter.worksontheweb.net/post/An-alternative-to-editing-JavaScript-in-Visual-Studio-RubyMine.aspx">this blog post</a>. This is something that I’m going to explore when I start learning more about JavaScript :-). </p>  <p>Although being the first version and still in beta, the IDE seems pretty stable and I couldn’t notice any performance hiccups so far (which <a href="http://davybrion.com/blog/2010/01/i-still-have-low-expectations-for-visual-studio-2010/">cannot be said for all IDE’s</a> these days). </p>  <p>I do hope that there will be some support for ASP.NET or other view engines like <a href="http://sparkviewengine.com/">Spark</a>, <a href="http://nvelocity.sourceforge.net/">NVelocity</a>, etc. … in future versions. In fact, I still silently wish that JetBrains would come up with an IDE for .NET. Being realistic about it, I don’t have high hopes for something like that coming out but it would totally rock if they decided to build one. Sweet dreams :-)</p>  <p>Bottom line, when you’re doing web development in Visual Studio, make sure to also check out Web IDE. It will probably help you to become more productive along the way.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/29/jetbrains-web-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Basics: The Box Model</title>
		<link>http://elegantcode.com/2010/01/26/css-basics-the-box-model/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=css-basics-the-box-model</link>
		<comments>http://elegantcode.com/2010/01/26/css-basics-the-box-model/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:52:34 +0000</pubDate>
		<dc:creator>Jan Van Ryswyck</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/26/css-basics-the-box-model/</guid>
		<description><![CDATA[If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it. While I was (re-)learning CSS, I came across these two properties called margin and padding. At first, they seem to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you’ve been using CSS for a while, then this post will probably teach you nothing new. I just wanted to state the obvious even if I’m the only one who benefits from it.</p>  <p>While I was (re-)learning CSS, I came across these two properties called <em>margin</em> and <em>padding</em>. At first, they seem to be doing the same thing namely providing space between HTML elements. But although they seem to fulfill the same purpose, there’s a clear distinction between the two.</p>  <p><a href="http://elegantcode.com/wp-content/uploads/2010/01/image5.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://elegantcode.com/wp-content/uploads/2010/01/image_thumb5.png" width="240" height="145" /></a>&#160;</p>  <p></p>  <p>The margin is intended for providing space between outside HTML elements or the sides of the page. Padding is used for providing visual space between the content and the border of the box. </p>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; margin: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed"><font color="#ffffff">Some margin, no padding</font> </div>  <div style="border-bottom: #000000 2px dashed; border-left: #000000 2px dashed; padding-bottom: 25px; padding-left: 25px; padding-right: 25px; background: #4f81bd; border-top: #000000 2px dashed; font-weight: bold; border-right: #000000 2px dashed; padding-top: 25px"><font color="#ffffff">Some padding, no margin</font> </div>  <p>&#160;</p>  <p>The first example provides a margin to add visual space between the border and the parent element. The second one provides space between the border and the content.</p>  <p>I agree that this is trivial, but it matters to understand the difference between these two properties when using CSS. </p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/26/css-basics-the-box-model/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=open-source-silverlight-video-players</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a scrubber [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.png"><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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I've been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>  <p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>  <ul>   <li>“How do you handler markers?” </li>    <li>“How is streaming video handled?” </li>    <li>“What do you do an an error?” </li>    <li>“What’s the strategy for buffering?” </li>    <li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>    <li>“How does the video player handle Closed captioning?” </li> </ul>  <p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call ;), but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>  <p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>  <h3>Silverlight Media Framework (SMF)</h3>  <p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>  <p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>  <p>Other than the standard video player controls, here are additional highlights of SMF:</p>  <ul>   <li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>    <li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>    <li>A light weight data project </li>    <li>Logging </li>    <li>Blendability – the player is easily skinned </li>    <li>InStream markers </li>    <li>Bitrate – the ability to show bitrate </li> </ul>  <p>For a more detailed list of features, and the code, check out SMF’s site.</p>  <h3>Silverlight Video Player</h3>  <p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>  <p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>  <h3>Silverlight HyperVideo player (HVP)</h3>  <p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>  <p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>  <h3>Others</h3>  <p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>  <p><strong>Sharepoint video player</strong> - <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>  <p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>  <p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Asp.Net MVC Framework</title>
		<link>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=learning-aspnet-mvc-framework</link>
		<comments>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 04:56:18 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/</guid>
		<description><![CDATA[This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net [...]]]></description>
			<content:encoded><![CDATA[<p>This is basically a “What is Chris up to now?” post.&#160; As the title suggests I’m going up to my ears into Asp.Net MVC.&#160; I’ve been doing Asp.Net WebForms for about the past 8 years, so this is a good time for a switch.&#160; Lucky for me, I’m armed with a good book: Pro Asp.Net MVC Framework by <a href="http://blog.codeville.net/">Steven Sanderson</a>.&#160; I’ve read about have of it and I love it.&#160;&#160; The greatest thing about the book is that it actually answers questions as you think of them.&#160; A remarkable achievement for any technical book.</p>  <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:7dc1bd33-94bd-46fd-a20b-0131235bcd47:2db63d7f-69bd-4ac4-8e6d-29bd07557724" class="wlWriterEditableSmartContent"><table cellspacing="0" cellpadding="2" width="400" border="0" unselectable="on">
<tbody><tr>
<td valign="top" width="400">
<p><a title="Pro ASP.NET MVC Framework: Steven Sanderson: Books" href="http://www.amazon.com/exec/obidos/ASIN/1430210079/elegantcode-20"><img src="http://images.amazon.com/images/P/1430210079.01.MZZZZZZZ.jpg" border="0" align="left" style="float:left">Pro ASP.NET MVC Framework: Steven Sanderson: Books</a><br><br><b>ISBN</b>: 1430210079<br><b>ISBN-13</b>: 9781430210078</p>
</td></tr></tbody></table></div>  <p>But here is where I’m at right now (btw: if I get anything here completely wrong, blame me, not the book author):</p>  <p>1. Routing.&#160; I’ve already played with routing before with standard Asp.Net WebForms, so the concept is not new to me.&#160; But getting to the point where I really grok Routing will be a while.&#160; The basic concept is this: Routing is one of the first control points that you get with Asp.Net MVC (or WebForms now as well).&#160; When a request comes in (web browser requests a page) the Routing engine determines which controller (or web form) will handle the request.&#160; With this in place you can now have “pretty” urls.&#160; So something like http://www.elegantcode.com/Chris/is/cool.&#160; That link wont work, but that is the general idea.&#160; More often than not you see something like this: http://localhost/Customer/Edit/ChrisBrandsma</p>  <p>* my current issues: none really – so long as I can manage to follow the existing route paradigm.&#160; Passing extra parameters can be strange, but the good old ?id=5&amp;sid=6&amp;… still works.&#160; Also, as soon as you head into Routing land you suddenly have to start thinking about your urls.&#160; In traditional WebForms world, a url is like a latitude/longitude – and the user has to figure out how to get there.&#160; In Routing land, the url is a list of turn by turn directions.</p>  <p>2. Controllers.&#160; Controller are the general housing points for web application flow.&#160; If you look at the second url, you see /Customer/Edit/ChrisBrandsma there.&#160; The Customer part of the url is the controller.&#160; Why?&#160; Because my Routing setup says it is.&#160; That’s why.&#160; Controllers hold Actions.&#160; Edit is the action.&#160; ChrisBrandsma is just some data I’m passing to the action.</p>  <p>* My Current Issues: I have not reached a Zen of when to create a new controller yet.&#160; I keep thinking of single responsibility, so right now my controllers tend to have few methods in them.&#160; But I’m still getting the hang of it.</p>  <p>3. Actions.&#160; Actions are things the Controller can do.&#160; Back to the url example: http://localhost/Customer/Edit/ChrisBandsma, there is an expectation I will be editing myself (I would like 50 more IQ points and Kung Foo).&#160; Edit is the action here.&#160; There is also a convention that states there should be an Edit.aspx page to go along with the Edit action.&#160; I can override that, but that is the expectation again.</p>  <p>There are various things an action can return (and they have to return something): JavaScript, JSON, text, Files, html, etc.&#160; But it seems their primary function is to get a view and hand it data.</p>  <p>* My Current Issues: I’m barely scratching the surface with this one.&#160; I am trying very hard to keep my Action code small.&#160; To that end I’m creating ControllerActionPresenters and ControllerActionViewModel for each Action I create.&#160; This might be overkill, but it is keeping thinks clean right now.&#160; </p>  <p>So now my Actions have three tasks: get user data (querystring, form, session, etc), get the presenter and pass it the user data, return the ViewModel data to a specific view.&#160; I’m ok with this so far.</p>  <p>4. Views.&#160; I have no zen here.&#160; I remember the bad old asp days, and I am eager not to relive them.&#160; I’m keeping my JavaScript and css in separate files, but tag soup is upon me.&#160; Everywhere I look there is &lt;% code here %&gt; and less innocuous &lt;%=View.DataModel.SomeValue %&gt;.&#160;&#160; I need to read up on how to separate thing out into specific controls or I am going to go nuts.&#160; HtmlHelpers are my friends, HtmlHelpers are my friends.</p>  <p>Also,&#160; I’m doing everything I can to use typed Views.&#160; This would be insane without typed views.</p>  <p></p>  <p>* My (other) current Issues: so far I have not tried to do a data entry form with MVC.&#160; Until I do that, more of this will be a mystery to me.</p>  <p>My thoughts so far.&#160; I still like it. There are some learning curves ahead for me yet, but I enjoy that.&#160; Either I will savor the sweetness of WebForms from the experience, or look back at them and laugh.&#160; I’m starting to laugh.</p>]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/learning-aspnet-mvc-framework/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Dissecting JQuery text()</title>
		<link>http://elegantcode.com/2009/06/15/dissecting-jquery-text/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dissecting-jquery-text</link>
		<comments>http://elegantcode.com/2009/06/15/dissecting-jquery-text/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 02:09:48 +0000</pubDate>
		<dc:creator>Chris Brandsma</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/06/15/dissecting-jquery-text/</guid>
		<description><![CDATA[An interesting question came up at work today.  We had some existing code that was using the innerText dom method.  It worked fine on IE, but not on Firefox (to be clear, I’m used to that working the other way around).  If you look at QuirksMode you will see Firefox is the only browser that [...]]]></description>
			<content:encoded><![CDATA[An interesting question came up at work today.  We had some existing code that was using the <a href="http://www.w3schools.com/htmldom/prop_tablerow_innertext.asp">innerText dom method</a>.  It worked fine on IE, but not on Firefox (to be clear, I’m used to that working the other way around).  If you look at QuirksMode you will see <a href="http://www.quirksmode.org/dom/w3c_html.html">Firefox is the only browser</a> that does not support this method as well.

Turns out if you use innerText on any dom element in IE you will get the text inside the element (in this case a span tag), but in Firefox you just get nothing.  I mentioned that JQuery has a <a href="http://docs.jquery.com/Attributes/text">text method</a> that does the same thing…but how did that work?  I had to look that one up.
<h2>Step 1: Find the code</h2>
This is actually relatively easy if you know a bit about how methods can be added to objects.  Turns out there are three ways to do declare a function in JavaScript – and <a href="http://devlicio.us/blogs/sergio_pereira/archive/2009/02/09/javascript-5-ways-to-call-a-function.aspx">5 ways to call one</a>.  Anyway, search for “text:”.  This is what you should find around line 201 (as of JQuery 1.3.2)
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; line-height: 12pt; background-color: #f4f4f4; width: 97.5%; font-family: consolas,'Courier New',courier,monospace; max-height: 200px; font-size: 8pt; cursor: text;">
<div style="border-style: none; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   1:</span> text: <span style="color: #0000ff">function</span>(text) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   2:</span>      <span style="color: #0000ff">if</span> (<span style="color: #0000ff">typeof</span> text !== <span style="color: #006080">"object"</span> &amp;&amp; text != <span style="color: #0000ff">null</span>)</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   3:</span>        <span style="color: #0000ff">return</span> <span style="color: #0000ff">this</span>.empty().append((<span style="color: #0000ff">this</span>[0] &amp;&amp; <span style="color: #0000ff">this</span>[0].ownerDocument || document).createTextNode(text));</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   4:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   5:</span>      <span style="color: #0000ff">var</span> ret = <span style="color: #006080">""</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   6:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   7:</span>      jQuery.each(text || <span style="color: #0000ff">this</span>, <span style="color: #0000ff">function</span>() {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   8:</span>        jQuery.each(<span style="color: #0000ff">this</span>.childNodes, <span style="color: #0000ff">function</span>() {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">   9:</span>          <span style="color: #0000ff">if</span> (<span style="color: #0000ff">this</span>.nodeType != 8 )</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">  10:</span>            ret += <span style="color: #0000ff">this</span>.nodeType != 1 ?</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">  11:</span>                        <span style="color: #0000ff">this</span>.nodeValue :</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">  12:</span>                        jQuery.fn.text([<span style="color: #0000ff">this</span>]);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">  13:</span>        });</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">  14:</span>      });</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">  15:</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">  16:</span>      <span style="color: #0000ff">return</span> ret;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; line-height: 12pt; background-color: white; width: 100%; font-family: consolas,'Courier New',courier,monospace; color: black; font-size: 8pt;"><span style="color: #606060">  17:</span>    }</pre>
</div>
</div>
<h2>Step 2: Interpreting the code</h2>
Line 1 is the method declaration.  We are attaching the method to jQuery.fn (line 35 in the document), which is using <a href="http://javascript.crockford.com/prototypal.html">JavaScript prototype inheritance</a>.  The full line is “jQuery.fn = jQuery.prototype = {“.  So jQuery.fn is extending all instances of the jQuery class type with the function defined with in the curly brackets {}.

If you look at the JQuery documentation you will notice there are two methods called text, one that takes a parameter, one that does not.  You might assume this is the method that takes the parameter – actually, this single function handles both.

In JavaScript, according to <a href="http://www.amazon.com/exec/obidos/ASIN/0596517742/elegantcode-20">JavaScript the Good Parts</a>, what we call parameters, are <a href="http://www.devguru.com/Technologies/Ecmascript/Quickref/arguments.html">arguments</a>.  You can retrieve arguments passed into a JavaScript function either by the named arguments passed in (the text argument) or via the arguments array (arguments[0]).  Using the arguments array you can accept as many, or as few, arguments as you want.
<h3>Reading the setter (lines 2 and 3)</h3>
Crazy little think about JavaScript, declaring parameters is optional and so is passing them in.  Using the line numbers in the code above as a guide: lines 2 and 3 are used if you pass in text to the method.  If you did not pass anything into the text parameter, then you move on to line 7 (effectively).

Also note on line 2, the !== operator.  In JavaScript there is a difference between != and !==, and their opposites == and ===.  The triple === checks the type as well as the value, whereas the == does not check type.  So ‘0’ == 0 returns true, where ‘0’ === 0 returns false.  Try to use === and !== instead of != and ==.

On line 3 you see ‘this’ a lot.  In this particular case, ‘this’ is a reference to the control you are setting the text of.  First the element is being cleared, then an element with the text is being created and appended to the control.

A reference to the controls is being returned when everything is said and done.
<h3>Reading the getter (lines 4 – 16)</h3>
I’m starting on line 9 with the <a href="http://www.w3schools.com/htmldom/dom_nodes_info.asp">nodeType</a> code. nodeType 9 is a comment, so that isn’t something we want to change.  Also nodeType 1 is an element.  You would think we would want the text directly from an element type, but we don’t, we want the ‘text’ nodeType (nodeType 3), which should be a child of an element node.  So on line 12 you see a recursive call to the text method.  Then, once the appropriate nodeType is found, <a href="http://www.w3schools.com/htmldom/dom_methods.asp">nodeValue</a> is called.

Line 7 and 8 are just there to loop through the multiple elements that a JQuery selector can return (Note: JQuery Selectors always return an array, even if only one item is returned).
<h2>Conclusion</h2>
OK, I hope you learned something from this, even if it is that JQuery can be opened up, and you can understand what is going on.  Please leave a comment if anything I’ve written is in error.

On a side note, the innerText call that was causing trouble could have been replaced with a call to the JQuery text() method, but they went with innerHtml instead.  Also, I did a quick search through JQuery to see if innerText was being used anywhere;  it is, once, in a filter function that is part of the selector engine.

<a title="JavaScript: The Good Parts: Douglas Crockford: Books" href="http://www.amazon.com/exec/obidos/ASIN/0596517742/elegantcode-20"><img style="float: left" src="http://images.amazon.com/images/P/0596517742.01.MZZZZZZZ.jpg" border="0" alt="" align="left" />JavaScript: The Good Parts: Douglas Crockford: Books</a>

<strong>ISBN</strong>: 0596517742

<strong>ISBN-13</strong>: 9780596517748]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/15/dissecting-jquery-text/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

