<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:a10="http://www.w3.org/2005/Atom" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Dean Hume's Blog</title><link>http://www.deanhume.com/</link><description>Code Tricks and Tips</description><lastBuildDate>Thu, 20 Jun 2013 08:21:20 Z</lastBuildDate><a10:id>Feeds/Blog</a10:id><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/DeanHumesBlog" /><feedburner:info uri="deanhumesblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/2.0/</creativeCommons:license><feedburner:emailServiceId>DeanHumesBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/NoRCStqr7rg/89</link><title>WebP - Advanced image optimization using ASP.NET MVC</title><description>&lt;p&gt;Most modern web pages contain a &lt;strong&gt;lot&lt;/strong&gt; of images. These images often make up the bulk of a web page request. According to the &lt;a href="http://httparchive.org/interesting.php"&gt;HTTPArchive&lt;/a&gt;, images make up over 50% of the average web page and if you are looking to optimize on the performance of your web page, the best place to start is often with the images on your page. By optimizing your images and simply reducing the amount of bytes that your users are downloading, you can drastically improve your page load times. &lt;/p&gt;

&lt;p&gt;There are some great &lt;a href="http://jpegclub.org/jpegtran/"&gt;tools&lt;/a&gt; out &lt;a href="http://pmt.sourceforge.net/pngcrush/"&gt;there&lt;/a&gt; that will allow you to optimize and compress your images, but you can only optimize your images to a certain extent before they start to lose their quality. It's about time we start looking at newer formats of images in order to decrease their file size, yet still maintain the image quality. This is where the &lt;a href="https://developers.google.com/speed/webp/"&gt;WebP&lt;/a&gt; format comes in. It is pronounced as 'weppy' and is a new image format that was developed by the team at Google.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/WebP/logo-webp.png" alt="WebP Logo" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WebP&lt;/strong&gt; images are 26% smaller in size compared to &lt;strong&gt;PNGs&lt;/strong&gt; and are 25-34% smaller in size compared to &lt;strong&gt;JPEG&lt;/strong&gt; images. That is a massive saving! Google use &lt;strong&gt;WebP&lt;/strong&gt; images instead of &lt;strong&gt;PNG&lt;/strong&gt; images in &lt;strong&gt;Picasa&lt;/strong&gt;, &lt;strong&gt;Gmail&lt;/strong&gt; and its &lt;strong&gt;Chrome Web Store&lt;/strong&gt;. Given the number of requests Chrome Web Store serves, this adds up to several terabytes of savings every day! As a web developer, you can use the &lt;strong&gt;WebP&lt;/strong&gt; image format to create smaller and richer images that can help make the web faster. In order to compare the differences in image size, let's compare the following &lt;strong&gt;PNG&lt;/strong&gt; below:&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/WebP/Visual-Studio-Logo.png" alt="Visual Studio Logo" /&gt;&lt;/p&gt;

&lt;p&gt;The image above is a &lt;strong&gt;PNG&lt;/strong&gt; image that has a file size of 12KB. If I take this same image and convert it to WebP, it comes in at 4KB - that's almost a third of the size. Imagine being able to make that saving on each image in your website without compromising on quality!&lt;/p&gt;

&lt;p&gt;While &lt;strong&gt;WebP&lt;/strong&gt; images are awesome, unfortunately they are not without their limitations. &lt;strong&gt;WebP&lt;/strong&gt; images are only currently supported in &lt;strong&gt;Google Chrome&lt;/strong&gt;, &lt;strong&gt;Opera&lt;/strong&gt;, &lt;strong&gt;Android&lt;/strong&gt;, and &lt;strong&gt;Google Chrome Frame&lt;/strong&gt; plugin for Internet Explorer. I still think that we should provide our users with the best and fastest browsing experience possible, so why not still offer this option to users that are capable of viewing WebP images?&lt;/p&gt;

&lt;p&gt;In this article, I am going to run through an example that will show you how to create a simple HTML helper that you can use in your &lt;strong&gt;ASP.NET MVC&lt;/strong&gt; applications to serve &lt;strong&gt;WebP&lt;/strong&gt; images to browsers that are capable of handling them. In the case when the browser isn't capable of serving the images, it will simply fall back to its default image type. This simple change will reduce the size of the images on your page and improve your load times. &lt;/p&gt;

&lt;p&gt;In order to get started with &lt;strong&gt;WebP&lt;/strong&gt; images, you first need to download the encoder from the &lt;a href="https://developers.google.com/speed/webp/download"&gt;Google developer’s website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;encoder&lt;/strong&gt; allows you to easily encode most image formats into their &lt;strong&gt;WebP&lt;/strong&gt; equivalent using a command line tool. Once you have downloaded the pack, it contains a set of tools that will allow you to encode and decode images into &lt;strong&gt;WebP&lt;/strong&gt; format. The pack also contains a decent readme file that will get you up and running. The pack contains a tool called &lt;strong&gt;cwebp.exe&lt;/strong&gt; which accepts the following syntax:&lt;/p&gt;

&lt;strong&gt;cwebp input.png -o output.webp&lt;/strong&gt;
&lt;br/&gt;
&lt;br/&gt;

&lt;p&gt;Once you fire up the command line and run the tool, pass it the original image and the name you would like it to output the &lt;strong&gt;WebP&lt;/strong&gt; image to. It will produce a result similar to the following image:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/WebP/webp-encoder.png" alt="WebP Encoder" /&gt;&lt;/p&gt;

&lt;p&gt;Now that our image that has been converted into a &lt;strong&gt;WebP&lt;/strong&gt; image, we can build a helper that will determine whether or not to display a &lt;strong&gt;WebP&lt;/strong&gt; image or the original &lt;strong&gt;PNG&lt;/strong&gt; image. I am going to steal/re-use some code that I wrote about in a &lt;a href="http://www.deanhume.com/Home/BlogPost/mvc-data-uri-html-helper/61"&gt;previous article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First up, we need to write a method that will detect if the browser is capable of handling &lt;strong&gt;WebP&lt;/strong&gt; images.&lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/e63a42b1bd2cf689e698.js"&gt;&lt;/script&gt;

&lt;p&gt;The above method will detect if the current browser is &lt;strong&gt;Chrome&lt;/strong&gt;, &lt;strong&gt;Opera&lt;/strong&gt;, or &lt;strong&gt;Android&lt;/strong&gt;. If true, it will return a Boolean notifying us that we can return the &lt;strong&gt;WebP&lt;/strong&gt; image instead. Next, we need to create an HTML helper method that will return the path of the WebP format image depending on the browser capabilities.&lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5294879.js"&gt;&lt;/script&gt;

&lt;p&gt;The method above will detect if the browser is capable of handling &lt;strong&gt;WebP&lt;/strong&gt; images and then replace the extension on the file with the new ".webp" extension. In order to use this Html helper, you simply need to call it in your view like so:&lt;/p&gt;

&lt;strong&gt;@Html.DrawImage("/content/images/visualstudio.png","Visual Studio")&lt;/strong&gt;
&lt;br/&gt;
&lt;br/&gt;

&lt;p&gt;We are almost there. If you hit F5 and fire up your application, you will see something similar to the following image:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/WebP/Visual-Studio-Error.png" alt="WebP Mime Type Error" /&gt;&lt;/p&gt;

&lt;p&gt;The image isn't quite showing up correctly, and if you navigate directly to the link in &lt;strong&gt;Chrome&lt;/strong&gt;, you will receive a HTTP 404.3 error. "&lt;em&gt;HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration&lt;/em&gt;". &lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/WebP/Http-403-3-error.png" alt="HTTP 403.3 Error" /&gt;&lt;/p&gt;

&lt;p&gt;This is happening because the browser doesn't know how to interpret the &lt;strong&gt;WebP&lt;/strong&gt; image because the mime type hasn't been sent through with it from the server. In order to rectify this, we simply need to add the &lt;strong&gt;MIME&lt;/strong&gt; type to the Web.Config file.&lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5295318.js"&gt;&lt;/script&gt;

&lt;p&gt;When the &lt;strong&gt;MIME&lt;/strong&gt; mapping has been added to your Web.Config, IIS will send this &lt;strong&gt;MIME&lt;/strong&gt; type back with the &lt;strong&gt;WebP&lt;/strong&gt; image request and the browser will understand how to display the image. After adding the config settings, fire up the application and tadaaaa!&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/WebP/Visual-Studio-Logo.png" alt="Visual Studio Logo" /&gt;&lt;/p&gt;

&lt;p&gt;If you use this HTML helper in your application, it will automatically determine whether or not to display the &lt;strong&gt;WebP&lt;/strong&gt; equivalent image to your users or not. You will need to keep a copy of both the &lt;strong&gt;WebP&lt;/strong&gt; image and the original image (&lt;em&gt;PNG, JPG, and GIF&lt;/em&gt;) in order for this example to work. 
&lt;strong&gt;WebP&lt;/strong&gt; images are still in their infancy, but I would like to see them being adopted by more and more websites. They are a great way to serve quality images to your users without compromising on quality.&lt;/p&gt;

&lt;p&gt;
If you would like to download a copy of the source code used in this example, it is available via the following &lt;a href="
http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/WebP/WebPDemo.zip"&gt;link&lt;/a&gt;.
&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=NoRCStqr7rg:-NAzUWB0owE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/NoRCStqr7rg" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/WebP%20-%20Advanced%20image%20optimization%20using%20ASP.NET%20MVC/89</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/1mDJPWjfsFY/88</link><title>Twitter bootstrap typeahead and ASP.NET MVC - Key/Value pairs</title><description>&lt;p&gt;I suck at creating &lt;strong&gt;CSS&lt;/strong&gt;. As a backend developer, I've always managed to get by with my &lt;strong&gt;CSS&lt;/strong&gt; skills, but I've always been jealous of my front end developer colleagues when it comes to their ability to create beautiful web pages. Fortunately, the guys at &lt;strong&gt;Twitter&lt;/strong&gt; have developed a great front-end framework that comes with pre-rolled &lt;strong&gt;CSS&lt;/strong&gt; and &lt;strong&gt;JavaScript&lt;/strong&gt; plugins.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/TypeAhead/twitter-bootstrap.jpg" alt="Twitter Bootstrap typeahead searchbox" /&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Twitter Bootstrap&lt;/strong&gt; framework looks great on most devices and comes with a responsive grid which makes developing and designing very easy. It gives back-end developers like myself the opportunity to create half decent webpage designs. I have actually been using it on a recent side project when I came across the &lt;strong&gt;JavaScript typeahead&lt;/strong&gt; plugin that comes with the framework. It is a great plugin that allows you to create styled AJAX style, type ahead search boxes. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/TypeAhead/Bootstrap-Typeahead.png" alt="Twitter Bootstrap typeahead searchbox key/value pairs" /&gt;&lt;/p&gt;

&lt;p&gt;The image above represents a typical example of how the search box will look. The &lt;a href="http://twitter.github.com/bootstrap/index.html"&gt;Bootstrap website&lt;/a&gt; provides great documentation for most of the framework, but seems to provide little documentation for this particular plugin. Whilst it's very easy to work with a simple list of strings, the few examples that I found on the net didn't really show how to work with &lt;strong&gt;Key/Value pairs&lt;/strong&gt;. Most searches that I need to perform will require an ID lookup going on in the background. In this post, I am going to show you how to get up and running with &lt;strong&gt;ASP.NET MVC&lt;/strong&gt; and the &lt;strong&gt;typeahead plugin&lt;/strong&gt;. We are also going to get it working with key/value pairs that are being retrieved in a chunk of &lt;strong&gt;JSON&lt;/strong&gt; from an &lt;strong&gt;MVC&lt;/strong&gt; controller.&lt;/p&gt;

&lt;p&gt;If you haven't already downloaded the &lt;a href="http://twitter.github.com/bootstrap/index.html"&gt;Twitter Bootstrap framework&lt;/a&gt;, get started by downloading it from the &lt;a href="http://twitter.github.com/bootstrap/index.html"&gt;site&lt;/a&gt;. Next, we are going to start with our view. I've created a simple view with a textbox that is going to do the lookup.&lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5235240.js"&gt;&lt;/script&gt;

&lt;p&gt;At the bottom of the view, I've included a reference to the &lt;strong&gt;jQuery&lt;/strong&gt; library and the typeahead plugin. I've added the &lt;strong&gt;JavaScript&lt;/strong&gt; at the bottom of the page in order to maintain &lt;a href="http://developer.yahoo.com/performance/rules.html#js_bottom"&gt;performance best practices&lt;/a&gt;. At the top of the view, I've added a reference to the Bootstrap &lt;strong&gt;CSS&lt;/strong&gt; file which is used to style the page. &lt;/p&gt;

&lt;p&gt;You will also notice that the text box has a data attribute called &lt;strong&gt;data-provide="typeahead"&lt;/strong&gt;.  This attribute notifies the plugin that we are going to be performing a lookup with this textbox. Next, we are going to create the &lt;strong&gt;JavaScript&lt;/strong&gt; that will wire it all up. Add this code into the same view just after referencing the &lt;strong&gt;Bootstrap&lt;/strong&gt; libraries. &lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5235284.js"&gt;&lt;/script&gt;

&lt;p&gt;The above code is going to perform an &lt;strong&gt;HTTP Post&lt;/strong&gt; request that is going to hit our controller and return a &lt;strong&gt;JSON&lt;/strong&gt; string of the countries and their associated codes. On line 3, I have created an array that is going to contain the &lt;strong&gt;key/value pairs&lt;/strong&gt;. Once the HTTP post has a successful response with the data that it needs, it is going to add them to this array, so that we can retrieve it at a later stage. You will also notice that around line 16, there is a function called "process". This function takes the array of results and searches through according to what the user types.&lt;/p&gt;

&lt;p&gt;This &lt;strong&gt;typeahead&lt;/strong&gt; plugin has a set of overridable options that can be used to cater for different scenarios when interacting with the lookup. We are going to use the "&lt;em&gt;updater&lt;/em&gt;" function in this example. This function is called by the typeahead plugin once the user selects an item, which gives us a chance to do something with the selection. On line 19, we are using this function to retrieve the country shortcode from the array of key/value pairs that we mapped earlier. We are also setting the text of a div to match the shortcode. Depending on what you need to do with the key, you might want to set the value of a hidden field, update another field, etc.&lt;/p&gt;

&lt;p&gt;We have built all the &lt;strong&gt;JavaScript&lt;/strong&gt; that is needed to retrieve the data, and now we need to add an Action method on our controller that will return the &lt;strong&gt;JSON&lt;/strong&gt; string of the countries. &lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5239011.js"&gt;&lt;/script&gt;

&lt;p&gt;The above code builds a list countries with a short code and country name. This list will be serialized into the &lt;strong&gt;JSON&lt;/strong&gt; string that we need to do the lookup. Once serialized, the &lt;strong&gt;JSON&lt;/strong&gt; string that it returns will look a little something like this:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;[{"ShortCode":"US","Name":"United States"},{"ShortCode":"CA","Name":"Canada"},{"ShortCode":"AF","Name":"Afghanistan"},{"ShortCode":"AL","Name":"Albania"},{"ShortCode":"DZ","Name":"Algeria"},{"ShortCode":"DS","Name":"American Samoa"},{"ShortCode":"AD","Name":"Andorra"},{"ShortCode":"AO","Name":"Angola"},{"ShortCode":"AI","Name":"Anguilla"},{"ShortCode":"AQ","Name":"Antarctica"},{"ShortCode":"AG","Name":"Antigua and/or Barbuda"}]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Although I am simply building up a list of countries, you might want to hit the database and return more meaningful data. When we run this and see it in action, it will produce a search bar that is similar to the following image:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/TypeAhead/Bootstrap-Typeahead.png" alt="Twitter Bootstrap typeahead searchbox key/value pairs" /&gt;&lt;/p&gt;

&lt;p&gt;And once you select a certain country from the list, it will update the div with the selected ID accordingly.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/TypeAhead/Bootstrap-Typeahead-Selected.png" alt="Twitter Bootstrap typeahead searchbox selected" /&gt;&lt;/p&gt;

&lt;p&gt;For more information on the &lt;strong&gt;Twitter Bootstrap&lt;/strong&gt; plugin, check out the &lt;a href="http://twitter.github.com/bootstrap/javascript.html#typeahead"&gt;website&lt;/a&gt;. If you would like to learn more about the overridable functions that the &lt;strong&gt;typeahead&lt;/strong&gt; plugin provides, please refer to this &lt;a href="http://tatiyants.com/how-to-use-json-objects-with-twitter-bootstrap-typeahead/"&gt;great blog post&lt;/a&gt;. &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=1mDJPWjfsFY:UCG26knWoT0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/1mDJPWjfsFY" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Twitter%20bootstrap%20typeahead%20and%20ASP.NET%20MVC%20-%20Key/Value%20pairs/88</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/KmmhFDTeyyE/87</link><title>Free icon packs for developers</title><description>&lt;p&gt;Over the years, I have started to hoard a collection of links to various free icons that I find on the net. Often, I use these icons to spruce up simple prototypes or just make my web pages look livelier. Unfortunately, I've been collecting these links to icon packs and never get the chance to use half of them! If you are a web developer that has need for free icons, then this might be for you.&lt;/p&gt;

&lt;p&gt;This article will hopefully provide you with a list of free icons that you can use in your day to day development. This list features five great icons packs that are available to download today.&lt;/p&gt;

&lt;h2&gt;IconMonstr&lt;/h2&gt;

&lt;p&gt;IconMonstr is an awesome site that provides you with a list of over 1000 icons that are freely available to download. Every time I re-visit the site, there seems to be more icons that have been added. You are able to download the icons in either &lt;strong&gt;PNG or SVG&lt;/strong&gt; format.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Icons/iconmonstr-free-icons.png" alt="IconMonstr free icons" /&gt; &lt;/p&gt;

&lt;p&gt;To download the icons, please visit &lt;a href="http://iconmonstr.com"&gt;iconmonstr.com&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;IcoMoon&lt;/h2&gt;

&lt;p&gt;Having only recently discovered the site, I am quickly becoming a big fan of the IcoMoon fonts. There is a free pack available that provides you with 450 free icons that come in &lt;strong&gt;PNG or SVG&lt;/strong&gt; format.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Icons/icomoon-free-icons.png" alt="IcoMoon free icons" /&gt;&lt;/p&gt;

&lt;p&gt;To download the pack, please visit the &lt;a href="http://icomoon.io/#icons"&gt;site&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Simple Icons&lt;/h2&gt;

&lt;p&gt;This list was recently featured on the &lt;a href="http://www.smashingmagazine.com/2013/03/10/free-brand-icons-color-style-guides-icons/"&gt;Smashing Magazine website&lt;/a&gt;, but I thought that these icons were definitely worth a repost. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Icons/simpleicons-free-icons.png" alt="Simple icons free" /&gt;&lt;/p&gt;

&lt;p&gt;Simple icons can be downloaded from the site at &lt;a href="http://simpleicons.org"&gt;simpleicons.org&lt;/a&gt; and come with 116 PNG icons in eleven sizes, ranging from 16px to 4096px.&lt;/p&gt;

&lt;h2&gt;The Entypo Pictogram Suite&lt;/h2&gt;

&lt;p&gt;Entypo is a set of 250+ pictograms that also contains a set of icon fonts. If you aren't familiar with icon fonts, think of them as Wingdings for the web. They scale really well and don’t require http requests for each character making them perfect for the web. For more information on icon fonts, check out this &lt;a href="http://www.vanseodesign.com/web-design/icon-fonts/"&gt;blog&lt;/a&gt;.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Icons/entypo-free-icons.png" alt="Entypo free icons" /&gt;&lt;/p&gt;

&lt;p&gt;And to download the icon pack, check out the &lt;a href="http://www.entypo.com/"&gt;entypo.com&lt;/a&gt; website.&lt;/p&gt;

&lt;h2&gt;Typicons&lt;/h2&gt;

&lt;p&gt;Typicons are a set of free vector icons embedded in a webfont kit for easy use in your UI. Again,  this icon pack comes in both &lt;strong&gt;PNG or SVG&lt;/strong&gt; format. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Icons/typicons-free-icons.png" alt="Typicons free icons" /&gt;&lt;/p&gt;

&lt;p&gt;For more information or to download  the pack,  please visit the website at &lt;a href="http://typicons.com/"&gt;typicons.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you have found this list useful! If you have any icons that you think are worthwhile adding to this list, please feel free to leave a comment below.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=KmmhFDTeyyE:pSkLeHPkJR8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/KmmhFDTeyyE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Free%20icon%20packs%20for%20developers/87</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/ZjqTWj_CCi4/86</link><title>The Google PageSpeed API &amp; MVC 4</title><description>&lt;p&gt;I often use tools such as &lt;strong&gt;Yahoo! YSlow&lt;/strong&gt; and &lt;strong&gt;Google PageSpeed&lt;/strong&gt; to profile the performance of my websites. These tools offer useful performance suggestions that will improve the speed and performance of my sites if implemented correctly. They both plug into the browser and can be run at the click of a button. Depending on how often you profile your website, it can be quite a manual process running the tool through the browser every time you wish to check the performance of a web page.  Fortunately, Google have developed an API for the &lt;strong&gt;Google PageSpeed&lt;/strong&gt; service.&lt;/p&gt;

&lt;p&gt;The API allows you to programmatically generate &lt;strong&gt;PageSpeed&lt;/strong&gt; scores and suggestions and makes it easy to integrate performance analysis into your development tools and workflow. If your company or organisation is interested in web performance, you could build tools around this and use it as part of your &lt;strong&gt;Continuous Integration&lt;/strong&gt; process. You could even use it to build a performance dashboard for all of your products. It's a pretty cool API that can be easily implemented.&lt;/p&gt;

&lt;p&gt;In this article, I am going to run through a simple example using &lt;strong&gt;ASP.NET MVC 4&lt;/strong&gt; and the &lt;strong&gt;PageSpeed API&lt;/strong&gt; that will show you how to retrieve performance results for a webpage. The API will return performance information about your site such as the score, performance rule/result, and the rule impact.&lt;/p&gt;

&lt;h2&gt;API key&lt;/h2&gt;

&lt;p&gt;In order to get started, you will need to get an API key from the &lt;a href="https://code.google.com/apis/console/"&gt;Google APIs Console&lt;/a&gt;. In the Services pane, activate the &lt;strong&gt;PageSpeed Insights API&lt;/strong&gt; and go to the API Access tab.  The API key is near the bottom of that pane, in the section titled "Simple API Access." After you have an API key, your application can append the query parameter &lt;em&gt;key=yourAPIKey&lt;/em&gt; to all request URLs.&lt;/p&gt;

&lt;h2&gt;Using the service&lt;/h2&gt;

&lt;p&gt;Once you have your key, calling the API is a pretty simple process. You simply need to hit the following URL with the API key and the page to be checked.&lt;/p&gt;

&lt;strong&gt;https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url={pageURL}&amp;amp;key={yourAPIKey}&lt;/strong&gt;
&lt;br/&gt;
&lt;br/&gt;

&lt;p&gt;Try and use that URL in your browser with your API key and page to test. The API returns a set of results in &lt;strong&gt;JSON&lt;/strong&gt; which is easy to read and work with.&lt;/p&gt;

&lt;p&gt;In this example, I am going to use &lt;strong&gt;ASP.NET MVC 4&lt;/strong&gt; to work with the API and build a simple dashboard. Using the power of &lt;strong&gt;C#&lt;/strong&gt; and &lt;strong&gt;MVC 4&lt;/strong&gt;, we can write an ActionMethod that is &lt;strong&gt;asynchronous&lt;/strong&gt; and calls the API in a non-blocking fashion. The code below shows this ActionMethod in action.&lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5047078.js"&gt;&lt;/script&gt;

&lt;p&gt;On line 1, I am adding a simple 'async' keyword in the declaration of the Action. This signals to the framework that we are going to run this Action asynchronously.&lt;/p&gt;

&lt;p&gt;On line 4 and 5, I am calling the &lt;strong&gt;Google PageSpeed API&lt;/strong&gt; using the web page that I want to profile as well as the API key that we generated earlier. You may also notice that I have decorated the &lt;em&gt;client.GetAsync&lt;/em&gt; method with an await operator. This notifies the framework that it needs to await the completion of this method. The beauty of the new asynchronous functionality in .NET makes it really simple to write asynchronous code. It is no longer a complex and tedious task to get your code to run asynchronously.&lt;/p&gt;

&lt;p&gt;On line 10, I am using the await operator again and reading the contents of the HTTP request that I made in line 5. Finally, I am deserializing the contents of the response into an object that I can return to my view. The code snippet below shows the object that the HTTP response is deserialized into.&lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5140647.js"&gt;&lt;/script&gt;

&lt;p&gt;It's as simple as that! You can choose to do whatever you want with the data on your views. As part of an experiment, I used the results from the &lt;strong&gt;Google PageSpeed API&lt;/strong&gt; and built a performance dashboard. &lt;/p&gt;

&lt;p&gt;It is still in the early stages, but I am hoping to add to this continually. For more information, check out the page on this site at &lt;a href="http://www.deanhume.com/Home/PageSpeed"&gt;www.deanhume.com/Home/PageSpeed&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Further reading&lt;/h2&gt;

&lt;p&gt;If you would like to learn more about asynchronous programming in &lt;strong&gt;C# 4.5&lt;/strong&gt; please check out the following links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;- &lt;a href="http://blogs.msdn.com/b/dotnet/archive/2012/04/03/async-in-4-5-worth-the-await.aspx"&gt;http://blogs.msdn.com/b/dotnet/archive/2012/04/03/async-in-4-5-worth-the-await.aspx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;- &lt;a href="http://code.jonwagner.com/2012/09/06/best-practices-for-c-asyncawait"&gt;http://code.jonwagner.com/2012/09/06/best-practices-for-c-asyncawait&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;strong&gt;Google PageSpeed&lt;/strong&gt; documentation is also very thorough and gives some great examples - for more information, check out this &lt;a href="https://developers.google.com/speed/docs/insights/v1/getting_started"&gt;link&lt;/a&gt; &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=ZjqTWj_CCi4:ZyRjjIVa6CY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/ZjqTWj_CCi4" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/The%20Google%20PageSpeed%20API%20&amp;%20MVC%204/86</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/h9OEcO_HHnk/85</link><title>Frontend Single Point of Failure</title><description>&lt;p&gt;At this year's &lt;a href="http://velocityconf.com/velocityeu2012/"&gt;Velocity Europe conference&lt;/a&gt;, I watched a great talk by Google's &lt;a href="http://blog.patrickmeenan.com/"&gt;Patrick Meenan&lt;/a&gt; about 3rd party scripts and frontend &lt;strong&gt;Single Point of Failure&lt;/strong&gt; (SPOF). A single point of failure is a part of a system that, if it fails, will stop the entire system from working. Quite often, you may add 3rd party scripts such as jQuery, social sharing buttons or Ad tracking scripts to your website with the best intentions, but depending on the way that these scripts are loaded you could potentially create a frontend single point of failure that can block the entire site! &lt;/p&gt;

&lt;p&gt;If these 3rd party scripts are not implemented and deployed properly they pose a significant risk for the websites that host them. Finding and tracking frontend &lt;strong&gt;SPOFs&lt;/strong&gt; on your website is not always easy, but fortunately there are tools available that will help you detect them. One of the tools that was discussed at &lt;strong&gt;Velocity Europe&lt;/strong&gt; was &lt;a href="https://chrome.google.com/webstore/detail/spof-o-matic/plikhggfbplemddobondkeogomgoodeg"&gt;SPOF-o-matic&lt;/a&gt;. This tool is an excellent plugin for &lt;strong&gt;Google Chrome&lt;/strong&gt; that detects frontend single points of failure and allows you to simulate these 3rd party resources being unavailable.&lt;/p&gt;

&lt;p&gt;Once you have downloaded and added the plugin to &lt;strong&gt;Chrome&lt;/strong&gt;, simply navigate to your desired webpage. If you have any scripts that are blocking the webpage, you will notice a number in the top right-hand corner of the browser above the plugin. This number represents the number of scripts that could potentially block the website.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/SPOF/SPOF-O-Matic.PNG" alt="SPOF-o-matic" /&gt;&lt;/p&gt;

&lt;p&gt;Click on the plugin and you will be presented with a list of the blocking scripts.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/SPOF/SPOF-blocking.PNG" alt="Frontend single point of failure blocking" /&gt;&lt;/p&gt;

&lt;p&gt;If you choose to enable resource blocking and reload the page, you will be presented with a great example of what would happen if a server that was hosting the 3rd party script went down. The results can be pretty devastating and this can happen to all sites, from major eCommerce companies to small startups.The video below shows what happens to this very page when it becomes blocked by a 3rd party script. The video on the left shows the page without it being blocked by external scripts, and the video on the right shows the same page being affected by a SPOF. Notice the difference in load times!&lt;/p&gt;
&lt;video width="320" height="240" controls&gt;
  &lt;source src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/SPOF/Single-Point-of-Failure.mp4" type="video/mp4"&gt;
Please download the video at the following &lt;a href="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/SPOF/Single-Point-of-Failure.mp4"&gt;link&lt;/a&gt;
&lt;/video&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;p&gt;As you surf the web with this plugin enabled, you may notice how many websites have blocking scripts on their pages! If possible, the best option is to load these scripts in an &lt;strong&gt;async&lt;/strong&gt; or &lt;strong&gt;non-blocking&lt;/strong&gt; way.&lt;/p&gt;

&lt;p&gt;When embedding scripts on your site, consider using the &lt;strong&gt;async&lt;/strong&gt; or &lt;strong&gt;defer&lt;/strong&gt; tags to load them asynchronously. I have previously &lt;a href="http://www.deanhume.com/Home/BlogPost/html5-asynchronous-javascript/72"&gt;blogged&lt;/a&gt; about these HTML attributes and the way that you can use them to asynchronously load JavaScript. Another option is to actually use &lt;strong&gt;JavaScript&lt;/strong&gt; itself to load the third party script - there are some great examples in this &lt;a href="http://css-tricks.com/thinking-async/"&gt;blog post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you work with 3rd party scripts on your site, you will need to be mindful of the pitfalls that could occur if they aren't implemented properly. You could save yourself from an embarrassing outage!&lt;/p&gt;

&lt;p&gt;For some further reading, check out the following links:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.stevesouders.com/blog/2010/06/01/frontend-spof/"&gt;http://www.stevesouders.com/blog/2010/06/01/frontend-spof/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://calendar.perfplanet.com/2012/spofcheck-fighting-frontend-spof-at-its-root/"&gt;http://calendar.perfplanet.com/2012/spofcheck-fighting-frontend-spof-at-its-root/&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=h9OEcO_HHnk:Q92yxWlKf5E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/h9OEcO_HHnk" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Frontend%20Single%20Point%20of%20Failure/85</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/3ZevB_aOMbI/84</link><title>I'm writing a book! Fast ASP.NET Websites</title><description>&lt;p&gt;Ever since I first started writing code, I've always been interested in the performance of websites and making them faster. It's amazing how a slow website can be brought to life with a few simple tweaks to your website setup. There is nothing more satisfying than seeing someone use a website that you have worked on and exclaim, "Wow, this is fast!"&lt;/p&gt;

&lt;p&gt;In the open source community, there is a big focus on website performance and building stronger, faster websites. However, this same information on web performance isn't as readily available within the &lt;strong&gt;.NET&lt;/strong&gt; community. This prompted me to write a step-by-step book that will guide you and show you how to improve the performance of your websites. Even if you think your website is already fast, I'm pretty sure that you can make it even faster! &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Book/Fast%20ASP.NET%20Websites.jpg" alt="Fast ASP.NET Websites - Dean Hume" /&gt;&lt;/p&gt;

&lt;p&gt;The first section of the book is based on front-end performance, and you’ll discover how to use profiling tools such as &lt;strong&gt;Yahoo! YSlow&lt;/strong&gt; and &lt;strong&gt;Google PageSpeed&lt;/strong&gt; to take your website from zero to 100. The next section looks at some of the finer details of web page performance and leveraging HTML5 to improve the performance of your site. The final section of the book is dedicated to &lt;strong&gt;ASP.NET Webforms&lt;/strong&gt; and &lt;strong&gt;ASP.NET MVC&lt;/strong&gt; specific techniques that will improve your page load times across your website.&lt;/p&gt;

&lt;p&gt;Each chapter also comes with source code examples in both &lt;strong&gt;ASP.NET MVC&lt;/strong&gt; and &lt;strong&gt;ASP.NET Webforms&lt;/strong&gt;, which allows you to follow along and make improvements to your site regardless of your development style. The changes in each chapter are easy to follow and make use of the new &lt;strong&gt;Visual Studio 2012&lt;/strong&gt; features that are available. As part of some early marketing material, excerpts from a few of the chapters and they are available online on &lt;a href="http://www.codeproject.com/Articles/506675/Working-with-a-CDN-in-Development"&gt;Codeproject&lt;/a&gt; and DevCurry for you to read. &lt;/p&gt;

&lt;p&gt;The book will be published by &lt;a href="http://manning.com/hume"&gt;Manning&lt;/a&gt; and is officially available in early summer 2013. However, if you would like to read chapter-by-chapter while it's being written and get access to the final book as soon as it's finished, it is available on &lt;a href="http://manning.com/hume"&gt;Manning.com&lt;/a&gt; via the Manning Early Access Program - anyone can sign up! I will update this blog with progress of the book periodically, and I look forward to releasing it to you in early &lt;strong&gt;summer 2013&lt;/strong&gt;! &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=3ZevB_aOMbI:1SGcKz9_W48:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/3ZevB_aOMbI" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/I'm%20writing%20a%20book!%20Fast%20ASP.NET%20Websites/84</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/YPw-BOvtVOs/83</link><title>Disabling Flash in browsers</title><description>&lt;p&gt;I am currently working in a team where we are replacing an older &lt;strong&gt;Flash&lt;/strong&gt; implementation of a product with a shiny new &lt;strong&gt;HTML5&lt;/strong&gt; version. Quite often we find ourselves needing to disable &lt;strong&gt;Flash&lt;/strong&gt; in many different browsers as we run through the testing process with the new product. I often forget how to do this because there are so many browsers, so I thought that compiling a list of instructions for each browser might come in handy for other developers and testers out there too. &lt;/p&gt;

&lt;h2&gt;Google Chrome&lt;/h2&gt;

&lt;p&gt;Let's begin with &lt;strong&gt;Google Chrome&lt;/strong&gt;. In your address bar type "&lt;em&gt;about:plugins&lt;/em&gt;". This will bring up a page that displays all the plugins that you have installed for Google Chrome. Generally, the first plug-in on the list is Adobe &lt;strong&gt;Flash&lt;/strong&gt; player, so you can simply disable it there.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DisableFlash/Disable-Flash-AddressBar-Chrome.png" alt="Disable Flash in Chrome" /&gt;&lt;/p&gt;

&lt;h2&gt;Internet Explorer 9&lt;/h2&gt;

&lt;p&gt;Flash can be easily disabled in Internet Explorer using the settings menu. Click on the settings “&lt;em&gt;cog&lt;/em&gt;" in the top right hand corner of the browser and choose "&lt;em&gt;Manage add-ons&lt;/em&gt;".&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DisableFlash/Internet-Explorer-Disable-Flash-Menu.png" alt="Internet Explorer Disable Flash" /&gt;&lt;/p&gt;

&lt;p&gt;Next, click on "&lt;em&gt;Toolbars and Extensions&lt;/em&gt;" and choose "&lt;em&gt;Shockwave Flash Object&lt;/em&gt;". In the bottom right hand corner of the pop up window is a button that allows you to disable the &lt;strong&gt;Flash&lt;/strong&gt; add-on.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DisableFlash/Internet-Explorer-Add-ons.png" alt="Internet Explorer Add-ons" /&gt;&lt;/p&gt;

&lt;h2&gt;Firefox&lt;/h2&gt;

&lt;p&gt;Firefox has an easy to access menu that you can use to disable &lt;strong&gt;Flash&lt;/strong&gt;. Start by clicking the "&lt;em&gt;Firefox&lt;/em&gt;" menu in the top left hand corner and selecting "&lt;em&gt;Add-ons&lt;/em&gt;".&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DisableFlash/Firefox-Add-ons-Menu.png" alt="Firefox Disable Flash " /&gt;&lt;/p&gt;

&lt;p&gt;You will be presented with a screen that looks similar to the image below:&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DisableFlash/Firefox-Add-ons-Disable-Flash.png" alt="Firefox Disable Flash menu" /&gt;&lt;/p&gt;

&lt;p&gt;If you browse through the list of plugins, you will notice the &lt;strong&gt;Shockwave Flash&lt;/strong&gt; plugin. This can be easily disabled with the &lt;em&gt;enable/disable&lt;/em&gt; button that is located next to it.&lt;/p&gt;

&lt;h2&gt;Safari&lt;/h2&gt;

&lt;p&gt;Disabling &lt;strong&gt;Flash&lt;/strong&gt; in Safari is a little trickier than the other browsers and always seems to catch me out. In the top right hand corner of the browser is a settings "&lt;em&gt;cog&lt;/em&gt;". Click this and choose "&lt;em&gt;Preferences&lt;/em&gt;".&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DisableFlash/Safari-Disable-Flash.png" alt="Safari Disable Flash" /&gt;&lt;/p&gt;

&lt;p&gt;Next, you will need to navigate to the "&lt;em&gt;Security&lt;/em&gt;" tab on the menu.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DisableFlash/Safari-Disable-Flash-Menu.png" alt="Safari Disable Flash menu" /&gt;&lt;/p&gt;

&lt;p&gt;There is no option to disable individual plug-ins, so you will need to uncheck the checkbox and disable all plugins.&lt;/p&gt;

&lt;h2&gt;Opera&lt;/h2&gt;

&lt;p&gt;The final browser on this list is Opera. Disabling Flash in &lt;strong&gt;Opera&lt;/strong&gt; is a very simple process. Simply hit &lt;strong&gt;F12&lt;/strong&gt; and you will be presented with a menu similar to the image below.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DisableFlash/Opera-Disable-Flash.png" alt="Opera Disable Flash" /&gt;&lt;/p&gt;

&lt;p&gt;Simply uncheck "&lt;em&gt;Enable plug-ins&lt;/em&gt;" and flash will no longer run in the browser. This list of browsers is far from complete and there are a few more browsers that I would like to add to this list. Please feel free to suggest more browsers and I will get them added to the list! &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=YPw-BOvtVOs:tYrvzR7nxEs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/YPw-BOvtVOs" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Disabling%20Flash%20in%20browsers/83</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/voAU1l2a47Y/82</link><title>.NET Caching - File Dependencies</title><description>&lt;p&gt;In a &lt;a href="http://www.deanhume.com/home/blogpost/object-caching----net-4/37"&gt;previous blog post&lt;/a&gt;, I wrote about the built in support that .NET has for in-memory caching. It sits under the &lt;strong&gt;System.Runtime.Caching&lt;/strong&gt; namespace and can be easily added to any application to give you a great improvement in performance. You can store any type of object in the cache and this makes it extremely useful for storing different types of data.&lt;/p&gt;

&lt;p&gt;In this post, we are going to run through a very handy feature that is built into the &lt;strong&gt;System.Runtime.Caching&lt;/strong&gt; namespace - &lt;strong&gt;FileChangeMonitor&lt;/strong&gt;. As the name suggests, FileChangeMonitor will monitor the contents of a file and respond as soon as any changes are made to that file. Instead of having your cache expire at a certain date or time, you can add a file dependency to your cache using the &lt;strong&gt;FileChangeMonitor&lt;/strong&gt;. It means that when the contents of a certain file change, your cache becomes invalidated and you will need to retrieve a fresh copy. This is ideal for certain situations where you might be caching the contents of a file and don't want to stop and restart your entire application just for the changes to take effect. &lt;/p&gt;

&lt;p&gt;Let's take a closer look at an example the &lt;strong&gt;FileChangeMonitor&lt;/strong&gt; in action. The following snippet contains the code that is needed to add a file into cache using the &lt;strong&gt;FileChangeMonitor&lt;/strong&gt;.&lt;/p&gt;

&lt;script src="https://gist.github.com/4147456.js?file=FileChangeMonitor"&gt;&lt;/script&gt;

&lt;p&gt;In line 1, we are obtaining a reference to the default &lt;strong&gt;MemoryCache&lt;/strong&gt; instance. The following line contains a reference to the &lt;strong&gt;CacheItemPolicy&lt;/strong&gt; that we will be using as a reference to store the data with. Using the &lt;strong&gt;_cache.Get&lt;/strong&gt; method in line 10, we are trying to retrieve the data from the cache based on the cache key. If nothing is found, then we simply try and read the contents of the file and add it into cache.&lt;/p&gt;

&lt;p&gt;The most important part to notice here is this line&lt;/p&gt;

&lt;p&gt;&lt;em&gt;_policy.ChangeMonitors.Add(new HostFileChangeMonitor(new List&lt;string&gt; { ImportantFilePath }));&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here, we are adding a &lt;strong&gt;FileChangeMonitor&lt;/strong&gt; into the list of &lt;strong&gt;ChangeMonitors&lt;/strong&gt; that will be stored against the data in the cache. This important piece of information will be used to check if the contents of the file have changed and if so it will invalidate the cache. This will cause the null check on line 14 to fail and a new version of the contents will be read from the file.&lt;/p&gt;

&lt;p&gt;The flow of logic for the above piece of code might look something like the image below&lt;/p&gt;

&lt;p aling="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/FileChangeMonitor/File-Change-Monitor-FlowChart-New.png" alt="FileChangeMonitor Flowchart" /&gt;&lt;/p&gt;

&lt;p&gt;It's that easy! I have found this .NET feature to be very helpful when dealing with caching. I hope after reading this that it benefits you too!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=voAU1l2a47Y:ZJHw0Tbc0y8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/voAU1l2a47Y" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/.NET%20Caching%20-%20File%20Dependencies/82</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/y9rPb9vGmVI/81</link><title>The Five Whys</title><description>&lt;p&gt;I've been reading a book called the &lt;a href="http://theleanstartup.com/"&gt;Lean Startup&lt;/a&gt; recently. It is filled with great advice and the &lt;strong&gt;Lean Startup&lt;/strong&gt; is basically a business approach that aims to change the way that companies build and launch new products. Whilst reading the book I came across a chapter that dealt with a technique called &lt;a href="http://en.wikipedia.org/wiki/5_Whys"&gt;the Five Whys&lt;/a&gt;. This technique instantly piqued my interest as it is relates quite closely to problem solving in a product development environment.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/5Whys/5-Whys.jpg" alt="The Five Whys" /&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Five Whys technique&lt;/strong&gt; was originally developed by &lt;a href="http://en.wikipedia.org/wiki/Sakichi_Toyoda"&gt;Sakichi Toyoda&lt;/a&gt; and was used within the &lt;strong&gt;Toyota Motor Corporation&lt;/strong&gt; during the evolution of its manufacturing methodologies. It is a methodology that allows us to get to the root cause of a problem. The system takes its name from an investigative method of asking the question "&lt;em&gt;why&lt;/em&gt;?" five times in order to understand what has happened. In theory this sounds simple, but putting this into practice is a lot harder than it sounds. By systematically going through a problem five times, you force yourself to get to the real root cause of the problem.&lt;/p&gt;

&lt;p&gt;An example of how this could be applied to a software development process may look something similar to the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why did the signup form fail? &lt;em&gt;Because the API returned an error.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Why did the API return an error? &lt;em&gt;Because the email address wasn’t being validated and caused the API to fail.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Why wasn’t the email address being validated? &lt;em&gt;Because we didn’t think it was necessary.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Why don't we have email validation in place? &lt;em&gt;Because we rushed to get code out and didn't think we needed it.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Why are we releasing code on a Friday night? &lt;em&gt;Because there is no policy in place that says that we can't.&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If this systematic procedure of asking "&lt;em&gt;why&lt;/em&gt;" five times wasn't done, we wouldn't have gotten to the root cause of the problem. We might have just fixed the signup form and not the root cause of the problem. There could be a number of reasons why a development team may only look at the initial issue instead of the root cause of the issue, but by using the &lt;strong&gt;Five Whys&lt;/strong&gt; you are ensuring that nothing slips through undetected. At each stage of the &lt;strong&gt;Five Whys&lt;/strong&gt;, you are also able to identify different actions that need to be done in order to fix the problem.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Five Whys&lt;/strong&gt; doesn't only relate to software development, it can be applied to all manner of issues that need resolving. In fact, the &lt;strong&gt;National Health Service&lt;/strong&gt; in the United Kingdom &lt;a href="http://www.institute.nhs.uk/quality_and_service_improvement_tools/quality_and_service_improvement_tools/identifying_problems_-_root_cause_analysis_using5_whys.html"&gt;actually use this technique&lt;/a&gt; when dealing with hospital issues. A key phrase to keep in mind in any &lt;strong&gt;Five Why&lt;/strong&gt; exercise is "&lt;em&gt;people do not fail, processes do&lt;/em&gt;". You will often find that the root cause of the issue can be resolved by a simple change in process. The &lt;strong&gt;Five Whys&lt;/strong&gt; can act as a powerful feedback loop. By simply making small adjustments to your processes and revisiting them with the &lt;strong&gt;Five Whys&lt;/strong&gt;, you can ensure that little by little, large problems are resolved at the root cause.&lt;/p&gt;

&lt;p&gt;I have only given a brief summary on the &lt;strong&gt;Five Whys&lt;/strong&gt;, but for more information check out the book - &lt;strong&gt;The Lean Startup&lt;/strong&gt; or for more information take a look at &lt;a href="http://www.isixsigma.com/tools-templates/cause-effect/determine-root-cause-5-whys/"&gt;this article&lt;/a&gt;. The next time that an issue affects your team, I recommend that you give the &lt;strong&gt;Five Whys&lt;/strong&gt; a try!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=y9rPb9vGmVI:CKiSRSAJAfQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/y9rPb9vGmVI" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/The%20Five%20Whys/81</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/xFhwbEBWMJY/80</link><title>Improve Page Load Times With DNS Prefetching</title><description>&lt;p&gt;I'm often looking for ways to improve the performance of my websites and provide a better experience for users. Quite often you may find that your site is running efficiently and performing well. You may also have run your application through &lt;a href="https://developers.google.com/speed/pagespeed/"&gt;Google PageSpeed&lt;/a&gt; or &lt;a href="http://developer.yahoo.com/yslow/"&gt;Yahoo! YSlow&lt;/a&gt; and come out with a great score. However, one thing that has always affected my page load times is the time that it takes to lookup the &lt;strong&gt;DNS&lt;/strong&gt; for the different components on a page. For example, the image below shows a waterfall chart for the resources that load on the first page of my blog:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DomainPrefetch/Waterfall-Chart-New.png" alt="DNS Waterfall Chart" /&gt;&lt;/p&gt;

&lt;p&gt;Notice the dark blue part of the bar that appears before most components in the waterfall chart. This dark blue is the time the &lt;strong&gt;DNS lookup&lt;/strong&gt; takes when downloading a resource. It's quite a large percentage of the component download time! Even if the component is optimized and has been &lt;em&gt;minified/bundled/smushed&lt;/em&gt;, you still have the &lt;strong&gt;DNS&lt;/strong&gt; lookup to contend with. I used &lt;a href="http://www.webpagetest.org/"&gt;webpagetest.org&lt;/a&gt; to generate a table with the &lt;strong&gt;DNS&lt;/strong&gt; lookup times of this website.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/DomainPrefetch/DNS-Lookup-Time.png" alt="DNS Lookup Time" /&gt;&lt;/p&gt;

&lt;p&gt;As you can see from the image above, those times are quite high and it would be much more efficient if we could cut down on this time and speed it up. Fortunately, there is a cool trick that will make the load time of your webpages happen even faster. It's known as &lt;strong&gt;DNS prefetching&lt;/strong&gt;, and it's really easy to implement. All that you need to do is include the following attribute as a link at the top of your webpage.&lt;/p&gt;

&lt;strong&gt;&lt;code&gt;&amp;lt;link rel="dns-prefetch" href="//host_name_to_prefetch.com"&amp;gt;&lt;/code&gt;&lt;/strong&gt;
&lt;br/&gt;
&lt;br/&gt;

&lt;p&gt;&lt;strong&gt;DNS prefetching&lt;/strong&gt; is an attempt to resolve domain names before a user tries to follow a link. Once a domain name has been resolved and if the user does navigate to that domain, there will be no delay due to &lt;strong&gt;DNS&lt;/strong&gt; resolution time. On this blog, you hit the main page and are presented with a lot of links to the different posts. If I am able to prefetch the &lt;strong&gt;DNS&lt;/strong&gt; of some of the external links before a user navigates to the next page, I will be able to cut down a huge chunk on the &lt;strong&gt;DNS&lt;/strong&gt; lookup time for the next page. According to the &lt;a href="http://www.chromium.org/developers/design-documents/dns-%20prefetching"&gt;Chromium documentation&lt;/a&gt;, if a user resolves a domain name to an IP address and this is cached, the resolution time can be as low as 0-1ms (a thousandth of a second). That is pretty impressive!&lt;/p&gt;

&lt;p&gt;I added &lt;strong&gt;DNS prefetching&lt;/strong&gt; to this site and definitely noticed improved load times. There is currently support for this in most major browsers (&lt;em&gt;excluding IE&lt;/em&gt;), so it doesn't make sense not to use this in your web applications today! &lt;strong&gt;DNS prefetch&lt;/strong&gt; is a safe &lt;strong&gt;HTML5&lt;/strong&gt;  feature that will simply be ignored if used by older browsers if not supported. If your 
webpages uses content from multiple domains, this is definitely a clever way to speed up your page load times!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=xFhwbEBWMJY:VpB1reZuTCc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/xFhwbEBWMJY" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Improve%20Page%20Load%20Times%20With%20DNS%20Prefetching/80</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/FBC1H0K6G-E/79</link><title>Velocity Conference Europe 2012 - Roundup</title><description>&lt;p&gt;This week saw the return of Velocity Conference Europe to our shores. With a great line up of speakers, this conference is a gathering of hundreds of web ops and performance professionals that get together to share their ideas and expertise. Without a doubt, this is one of my favourite conferences. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Velocity/Velocity-Europe-Logo.png" alt="Velocity Conference Logo" /&gt;&lt;/p&gt;

&lt;p&gt;In my next few blog posts, I hope to cover some of the great things that I have learnt while attending this conference. In the meantime, I wanted to put together a collection of links and slides that relate to the different presentations. My brain is still reeling with hundreds of ideas and my notepad seems to reflect this! &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Velocity/Velocity-notepad.JPG" alt="Velocity Conference Notes" /&gt;&lt;/p&gt;

&lt;p&gt;The following are just a few of the presentations that stood out for me. For more information on the conference and the other presentations, please see the &lt;a href="http://velocityconf.com/velocityeu2012/"&gt;website&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Move Fast and Ship Things - Girish Patangay (Facebook)&lt;/h2&gt;

&lt;p&gt;The conference kicked off with an exciting talk from Girish Patangay, one of the release engineers at &lt;strong&gt;Facebook&lt;/strong&gt;. Surprisingly, Facebook deploy new code at least twice a day every day to tens of thousands of servers! The &lt;strong&gt;Facebook&lt;/strong&gt; source code is largely written in PHP and in order to improve the scalability of its PHP-based infrastructure, Facebook developed a special compiler called &lt;a href="http://developers.facebook.com/blog/post/2010/02/02/hiphop-for-php--move-fast/"&gt;HipHop&lt;/a&gt;. HipHop compiles all their PHP code into a single 1.5 GB binary. Deploying a 1.5 GB file across all of their servers can take time and in order to speed the process up, they use a BitTorrent deployment system. To read more about their deployment process, check out &lt;a href="http://arstechnica.com/business/2012/04/exclusive-a-behind-the-scenes-look-at-facebook-release-engineering/1/"&gt;this link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Webpagetest.org - Patrick Meenan (Google)&lt;/h2&gt;

&lt;p&gt;I have been using &lt;a href="http://www.webpagetest.org"&gt;webpagetest.org&lt;/a&gt; for some time now to test the speed and performance of my websites from different locations around the world. Patrick Meenan from Google gave a presentation on some of the newer features of &lt;a href="http://www.webpagetest.org"&gt;webpagetest.org&lt;/a&gt; such as the &lt;a href="http://en.wikipedia.org/wiki/Single_point_of_failure"&gt;SPOF&lt;/a&gt; tab and the ability to profile a website using a mobile phone agent. If you haven't used &lt;strong&gt;webpagetest.org&lt;/strong&gt; before, I thoroughly recommend that you check it out. The site is totally free, and it can give you an interesting insight into how your website performs from other locations throughout the world.&lt;/p&gt;

&lt;h2&gt;Make Your Mobile Web Apps Fly - Sam Dutton (Google)&lt;/h2&gt;

&lt;p&gt;Sam Dutton from Google gave a talk about mobile web performance and ways that you can improve the speed of your mobile web applications. Below is a list of a few of the topics that he talked about:&lt;/p&gt;

&lt;p&gt;-- Creating Fast Buttons for Mobile Web Applications - &lt;a href="https://developers.google.com/mobile/articles/fast_buttons"&gt;https://developers.google.com/mobile/articles/fast_buttons&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-- &lt;a href="http://cdn.oreillystatic.com/en/assets/1/event/79/Who%20Killed%20My%20Battery_%20Analyzing%20Mobile%20Browser%20Energy%20Consumption%20Presentation.pdf"&gt;Who killed my battery?&lt;/a&gt; An interesting insight into the way that bad code can affect the battery performance of a mobile website.&lt;/p&gt;

&lt;p&gt;-- &lt;a href="http://siliconforks.com/jscoverage/"&gt;Unnecessary JavaScript code can be wasteful&lt;/a&gt;. Use a code coverage tool to remove any unused code.&lt;/p&gt;

&lt;h2&gt;Scaling Instagram - Mike Krieger (Instagram)&lt;/h2&gt;

&lt;p&gt;Instagram has been a huge success and was recently bought by Facebook for $1 billion. They have surpassed the 80 million user mark, and not surprisingly Mike Krieger gave an interesting presentation about the techniques that Instagram use to scale their services. The team at Instagram only consists of 7 people. Considering that the website has such a massive user base, this is a monumentous accomplishment!&lt;/p&gt;

&lt;p&gt;I have included a link to the presentation below:&lt;/p&gt;

&lt;p&gt;&lt;iframe class="scribd_iframe_embed" src="http://www.scribd.com/embeds/89025069/content?start_page=1&amp;amp;view_mode=scroll" data-auto-height="true" data-aspect-ratio="" scrolling="no" id="doc_46408" width="100%" height="600" frameborder="0"&gt;&lt;/iframe&gt;&lt;/p&gt;

&lt;h2&gt;Mobile Profiling - Remy Sharp (Left Logic)&lt;/h2&gt;

&lt;p&gt;If you develop websites for mobile devices, you will know what a pain debugging and profiling can be. Most of the mobile browsers don't really come with adequate debugging tools and simulators just don't get close enough to the real thing. &lt;strong&gt;Remy Sharp&lt;/strong&gt; gave a great presentation about mobile profiling and some of the ways that you can get around the problems that mobile developers face. One of the tools that you can use is &lt;a href="http://jsconsole.com"&gt;jsconsole.com&lt;/a&gt;. Remy developed this himself in order to solve a few of the problems that he was having while debugging a mobile website.&lt;/p&gt;

&lt;p&gt;Another free tool is &lt;a href="http://www.iwebinspector.com/"&gt;IWebInspector&lt;/a&gt; which allows you to debug Safari on iPad and iPhone.&lt;/p&gt;

&lt;h2&gt;To wrap up...&lt;/h2&gt;

&lt;p&gt;I was also lucky enough to bump into &lt;strong&gt;Steve Souders&lt;/strong&gt; who was one of the hosts for this years event. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/Velocity/Steve-Souders.JPG" alt="Velocity Conference Steve Souders" /&gt;&lt;/p&gt;

&lt;p&gt;He is a great guy and if you haven't already done so, I recommend checking out his website. If you are interested in web performance he has two great books  - &lt;a href="http://www.amazon.com/High-Performance-Web-Sites-Essential/dp/0596529309"&gt;High Performance Websites&lt;/a&gt; &amp;amp; &lt;a href="http://www.amazon.com/Even-Faster-Web-Sites-Performance/dp/0596522304/ref=pd_bxgy_b_img_y"&gt;Even Faster Websites&lt;/a&gt;. That's about it for this year's event. If you get the chance next year, I thoroughly recommend attending this conference!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=FBC1H0K6G-E:c3vQpM3AYYQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/FBC1H0K6G-E" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Velocity%20Conference%20Europe%202012%20-%20Roundup/79</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/NTWGVFRjQSE/78</link><title>Visual Studio 2012 - A week in perspective</title><description>&lt;p&gt;I am one of the lucky ones. Fortunately my company gives us a &lt;strong&gt;MSDN&lt;/strong&gt; subscription and this goes a long way toward keeping up with the &lt;a href="http://msdn.microsoft.com/en-us/library/bb386063.aspx"&gt;latest Microsoft Software&lt;/a&gt;. I have been eagerly awaiting the release of &lt;strong&gt;Microsoft Visual Studio 2012&lt;/strong&gt; which came out last week.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/VS2012/Visual-Studio-Logo.png" alt="Visual Studio 2012 Logo" /&gt;&lt;/p&gt;

&lt;p&gt;I was a little apprehensive about installing &lt;strong&gt;Visual Studio 2012&lt;/strong&gt; and running projects in &lt;strong&gt;Visual Studio 2010&lt;/strong&gt; side-by-side as I work in a team. Fortunately, the latest version offers a compatibility feature that allows you to run 2010 projects in 2012 and vice versa. It will need to add some migration settings to the project, but I have tested this and you can still open the project in &lt;strong&gt;Visual Studio 2010&lt;/strong&gt; without any problems.&lt;/p&gt;

&lt;h2&gt;Installing&lt;/h2&gt;

&lt;p&gt;After downloading the &lt;a href="http://www.microsoft.com/visualstudio/11/en-us/downloads"&gt;Web Installer&lt;/a&gt;, I began to install the software. I was very impressed with the overall install time. It clocked in at about 30 minutes and only one restart - pretty impressive considering how long it took to install &lt;strong&gt;VS 2010&lt;/strong&gt; and the SP1 service pack for it! I am running &lt;strong&gt;Visual Studio 2012&lt;/strong&gt; on &lt;strong&gt;Windows 7&lt;/strong&gt; and the first thing I noticed on the installer screen is the shiny new "&lt;em&gt;Metro&lt;/em&gt;" style layout.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/VS2012/Visual-Studio-2012-Install.png" alt="Visual Studio 2012 Install" /&gt;&lt;/p&gt;

&lt;p&gt;Once the installation was complete and Visual Studio started up for the first time, I was presented with the new grey-ish theme.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/VS2012/Visual-Studio-2012-Layout.png" alt="Visual Studio 2012 Layout" /&gt;&lt;/p&gt;

&lt;p&gt;Not a bad layout at all. It takes some getting used to, but I was thoroughly impressed with the speed with which solution files and projects opened. It seems as if the Visual Studio team have placed a lot of emphasis on the speed in &lt;strong&gt;Visual Studio 2012&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;Asynchronous Code&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Visual Studio 2012&lt;/strong&gt; is also packed with plenty of new features. I have been quite keen to start messing around with the new Asynchronous features that have been introduced with .Net 4.5 Framework. The async CTP was cool, but it just didn't quite feel right until the correct version was released. Now writing asynchronous tasks is super easy using the &lt;em&gt;System.Threading.Tasks&lt;/em&gt; namespace.&lt;/p&gt;

&lt;script src="https://gist.github.com/3403734.js?file=AsyncDemo.cs"&gt;&lt;/script&gt;

&lt;p&gt;For more information on the new &lt;strong&gt;asynchronous&lt;/strong&gt; methods in &lt;strong&gt;C#&lt;/strong&gt;, check out this &lt;a href="http://www.asp.net/vnext/overview/whitepapers/whats-new#_Toc318097376"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;AntiXSS&lt;/h2&gt;

&lt;p&gt;By default, the &lt;strong&gt;AntiXSS&lt;/strong&gt; Library is included with &lt;strong&gt;Visual Studio 2012&lt;/strong&gt;. In order to use it in your project, you simply need to add the following to your Web.config file.&lt;/p&gt;

&lt;script src="https://gist.github.com/3404735.js?file=antiXss.xml"&gt;&lt;/script&gt;

&lt;p&gt;For more information on the AntiXss Library, check out the following &lt;a href="http://wpl.codeplex.com/"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;ASP.net MVC 4 and Webforms Updates&lt;/h2&gt;

&lt;p&gt;There have been a load of cool new features introduced, including the new Bundling and Minification feature which sits under the &lt;em&gt;System.Web.Optimization&lt;/em&gt; namespace. It allows you to automatically minify and bundle your CSS and JavaScript files and works in both MVC and Webforms. &lt;strong&gt;MVC 4&lt;/strong&gt; is also included by default, which means you get all the shiny new features of this latest release of ASP.net MVC.&lt;/p&gt;

&lt;h2&gt;Nuget by default&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Visual Studio 2012&lt;/strong&gt; ships with &lt;strong&gt;Nuget&lt;/strong&gt; by default, which makes getting all the latest libraries in your application the click of a button away.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/VS2012/Add-References-Visual-Studio-2012.png" alt="Add References Visual Studio 2012" /&gt;&lt;/p&gt;

&lt;p&gt;The Reference Manager also has some noticeable changes:&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/VS2012/Reference-Manager-Visual-Studio-2012.png" alt="Visual Studio 2012 Reference Manager" /&gt;&lt;/p&gt;

&lt;h2&gt;Editor Updates&lt;/h2&gt;

&lt;p&gt;The JavaScript, HTML and CSS editors in &lt;strong&gt;Visual Studio 2012&lt;/strong&gt; are completely new and they greatly improve the overall development experience.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/VS2012/CSS-Editor-Visual-Studio-2012.png" alt="Visual Studio 2012 CSS Editor" /&gt;&lt;/p&gt;

&lt;h2&gt;Publishing&lt;/h2&gt;

&lt;p&gt;There are slightly updated publishing tools with the latest release. They allow you to save different versions of your release, which can be handy if you frequently deploy to a dev and live environment. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/VS2012/Publish-Settings-Visual-Studio-2012.png" alt="Publish Settings Visual Studio 2012" /&gt;&lt;/p&gt;

&lt;p&gt;It also includes a totally new way of deploying your &lt;strong&gt;Windows Azure&lt;/strong&gt; projects. No longer do you need a separate &lt;strong&gt;Azure&lt;/strong&gt; project just to publish your application. You can easily do this as if it were a standard deploy to an FTP location&lt;/p&gt;

&lt;h2&gt;IIS express &amp;amp; ASP.net Performance&lt;/h2&gt;

&lt;p&gt;The lastest version of IIS 8 ships with &lt;strong&gt;Visual Studio 2012&lt;/strong&gt; by default. I have been using IIS express for a while now in &lt;strong&gt;Visual Studio 2010&lt;/strong&gt; as a separate download, and it performs really well. You get all the features of a fully blown IIS, without needing to deploy to your local IIS every time.&lt;/p&gt;

&lt;p&gt;The ASP.net team have also focussed on the speed and performance of ASP.net websites. These changes include how much memory a website occupies and also the time it takes to launch a web server process for the site when the site assemblies are no longer in memory. For more information, check out this &lt;a href="http://www.asp.net/vnext/overview/whitepapers/whats-new#_Toc_perf_2"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;Overall I think that this latest release of &lt;strong&gt;Visual Studio 2012&lt;/strong&gt; is awesome. It feels a lot faster, and every click seems to respond instantly. The colour scheme is a little grey, but I guess this is the way that the overall "&lt;em&gt;Metro&lt;/em&gt;" theme is moving. This is a great product and an exciting time to be a .Net developer!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=NTWGVFRjQSE:kJjyAsTAmUA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/NTWGVFRjQSE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Visual%20Studio%202012%20-%20A%20week%20in%20perspective/78</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/ZHbGPvtbJsE/77</link><title>Net Magazine Article</title><description>&lt;p&gt;An article that I recently wrote for &lt;strong&gt;Net Magazine&lt;/strong&gt; is coming out in the September 2012 issue. The article talks about Content Delivery Networks and the benefits that using one can bring to the speed of your page load times. I am a big fan of the magazine, and it's definitely worth a read if you haven't read it before!&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/NetMagazine/netmag.png" alt="Net Magazine - Dean Hume" /&gt;&lt;/p&gt;

&lt;p&gt;The issue will be on sale in most good book stores and should hit the shelves around the 14th of August. For more information about Net Magazine, please check out &lt;a href="http://www.netmagazine.com/"&gt;this link.&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=ZHbGPvtbJsE:-xBcjGAX24Y:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/ZHbGPvtbJsE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Net%20Magazine%20Article/77</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/0ZzdBmIGiIw/74</link><title>Hidden Gems inside .Net Classes</title><description>&lt;p&gt;Surprisingly, there are loads of great data snippets hidden inside &lt;strong&gt;.Net&lt;/strong&gt; classes. If you've ever found yourself adding localization to your website, you may have come across the &lt;a href="http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo%28v=vs.71%29.aspx"&gt;CultureInfo Class&lt;/a&gt; in &lt;strong&gt;.Net&lt;/strong&gt;. I know that sometimes I have needed to get a list of country ISO codes and have struggled to get a comprehensive list, or I have needed to retrieve the list from a &lt;strong&gt;Database&lt;/strong&gt; containing the names. This can add an extra &lt;strong&gt;Database&lt;/strong&gt; call and could result in extra code maintenance, and possibly a performance hit.&lt;/p&gt;

&lt;p&gt;Well, this is where &lt;strong&gt;CultureInfo&lt;/strong&gt; comes to the rescue. Using this Class, you will be able to easily retrieve a list of country names and their ISO codes using built-in &lt;strong&gt;.Net&lt;/strong&gt; code.&lt;/p&gt;

&lt;script src="https://gist.github.com/3206032.js?file=CultureDetails.cs"&gt;&lt;/script&gt;

&lt;p&gt;Which gives you a list of 128 countries and their region information:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HiddenGems/Net-Culture-Names.png" alt="Net Culture Names" /&gt;&lt;/p&gt;

&lt;p&gt;We can then use the &lt;strong&gt;RegionInfo&lt;/strong&gt; Class to retrieve native names, currencies and ISO codes:&lt;/p&gt;

&lt;script src="https://gist.github.com/3206040.js?file=RegionInfo.cs"&gt;&lt;/script&gt;

&lt;p&gt;This gives you:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HiddenGems/CultureInfo-Currency-Native-Name.png" alt="CultureInfo Currency Native Name" /&gt;&lt;/p&gt;

&lt;p&gt;You can also retrieve the month names and day names:&lt;/p&gt;

&lt;script src="https://gist.github.com/3206048.js?file=DayMonthNames.cs"&gt;&lt;/script&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HiddenGems/CultureInfo-MonthNames.png" alt="CultureInfo Month Names" /&gt;&lt;/p&gt;

&lt;p&gt;Okay, so all of these are in English...what about other languages? You simply need to set the culture and you will be able to see the results in your chosen language.&lt;/p&gt;

&lt;script src="https://gist.github.com/3206051.js?file=FrenchDayNames.cs"&gt;&lt;/script&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HiddenGems/CultureInfo-Day-Names-French.png" alt="CultureInfo Day Names in French" /&gt;&lt;/p&gt;

&lt;p&gt;Another really handy class is the &lt;a href="http://msdn.microsoft.com/en-us/library/system.timezoneinfo.aspx"&gt;TimeZoneInfo&lt;/a&gt; class, it allows you to retrieve a list of time zones along with their names and values natively using .Net. It can be used to represent any &lt;strong&gt;time zone&lt;/strong&gt; in the world.&lt;/p&gt;

&lt;script src="https://gist.github.com/3214868.js?file=TimeZoneInfo.cs"&gt;&lt;/script&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HiddenGems/TimeZoneInfo-Time-Zones.png" alt="TimeZoneInfo Time Zones" /&gt;&lt;/p&gt;

&lt;p&gt;Whoa! No need to store and maintain a list of cultures, day, month or timezone names any more. Much better!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=0ZzdBmIGiIw:9u5_GGnUU00:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/0ZzdBmIGiIw" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Hidden%20Gems%20inside%20.Net%20Classes/74</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/ooSOdA0oiLo/73</link><title>Lazy Loading Social Sharing Buttons</title><description>&lt;p&gt;Social sharing buttons play a big part on the web today. They are used to drive traffic to the site, and if done correctly can be very successful. Unfortunately, the loading of these buttons has its downsides on performance. Having many social sharing buttons on your site can slow it down because it will block any other scripts from loading while it is waiting for the document to render the social media from the different domains.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Socialite/social-sharing-buttons.jpg" alt="Social Sharing Icons" /&gt;&lt;/p&gt;

&lt;p&gt;In my last blog post, I wrote about &lt;strong&gt;asynchronously&lt;/strong&gt; loading &lt;a href="http://deanhume.com/Home/BlogPost/html5-asynchronous-javascript/72"&gt;JavaScript&lt;/a&gt;. To achieve the best page load and responsiveness it is advisable to asynchronously load these social sharing buttons. However it isn't always that easy to do this without writing a lot of code to cope with the loads of different social buttons. This is where &lt;strong&gt;Socialite.js&lt;/strong&gt; comes in. It's a great library that is very easy to implement and activate a load of social sharing buttons. I like that you can easily add &lt;strong&gt;Twitter, Google+, Facebook, LinkedIn&lt;/strong&gt; and many more buttons with one library and no repeating code. For a demo of the code, please visit the &lt;a href="http://socialitejs.com/"&gt;demo site&lt;/a&gt;. I also really like the phrase that they use on the site - &lt;em&gt;"If you're selling your soul, you may as well do it asynchronously"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;There are some great samples on the site that run through an onload demo, hover demo, and scroll demo. In this post we are going to run through a scroll demo - this is pretty similar to &lt;a href="http://deanhume.com/Home/BlogPost/lazy-loading-images-with-jquery/22"&gt;lazy loading images&lt;/a&gt; and only loads the buttons when the user's viewport comes into place. In order to add it to your page, you will first need to add a reference to the script. Next, create an element with the class socialite and a class like twitter-share to specify the social network and type of widget. &lt;/p&gt;

&lt;script src="https://gist.github.com/3089205.js?file=socialiteHtmlDemo.html"&gt;&lt;/script&gt;

&lt;p&gt;In order to get it to simply load asynchronously, all you need to do is call it like so:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Socialite.load();&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, as we are going to run through the scroll demo we need to do things slightly differently. At the bottom of your page, include the following code.&lt;/p&gt;

&lt;script src="https://gist.github.com/3089294.js?file=socialiteScrollDemo.html"&gt;&lt;/script&gt;

&lt;p&gt;The above code uses &lt;strong&gt;jQuery&lt;/strong&gt; and listens for any changes to the window viewport. It then checks if the &lt;strong&gt;socialButtons&lt;/strong&gt; element is within the viewport. I am pretty sure that you could write this more effectively, but as I am not a &lt;strong&gt;JavaScript&lt;/strong&gt; developer - you will have to forgive me!&lt;/p&gt;

&lt;p&gt;In order to view a working demo, please &lt;a href="http://c512911.r11.cf3.rackcdn.com/Socialite/socialite.html"&gt;click the following link&lt;/a&gt;. There is now no excuse not to load these social sharing buttons &lt;strong&gt;asynchronously&lt;/strong&gt; - no more &lt;a href="https://developers.google.com/speed/pagespeed/"&gt;PageSpeed&lt;/a&gt; loading scores being affected by these buttons!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=ooSOdA0oiLo:f_In7FMFfqA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/ooSOdA0oiLo" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Lazy%20Loading%20Social%20Sharing%20Buttons/73</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/PbaeqYLqWBc/72</link><title>HTML5 Asynchronous JavaScript</title><description>&lt;p&gt;&lt;strong&gt;HTML5&lt;/strong&gt; has a handy little attribute called 'async'. This attribute can be used together with Script tags to &lt;strong&gt;asynchronously&lt;/strong&gt; load &lt;strong&gt;JavaScript&lt;/strong&gt;. No more fancy code to get your &lt;strong&gt;JavaScript&lt;/strong&gt; to run &lt;strong&gt;asynchronously&lt;/strong&gt; - you just need to add this to a script tag and it just works.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/AsyncJavaScript/Async-Javascript-HTML5-Tag.png" alt="HTML5 Async JavaScript" /&gt;&lt;/p&gt;

&lt;p&gt;In order to improve page performance and stop Scripts from blocking your page loading, this is the ideal way to go about it. Many a time you will see a blank page while a large &lt;strong&gt;JavaScript&lt;/strong&gt; file is being downloaded and parsed and this is because it is blocking the &lt;strong&gt;DOM&lt;/strong&gt;. In theory, if you have two scripts that need to load in a page and you are using async, they don't need to wait on each other, but instead can run at the same time and in parallel. Another very useful tag attribute that can be used together with '&lt;strong&gt;async&lt;/strong&gt;' attribute is the '&lt;strong&gt;defer&lt;/strong&gt;' attribute. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/AsyncJavaScript/Defer-Javascript-HTML5-Tag.png" alt="HTML5 Defer JavaScript" /&gt;&lt;/p&gt;

&lt;p&gt;It is also very similar but instead of loading the file asynchronously, it guarantees that the files are executed in the order they occur in the page. It only runs the scripts after parsing is completely finished. I created a small demo page and applied the '&lt;strong&gt;async&lt;/strong&gt;' attribute to all my script tags. As the page relied on &lt;strong&gt;jQuery&lt;/strong&gt;, the first thing that I noticed was that I had a &lt;strong&gt;JavaScript&lt;/strong&gt; error on the page.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/AsyncJavaScript/Async-Error.PNG" alt="HTML5 Async Error" /&gt;&lt;/p&gt;

&lt;p&gt;This occurs because all the &lt;strong&gt;JavaScript&lt;/strong&gt; on the page was trying to load at once, and because code further down couldn't find a reference to the &lt;strong&gt;jQuery&lt;/strong&gt; library, this caused an error. In order to get this to work, I needed to make the script that relied on &lt;strong&gt;jQuery&lt;/strong&gt; load last - using the '&lt;strong&gt;defer&lt;/strong&gt;' attribute.&lt;/p&gt;

&lt;h2&gt;Comparison&lt;/h2&gt;

&lt;p&gt;I set up two test pages so that I could compare the differences between the two versions. I used &lt;strong&gt;Chrome Developer Tools&lt;/strong&gt; to create a waterfall chart that shows the differences between the load times. If you are using &lt;strong&gt;Chrome&lt;/strong&gt; as your browser, simply fire up the developer tools by hitting 
&lt;strong&gt;F12&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The is the original version without &lt;strong&gt;async&lt;/strong&gt;.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/AsyncJavaScript/No-Async-JavaScript-Waterfall-Chart.png" alt="No Async Waterfall Chart" /&gt;&lt;/p&gt;

&lt;p&gt;This is the new version using both &lt;strong&gt;async&lt;/strong&gt; and &lt;strong&gt;defer&lt;/strong&gt;. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/AsyncJavaScript/Async-JavaScript-Waterfall-Chart.png" alt="Async Waterfall Chart" /&gt;&lt;/p&gt;

&lt;p&gt;Notice the difference between the two - you can see that the &lt;strong&gt;async&lt;/strong&gt; version doesn't block the page from loading and also loads the page slightly faster. The &lt;strong&gt;DOMContentLoaded&lt;/strong&gt; has completed and then finally the &lt;strong&gt;knockout.js&lt;/strong&gt; file is loaded &lt;strong&gt;asynchronously&lt;/strong&gt; afterwards. It is important to note that the &lt;strong&gt;DOMContentLoaded&lt;/strong&gt; has finished and it wasn't blocked while the knockout.js file was able to continue loading asynchronously.&lt;/p&gt;

&lt;p&gt;You can view the two files and profile it for yourself - here is the version &lt;a href="http://c512911.r11.cf3.rackcdn.com/AsyncJavaScript/test/noAsyncTest.html"&gt;without async&lt;/a&gt; and the version with async. The test pages that I set up are quite small and load relatively quickly. You might notice that with larger pages and more intensive JavaScript files that the page load difference is more noticeable. There is a &lt;a href="http://ie.microsoft.com/testdrive/Performance/AsyncScripts/Default.html"&gt;great demo page&lt;/a&gt; on the IE website that lets you see the HTML5 Async scripts loading visually and gives a good understanding of what we are trying to achieve.&lt;/p&gt;

&lt;h2&gt;Support&lt;/h2&gt;

&lt;p&gt;At the moment, the browser support for the &lt;strong&gt;Async attribute&lt;/strong&gt; looks like this :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; - FireFox 3.6+&lt;/li&gt;
&lt;li&gt; - Internet Explorer 10+ &lt;/li&gt;
&lt;li&gt; - Chrome 8+&lt;/li&gt;
&lt;li&gt; - Safari 5.0+&lt;/li&gt;
&lt;li&gt; - Android Browser Honeycomb and Ice Cream Sandwich&lt;/li&gt;
&lt;li&gt; - Possible support in Opera starting in 12+&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If it important to remember that most browsers support the &lt;strong&gt;async&lt;/strong&gt; attribute when it is used in conjunction with the &lt;strong&gt;"true"&lt;/strong&gt; value (async="true"). This is because when the attribute first came out many browsers only originally supported this, however the newer &lt;strong&gt;HTML5&lt;/strong&gt; way of doing this would be to write &lt;strong&gt;async&lt;/strong&gt; without the "true" value. For more information on browser support for the Async Attribute, see this question on &lt;a href="http://stackoverflow.com/questions/1834077/which-browsers-support-script-async-async"&gt;StackOverflow&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=PbaeqYLqWBc:io0_zwiWMd0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/PbaeqYLqWBc" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/HTML5%20Asynchronous%20JavaScript/72</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/Cf1HKR8_uLc/71</link><title>A Basic Guide to Building Chrome Extensions</title><description>&lt;p&gt;&lt;strong&gt;Google Chrome&lt;/strong&gt; has come a long way since it's early days. I am a big fan of the &lt;a href="https://developers.google.com/chrome-developer-tools/docs/overview"&gt;Chrome Developer tools&lt;/a&gt; and use it in my day to day development. There are also loads of great tools and extensions that are on offer at the &lt;strong&gt;Chrome&lt;/strong&gt; store, and most are available to download for free.&lt;/p&gt;

&lt;p&gt;Depending on your requirements, creating a &lt;strong&gt;Chrome&lt;/strong&gt; extension is really quick and easy - all it requires is a little knowledge of &lt;strong&gt;JavaScript and HTML&lt;/strong&gt;. In this post, I am going to run through a tutorial that shows you how to create a small &lt;strong&gt;Chrome&lt;/strong&gt; extension that allows you to display the top 5 posts on this blog from the RSS feed in a popup. It is a pretty basic example, but will give you a good understanding of &lt;strong&gt;Chrome&lt;/strong&gt; extension development.&lt;/p&gt;

&lt;p&gt;In order to build an extension, the main starting point is the &lt;strong&gt;Manifest.json&lt;/strong&gt; file. This contains all the configuration settings and will be used when your extension is loaded into the browser.&lt;/p&gt;

&lt;script src="https://gist.github.com/2703874.js?file=manifest.json"&gt;&lt;/script&gt;

&lt;p&gt;From the code above, you can see that I am setting the name of the extension as well as the icons, titles, and description. All these values will get used by the browser when the extension is loaded up.&lt;/p&gt;

&lt;p&gt;Next, let's create our popup page. This can be done using standard &lt;strong&gt;HTML&lt;/strong&gt; and easily allows you to add &lt;strong&gt;CSS&lt;/strong&gt; styling and &lt;strong&gt;JavaScript&lt;/strong&gt; to the page. Notice how this page (feed.html) is the same page that we referenced in the &lt;strong&gt;Manifest.json&lt;/strong&gt; file.&lt;/p&gt;

&lt;script src="https://gist.github.com/2703961.js?file=feed.html"&gt;&lt;/script&gt;

&lt;p&gt;I used a little piece of code that is supplied by &lt;a href="http://www.feedburner.com"&gt;Feedburner.com&lt;/a&gt; to add a small feed on any website. Once this was in the page I was ready to upload the changes and test it out! In order to upload your newly created extension, click on the settings icon in the browser.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ChromeExtension/chrome-settings.PNG" alt="Chrome Extensions" /&gt;&lt;/p&gt;

&lt;p&gt;Then choose &lt;strong&gt;Tools -&gt; Extensions&lt;/strong&gt;&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ChromeExtension/Chrome-Extensions-Menu.png" alt="Chrome Extension Menu" /&gt;&lt;/p&gt;

&lt;p&gt;Next &lt;strong&gt;'Load Unpacked Extension'&lt;/strong&gt; - this will allow you to load your extension in the folder that it was created. It will look for the &lt;strong&gt;Manifest.json&lt;/strong&gt; file and the feed.html file that it references. If you look in the top right hand corner of the browser, you should notice your new icon!&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ChromeExtension/Chrome-Load-Unpacked-Extension.PNG" alt="Chrome Load Unpacked Extension" /&gt;&lt;/p&gt;

&lt;p&gt;Now when we open it, it doesn't look that great - it could do with some &lt;strong&gt;CSS&lt;/strong&gt; styling. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ChromeExtension/Chrome-Extension-No-Styling.png" alt="Chrome Extension No Styling" /&gt;&lt;/p&gt;

&lt;p&gt;We can simply add this to the &lt;strong&gt;HEAD&lt;/strong&gt; tag on the feed.html page.&lt;/p&gt;

&lt;script src="https://gist.github.com/2761155.js?file=feedburnerUpdated.html"&gt;&lt;/script&gt;

&lt;p&gt;Which then looks like this:&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ChromeExtension/Chrome-Extension-Upated-CSS.png" alt="Chrome Extension Updated CSS" /&gt;&lt;/p&gt;

&lt;p&gt;And that's it! In order to see the many features that are available - check out the &lt;a href="http://code.google.com/chrome/extensions/devguide.html"&gt;Chrome Developer website&lt;/a&gt;.  If you come across any issues while creating these extensions, I always find it really useful to use the &lt;strong&gt;Chrome Developer Tools&lt;/strong&gt; to inspect the code for any errors. In order to do so, right click on your extension and choose &lt;strong&gt;'Inspect pop-up'&lt;/strong&gt;. This will give you easy access to debug your code.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ChromeExtension/Chrome-Inspect-Popup.png" alt="Chrome Inspect Popup" /&gt;&lt;/p&gt;

&lt;p&gt;In order to download the example created in this post, please &lt;a href="http://c512911.r11.cf3.rackcdn.com/ChromeExtension/rssReader.zip"&gt;click here&lt;/a&gt;. For other great Chrome extension samples to get you up and running, visit the &lt;a href="http://code.google.com/chrome/extensions/samples.html"&gt;Chrome Developer site&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I have also created a basic extension that is available on the &lt;strong&gt;Chrome&lt;/strong&gt; store, it allows you to easily create &lt;strong&gt;QR Codes and Barcodes&lt;/strong&gt; in a handy extension - it is available to &lt;a href="https://chrome.google.com/webstore/detail/eokbbohkcbobdmjdlndbkmigafmjabgm?hl=en-GB"&gt;download here&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=Cf1HKR8_uLc:LW-qoxCWrjM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/Cf1HKR8_uLc" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/A%20Basic%20Guide%20to%20Building%20Chrome%20Extensions/71</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/G1kIhWUOu-w/70</link><title>Running multiple browsers in one test run with Selenium</title><description>&lt;p&gt;The beauty of &lt;strong&gt;Selenium&lt;/strong&gt; is that it allows you to test your UI against all of the common browsers out there at the moment. Writing the code to test for a test scenario is quick and easy and getting up and running with &lt;strong&gt;Selenium&lt;/strong&gt; can be done in a matter of minutes. &lt;strong&gt;Selenium&lt;/strong&gt; works alongside &lt;strong&gt;Nunit&lt;/strong&gt; and also nicely slots in with your automated build environment.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/multiple-browsers.png" alt="Multiple Browsers Selenium" /&gt;&lt;/p&gt;

&lt;p&gt;Instead of writing a new test class every time you want to test a different browser, rather harness the power of &lt;strong&gt;Nunit&lt;/strong&gt; and get it to do all the hard work for you! That way, you can run multiple browsers against the same code in one test run.&lt;/p&gt;

&lt;p&gt;Instead of using writing your test class like this:&lt;/p&gt;

&lt;script src="https://gist.github.com/2488620.js?file=SimpleSelenium.cs"&gt;&lt;/script&gt;

&lt;p&gt;Change it to use the &lt;strong&gt;where clause&lt;/strong&gt; in C#. The where clause is used to specify constraints on the types that can be used as arguments for a type parameter. In this example, we are declaring a generic class and allowing the type parameter T to implement the &lt;strong&gt;IWebDriver&lt;/strong&gt; interface. This way every time the &lt;strong&gt;TestFixture&lt;/strong&gt; is run, it will use the type that we are passing to it.&lt;/p&gt;

&lt;script src="https://gist.github.com/2488641.js?file=SeleniumMultipleBrowsers.cs"&gt;&lt;/script&gt;

&lt;p&gt;For more information on the &lt;strong&gt;where clause&lt;/strong&gt; in C#, please see the following links - &lt;a href="http://msdn.microsoft.com/en-us/library/6b0scde8%28v=vs.80%29.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://stackoverflow.com/q/4737970/335567"&gt;here&lt;/a&gt;. This is a rather basic example, but you can see how 
this can be applied to any example using multiple browsers.&lt;/p&gt;

&lt;p&gt;Hope this helps with your testing!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=G1kIhWUOu-w:HBpbLx5rrb8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/G1kIhWUOu-w" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Running%20multiple%20browsers%20in%20one%20test%20run%20with%20Selenium/70</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/lTZYXedxToc/69</link><title>Selenium WebDriver - Using a Headless Browser in .Net</title><description>&lt;p&gt;If you have ever run a large suite of automated tests using &lt;a href="http://seleniumhq.org/"&gt;Selenium WebDriver&lt;/a&gt;, you will know that sometimes it can take ages to complete. This coupled with different versions of browsers can be a bit of a pain. This is where &lt;strong&gt;Headless Browsers&lt;/strong&gt; come in.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumSimpleBrowser/Headless-Browser.jpg" alt="Headless Browser" /&gt;&lt;/p&gt;

&lt;p&gt;In the simplest of terms, a &lt;strong&gt;headless browser&lt;/strong&gt; is a web browser without a graphical user interface. This means that the browser can access web pages but doesn't ever display them to a user and this makes it super useful because it is lightning fast, lightweight and in-memory. Instead of having to wait for the browser to load a new window and then open and close, you can send it a large chunk of URLs to check and it will be able to handle them fast and efficiently.&lt;/p&gt;

&lt;p&gt;This comes in very useful when writing selenium tests that you want to get up and running quickly. At my workplace, we also have our &lt;strong&gt;Selenium&lt;/strong&gt; automated tests incorporated into our &lt;strong&gt;CI&lt;/strong&gt; builds. I spent a while looking for .net solutions out there that are easy to get started with and don't require much change to your existing code. There is a great &lt;strong&gt;Java&lt;/strong&gt; version out there called &lt;a href="http://htmlunit.sourceforge.net/"&gt;HtmlUnit&lt;/a&gt;, but I couldn't find any decent .net ones....until I came across &lt;strong&gt;SimpleBrowser&lt;/strong&gt;. Fortunately &lt;strong&gt;SimpleBrowser&lt;/strong&gt; works using the &lt;strong&gt;IWebDriver&lt;/strong&gt; interface, which means it quite easy to get started with.&lt;/p&gt;

&lt;p&gt;I have blogged quite a bit previously about using &lt;strong&gt;Selenium WebDriver&lt;/strong&gt;, so for more information on the basics,  please check out this &lt;a href="http://deanhume.com/Home/Tagged?tag=Selenium"&gt;link&lt;/a&gt;.
Let's begin by taking a look at a simple example - first, you will need to download the latest version of SimpleBrowser from &lt;a href="https://github.com/Teun/SimpleBrowser.WebDriver"&gt;Github&lt;/a&gt;. Next, add a reference to the &lt;strong&gt;SimpleBrowser&lt;/strong&gt; libraries.&lt;/p&gt;

&lt;script src="https://gist.github.com/2049605.js?file=SimpleBrowser.cs"&gt;&lt;/script&gt;

&lt;p&gt;As you can see, no GUI was displayed to the user - it all ran in the background and was super fast and efficient. I ran this against a large suite of tests and noticed that it ran extremely quickly! &lt;strong&gt;SimpleBrowser&lt;/strong&gt; supports cookie-based sessions, HTTP/HTTPS, CSS selectors, etc. However, there is also currently no support for &lt;strong&gt;JavaScript&lt;/strong&gt; - this may or may not be seen as a problem depending on how your site is coded (You may have considered &lt;a href="http://www.alistapart.com/articles/understandingprogressiveenhancement"&gt;progressive enhancement&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I did come across this issue when testing:&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumSimpleBrowser/Reference-Binaries.png" alt="Reference Binaries" /&gt;&lt;/p&gt;

&lt;p&gt;Some older versions of the Webdriver.dll might not work, but fortunately there is a workaround for this - you can update your &lt;strong&gt;app.config&lt;/strong&gt; to bind to any older versions - this seemed to work for me.&lt;/p&gt;

&lt;script src="https://gist.github.com/2049588.js?file=bindings.config"&gt;&lt;/script&gt;

&lt;p&gt;Either way, I think this is a great tool and will start putting it to good use! To download a copy of the project in this article, please &lt;a href="http://c512911.r11.cf3.rackcdn.com/SeleniumSimpleBrowser/SeleniumTest%20.zip"&gt;click here.&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=lTZYXedxToc:eDQGnl5CjCw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/lTZYXedxToc" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Selenium%20WebDriver%20-%20Using%20a%20Headless%20Browser%20in%20.Net/69</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/T_X1GPAkg2Q/68</link><title>Dynamic Favicons using HTML5 Local Storage and TinyCon</title><description>&lt;p&gt;I was perusing Github the other day and I came across &lt;a href="https://github.com/tommoor/tinycon"&gt;this&lt;/a&gt; awesome little JavaScript library. It's called &lt;strong&gt;TinyCon&lt;/strong&gt; and it's a small library for manipulating the favicon in your browser. It adds alert bubbles and changing images pretty similar to the way Gmail does.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/TinyCon/gmail-icon-notification.png" alt="Gmail Favicon Notification" /&gt;&lt;/p&gt;

&lt;p&gt;It's basically a really fun little library that allows you to add a notification bubble to your &lt;strong&gt;favicons&lt;/strong&gt;. I started to play around with the code provided on &lt;a href="https://github.com/tommoor/tinycon"&gt;Github&lt;/a&gt; and got up and running in no time.&lt;/p&gt;

&lt;script src="https://gist.github.com/1779160.js?file=tinyConExample.html"&gt;&lt;/script&gt;

&lt;p&gt;Using this simple example will give you something like this:&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/TinyCon/Tinycon-Favicon-Bubble.png" alt="TinyCon Favicon Example" /&gt;&lt;/p&gt;

&lt;p&gt;As you can see the above example is really simple and not really real world. It's using a timer to update the icon every second. After messing around with the example on the site, I wondered how I could apply the notifications to this site. If I checked the last blog entry that they read on this site, then I would be able to notify them if there were any new blog post's since their last visit. It's just a fun experiment really!&lt;/p&gt;

&lt;p&gt;If you are a regular visitor to the site, you might notice that you have a notification next to the &lt;strong&gt;favicon&lt;/strong&gt;. This is how I went about it.&lt;/p&gt;

&lt;script src="https://gist.github.com/1779089.js?file=blogtinycon.js"&gt;&lt;/script&gt;

&lt;p&gt;This site is coded using &lt;strong&gt;MVC2&lt;/strong&gt; so I added a new variable on my Controller to the &lt;strong&gt;TempData&lt;/strong&gt; called "&lt;em&gt;TotalPageCount&lt;/em&gt;". This is then added to a hidden field on the page that I can use to read the value from. &lt;/p&gt;

&lt;p&gt;Next, I am adding a quick check to see if the user's browser will be able to cope with &lt;a href="http://dev.w3.org/html5/webstorage/"&gt;HTML5 Local Storage&lt;/a&gt;. If they are able to use it, I check if they have visited before and if so compare it with the previous value (&lt;em&gt;to check for any updates&lt;/em&gt;). If there are any new blog posts since their last visit then I simple use &lt;strong&gt;TinyCon&lt;/strong&gt; and add a notification to the favicon. I am no great &lt;strong&gt;JavaScript&lt;/strong&gt; master, so please forgive me if you spot any better ways of achieving the same goal in the code!&lt;/p&gt;

&lt;p&gt;Oh, there is also a gotcha when dealing with dynamic favicons. I started running through the example on the &lt;strong&gt;TinyCon&lt;/strong&gt; site and came across this error when debugging:&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/TinyCon/Javascript-Error.png" alt="SECURITY_ERR: DOM Exception 18" /&gt;&lt;/p&gt;

&lt;p&gt;It took me a while to solve this, but thanks to &lt;a href="http://stackoverflow.com/questions/2704929/uncaught-error-security-err-dom-exception-18"&gt;this post on StackOverflow&lt;/a&gt; I managed to solve it. Basically, you need to have the favicon in your own domain or it will cause a security exception. Once that is in place, you should be able to get up running without any problems.&lt;/p&gt;

&lt;p&gt;If the browser doesn't support &lt;strong&gt;dynamic favicons&lt;/strong&gt;, it will gracefully fall back and update the title with a number instead. This blog post is really a bit of fun, but I can see a load of uses for the helpful little library. &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=T_X1GPAkg2Q:aE9q02NfMrE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/T_X1GPAkg2Q" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Dynamic%20Favicons%20using%20HTML5%20Local%20Storage%20and%20TinyCon/68</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/1mDdD6ikR04/67</link><title>MVC Asynchronous Controller : The Basics</title><description>&lt;p&gt;When I first saw the &lt;strong&gt;Asynchronous Controllers&lt;/strong&gt; introduced in MVC 2, I couldn't wait to start playing around. I thought that it would be a really easy to get up and running with a simple example, but after searching online for a few working examples - pretty much all of them used an event based pattern that wasn't easy to understand. In this blog post I am going to run through a really simple example that will show you the basics of Asynchronous Controllers, and show you how easy they really are.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/asp-net-mvc-3.gif" alt="Asp.net MVC 3" /&gt;&lt;/p&gt;

&lt;p&gt;There are some massive benefits to using &lt;strong&gt;Asynchronous Controllers&lt;/strong&gt; with &lt;strong&gt;MVC&lt;/strong&gt;. If your application is I/O or network limited, adding an &lt;strong&gt;Asynchronous&lt;/strong&gt; &lt;strong&gt;Controller&lt;/strong&gt; can help your application stay responsive. It's also a really sexy way of handling long running operations without blocking your application. In this post, I am going to run through a simple example using an &lt;strong&gt;Asynchronous Controller&lt;/strong&gt; and show you just how easy it really is to get up and running. The easiest way by far is using the &lt;a href="http://msdn.microsoft.com/en-us/library/dd537609.aspx"&gt;Task Parallel library&lt;/a&gt;. I have also blogged about the Task Parallel Library using Parallel Invoke, for more information please read &lt;a href="http://deanhume.com/Home/BlogPost/c--parallel-invoke/58"&gt;this post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Right, let's get started. In &lt;strong&gt;Visual Studio&lt;/strong&gt;, create a new empty MVC application and add a new controller. I've called mine HomeController. Then you need to change the Controller so that it inherits from the &lt;strong&gt;AsyncController&lt;/strong&gt; base class instead of the Controller base class.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Async/Async-Controller-Inherit.png" alt="Asynchronous Controller Inherit" /&gt;&lt;/p&gt;

&lt;p&gt;Next up, I am going to add a method called IndexAysnc(). &lt;strong&gt;Asynchronous actions&lt;/strong&gt; are written in a similar fashion to standard synchronous requests. It is important to name the Action Methods correctly, as they need to end in 'Async' or 'Completed'. In a synchronous controller, you would normally only have one Action Method per HTTP action. However, in an Async method, you get both &lt;em&gt;Async&lt;/em&gt; and &lt;em&gt;Completed&lt;/em&gt; appended to the
name - but the View name will still be Index. So in this example, our URL will still be /Home/Index&lt;/p&gt;

&lt;script src="https://gist.github.com/1620903.js?file=IndexAsync.cs"&gt;&lt;/script&gt;

&lt;p&gt;If you notice in the method above, it is making use of the &lt;strong&gt;Task.Factory.StartNew()&lt;/strong&gt; method that comes with the &lt;strong&gt;Task Parallel Library&lt;/strong&gt;. It is a great way to add threading to your application and it also makes the code really streamline. Inside the StartNew() method I am adding some simple code to download the HTML from this website, but you could replace this with any custom long running method of your choice. Next, add the final part of the async method (&lt;em&gt;Completed&lt;/em&gt;). If we follow the naming convention, it should be IndexCompleted. &lt;/p&gt;

&lt;script src="https://gist.github.com/1620940.js?file=IndexCompleted.cs"&gt;&lt;/script&gt;

&lt;p&gt;You may also notice that in the code above that I am using &lt;strong&gt;AsyncManager.OutstandingOperations&lt;/strong&gt;. This notifies the MVC pipeline of how many operations are pending completion. This is necessary because MVC has no way of knowing what operations were kicked off by the action method or when those operations are complete. When the counter hits zero, the pipeline understands that it needs to complete the overall operation.&lt;/p&gt;

&lt;p&gt;This is just a simple method that returns the data to our view, from here you can return anything that was executed asynchronously to your View. It's that simple! If you would like to run through this example the project is available for download, please click &lt;a href="http://c512911.r11.cf3.rackcdn.com/Async/AsyncProject.zip"&gt;here to download.&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=1mDdD6ikR04:z4Xb-cp8kLE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/1mDdD6ikR04" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20Asynchronous%20Controller%20:%20The%20Basics/67</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/8MF9FVtd5TA/66</link><title>MVC and HTML5 Web Workers</title><description>&lt;p&gt;&lt;strong&gt;HTML5 Web Workers&lt;/strong&gt; are cool.  As a developer that spends most of his time working with server side code, I like to think of Web Workers as .net's System.Threading for the front end. Basically, Web Workers allow you to run client side scripts without interrupting the page or any other scripts that are currently running. They are basically an API specification that lets you create background &lt;strong&gt;JavaScript&lt;/strong&gt; threads to process CPU intensive tasks. The major advantage to using &lt;strong&gt;Workers&lt;/strong&gt; is that it allows long tasks to be executed 
without blocking to keep the page responsive. It's really good for fire-and-forget tasks and tasks that you can leave to run while the user continues working on the page. Another great thing about &lt;strong&gt;Workers&lt;/strong&gt; is that getting started with them is really easy.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5WebWorkers/html5-logo.png" alt="HTML5 Web Workers" /&gt;&lt;/p&gt;

&lt;p&gt;In this post, I am going to run through a simple example using &lt;strong&gt;Asp.net MVC&lt;/strong&gt;. We are going to build a page that performs a long running task on the server using Web Workers. First off, create a new &lt;strong&gt;MVC&lt;/strong&gt; project in Visual Studio.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5WebWorkers/New-MVC-Project.png" alt="Visual Studio Create New Project" /&gt;&lt;/p&gt;

&lt;p&gt;Then add a new Controller, and let's add a new method on the Controller - I called mine "Webworkers". &lt;/p&gt;

&lt;script src="https://gist.github.com/1404432.js?file=WebWorkers"&gt;&lt;/script&gt;

&lt;p&gt;This is just going to be a simple page that calls a long running process on our Controller using &lt;strong&gt;HTML5 Web Workers&lt;/strong&gt;. Add the following code to your View.&lt;/p&gt;

&lt;script src="https://gist.github.com/1404507.js?file=WebWorkersView.aspx"&gt;&lt;/script&gt;

&lt;p&gt;Right, let's break this down a little. Firstly, I am including a reference to &lt;strong&gt;Modernizer&lt;/strong&gt; in the HEAD tags. If you created a new &lt;strong&gt;MVC3&lt;/strong&gt; in &lt;strong&gt;Visual Studio&lt;/strong&gt; it will automatically get added to your Scripts folder. Using Modernizer is a quick and efficient way to ensure that your users browser has the required features. Next, I am including a bit of &lt;strong&gt;JavaScript&lt;/strong&gt; on the page to call our Worker. As you can see I am telling the Worker to execute a script called "LogStats.js". This is just a simple piece of code that does an &lt;strong&gt;AJAX&lt;/strong&gt; call to a method on my Controller. I will run through that in more detail later.  The Worker then uses a method called "onMessage" to get the status of the thread. Depending on how you write your code, you could also consider this your "Success" status. Let's run through the code that is executed by the Worker - "LogStats.js".&lt;/p&gt;

&lt;script src="https://gist.github.com/1404919.js?file=logstats.js"&gt;&lt;/script&gt;

&lt;p&gt;The above code is using &lt;strong&gt;XMLHttpRequest object&lt;/strong&gt; to do a simple &lt;strong&gt;POST&lt;/strong&gt; request to a method on our Controller. Let's create the method on the Controller and call it "UpdateStats". In this example, I am not passing any parameters through, but these could just as easily be added onto the request. Workers use a method called "postMessage" to return a result to the thread that called it. Whatever we return in this postMessage will be returned to the original thread.
&lt;/p&gt;

&lt;script src="https://gist.github.com/1404990.js?file=UpdateStats.cs"&gt;&lt;/script&gt;

&lt;p&gt;That's it! If you fire up the example, you will notice that the code executes in the background and doesn't affect the responsiveness of the page. In this example I have called a method on a controller in the background, however you could run some intensive JavaScript on the front end too. The list of uses for using &lt;strong&gt;HTML5 Web Workers&lt;/strong&gt; is endless! The &lt;strong&gt;HTML5 Web Workers&lt;/strong&gt; are "truly" asynchronous.&lt;/p&gt;

&lt;h2&gt;Support&lt;/h2&gt;

&lt;p&gt;As you will have noticed, I included a reference to &lt;strong&gt;Modernizer&lt;/strong&gt; to check if the browser supports &lt;strong&gt;Workers&lt;/strong&gt;. At the time of writing this article, there is a surprising amount of support for Web Workers. However, some of the major browsers (IE) are still playing a bit of catch-up. &lt;strong&gt;Firefox, Chrome, Safari, Opera&lt;/strong&gt; and &lt;strong&gt;IE (10)&lt;/strong&gt; all offer support for Workers. For more information check out &lt;a href="http://caniuse.com/#search=web%20workers"&gt;caniuse.com&lt;/a&gt;. If the browser that you are targeting doesn't fully support Web Workers yet, you could simply fall back to calling the service traditionally.&lt;/p&gt;

&lt;p&gt;For more information on the &lt;strong&gt;HTML5 Web Workers&lt;/strong&gt; spec, please check out the &lt;a href="http://dev.w3.org/html5/workers/"&gt;W3C draft&lt;/a&gt;. There are some good simple examples on using Workers on the site. A copy of the project used in this example is available to &lt;a href="http://c512911.r11.cf3.rackcdn.com/HTML5WebWorkers/WebWorkersExample.zip"&gt;download here.&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=8MF9FVtd5TA:cRa02EaATig:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/8MF9FVtd5TA" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20and%20HTML5%20Web%20Workers/66</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/Hb76rJDlWho/65</link><title>Web.config Transformation Features in Visual Studio 2010</title><description>&lt;p&gt;When developing applications in &lt;strong&gt;Visual Studio&lt;/strong&gt;, I normally pay a lot of attention to my Solution Explorer. However, I recently spotted something that I didn't notice before. Well, at least something that I haven't paid attention to! In &lt;strong&gt;Visual Studio 2010&lt;/strong&gt;, if you click on the Web.config file and expand the node - there are two extra files - &lt;strong&gt;Web.debug.config&lt;/strong&gt; and &lt;strong&gt;Web.Release.config&lt;/strong&gt;. Now if you open them you will notice that they contain XML that is similar to your normal &lt;strong&gt;Web.config&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;What do these transformations do? Well, after some investigation I learnt that if you update the &lt;strong&gt;Web.Release.config&lt;/strong&gt; file with the appropriate configurations for your live environment, and change your solution configuration to &lt;strong&gt;"Release mode"&lt;/strong&gt; and publish from your solution explorer, you can override Web.config settings based on environment. If you wanted to update your connection string only when you published in release mode, this is the perfect way to go about it!&lt;/p&gt;

&lt;p&gt;Let's run through a simple example. First update your &lt;strong&gt;Web.Release.Config&lt;/strong&gt; file with the appropriate syntax.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Web-Config/Web-Release-Config.png" alt="Web.Release.config" /&gt;&lt;/p&gt;

&lt;p&gt;You should notice the attribute &lt;strong&gt;xdt:Transform="Replace"&lt;/strong&gt; has been added. This tells the build to use this new section in the config file when you publish your project. Next, we can simulate deploying to our live environment. Update your Solution Configuration to "Release mode". As a side note, when you deploy your application to a live environment, you should be publishing in release mode - it will remove the &lt;strong&gt;debug="true"&lt;/strong&gt; attribute from your web.config. Having your application with the debug attribute set to true will cause some considerable reduction in performance. Check out &lt;a href="http://blogs.msdn.com/b/prashant_upadhyay/archive/2011/07/15/pros-and-cons-of-using-debug-true-in-asp-net-applications-in-production-environment.aspx"&gt;this link&lt;/a&gt; for more information.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Web-Config/Release-Mode.png" alt="Release Mode" /&gt;&lt;/p&gt;

&lt;p&gt;Then publish the web application via solution explorer. Right click on your application and choose publish. From here you can choose file system or FTP.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Web-Config/Publish.png" alt="Visual Studio Publish" /&gt;&lt;/p&gt;

&lt;p&gt;If you now look at your published application, you will notice that there is only one &lt;strong&gt;Web.config&lt;/strong&gt; file. When we open it, the Web.config matches the changes that we made in the &lt;strong&gt;Web.Release.config&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Web-Config/Web-config.png" alt="Web.config" /&gt;&lt;/p&gt;

&lt;p&gt;Where I work we are currently using &lt;strong&gt;TeamCity&lt;/strong&gt; along with Nant scripts on our CI server. This works great once you are setup in a team environment, but I sometimes feel that working with the Nant script syntax could be easier. I have also worked in an environment before where we used &lt;strong&gt;Team Foundation&lt;/strong&gt; and &lt;strong&gt;MSBuild&lt;/strong&gt; scripts and that worked really well too. However, if you are a lone developer that is working from home or just working on a side project these Web.config transformations are perfect. I know that when I make any small updates to this blog, using the transformations makes life a lot easier.&lt;/p&gt;

&lt;p&gt;I have only given you a quick summary on the &lt;strong&gt;Web.config&lt;/strong&gt; transformation syntax that is available for web project deployment. There are also loads of other options that are available to transform your web.config file. You can use &lt;em&gt;Conditions&lt;/em&gt;, &lt;em&gt;XPath&lt;/em&gt;, &lt;em&gt;Inserts&lt;/em&gt;, and &lt;em&gt;Replace&lt;/em&gt;. For more information please take a look on the &lt;a href="http://msdn.microsoft.com/en-us/library/dd465326%28VS.100%29.aspx"&gt;MSDN site&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=Hb76rJDlWho:WuMeWVXocxs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/Hb76rJDlWho" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Web.config%20Transformation%20Features%20in%20Visual%20Studio%202010/65</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/D_ds2kJZhSI/64</link><title>Selenium Webdriver - Wait for an element to load</title><description>&lt;p&gt;I am currently working on a project that uses a lot of AJAX and delayed loading of HTML elements. This means that when a page loads, the object that I am looking for might not necessarily have appeared yet. In many instances the element may only be added to the DOM after an amount of time by the use of some &lt;strong&gt;JavaScript&lt;/strong&gt;.  &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumScreenShot/big-logo.png" alt="Selenium Webdriver" style="display: block;margin-left: auto;margin-right: auto"   /&gt;&lt;/p&gt;

&lt;p&gt;At first, we decided to write our automated tests as normal using &lt;strong&gt;Selenium Webdriver&lt;/strong&gt; - but we soon noticed that this would be a bit trickier if the elements that we needed to test only appeared after the page loaded. After a bit of research, I came across &lt;a href="http://seleniumhq.org/docs/04_webdriver_advanced.html"&gt;Explicit and Implicit Waits&lt;/a&gt; in &lt;strong&gt;Selenium&lt;/strong&gt;. In &lt;strong&gt;Selenium&lt;/strong&gt;, waiting is having the automated task execution elapse a certain amount of time before continuing with the next step. There are two different kinds of waits - &lt;strong&gt;Explicit and Implicit Waits&lt;/strong&gt;. An &lt;strong&gt;explicit wait&lt;/strong&gt; is code you define to wait for a certain condition to occur before proceeding further in the code. An implicit wait tells &lt;strong&gt;WebDriver&lt;/strong&gt; to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available.&lt;/p&gt;

&lt;p&gt;Let's run through a quick example using both waits. In this example I am going to run through the search functionality on the &lt;strong&gt;Bookatable.com&lt;/strong&gt; homepage. This is a good example to use because the automplete functionality only appears after the user has typed in the text box. In this example we are going to test that the correct search results get returned when we enter certain keys.&lt;/p&gt;

&lt;p&gt;In the code below we navigate to the &lt;strong&gt;Bookatable.com&lt;/strong&gt; website. Then we find the element named "ddRestaurants", click the element and enter the letters "or" in the textbox. &lt;/p&gt;

&lt;script src="https://gist.github.com/1319242.js?file=gistfile1.cs"&gt;&lt;/script&gt;

&lt;p&gt;Unfortunately the above code will fail with the following error:&lt;/p&gt;
&lt;p&gt;&lt;i&gt;OpenQA.Selenium.NoSuchElementException : Unable to locate element: {"method":"class name","selector":"ac-row-110457"}&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;This is because we expect to see the autocomplete pop-up element appearing instantly and because the &lt;strong&gt;Selenium&lt;/strong&gt; code is executing faster than the Ajax takes to complete it won't be able to find the element and it will throw an error. &lt;/p&gt;

&lt;h2&gt;Explicit wait&lt;/h2&gt;

&lt;p&gt;This is where the &lt;strong&gt;explicit wait&lt;/strong&gt; starts to become really useful. Instead of instantly looking for an element, we can tell &lt;strong&gt;Webdriver&lt;/strong&gt; to wait for a certain amount of time before we continue with the next step. The example below runs through the usage of an &lt;strong&gt;explicit wait&lt;/strong&gt;. In order to use the wait functionality in &lt;strong&gt;Selenium Webdriver&lt;/strong&gt;, you will need to add a reference to the &lt;strong&gt;Webdriver.Support.dll&lt;/strong&gt;, as well as the standard Webdriver.dll. You can either download this directly from the &lt;strong&gt;Selenium&lt;/strong&gt; website, or I like to use the Nuget packages and add it &lt;a href="http://blogs.msdn.com/b/timlee/archive/2010/11/11/using-the-library-package-manager-with-add-on-libraries-in-visual-studio.aspx"&gt;directly from the Solution Explorer in VS2010&lt;/a&gt;.&lt;/p&gt;

&lt;script src="https://gist.github.com/1316935.js?file=gistfile1.cs"&gt;&lt;/script&gt;

&lt;p&gt;If you run this test, you will notice that it passes successfully because we have explicitly told it to wait for a certain amount of time before continuing.&lt;/p&gt;

&lt;h2&gt;Implicit Wait&lt;/h2&gt;

&lt;p&gt;Another option that is available to use is the &lt;strong&gt;implicit wait&lt;/strong&gt;. The difference with the &lt;strong&gt;implicit wait&lt;/strong&gt; is that it will tell &lt;strong&gt;Webdriver&lt;/strong&gt; to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available.&lt;/p&gt;

&lt;p&gt;The example below runs through an &lt;strong&gt;implicit wait&lt;/strong&gt;. Notice how it differs from an &lt;strong&gt;explicit wait&lt;/strong&gt;.&lt;/p&gt;

&lt;script src="https://gist.github.com/1316944.js?file=gistfile1.cs"&gt;&lt;/script&gt;

&lt;p&gt;One thing to keep in mind is that once the implicit wait is set - it will remain for the life of the &lt;strong&gt;WebDriver&lt;/strong&gt; object instance. Personally I prefer to use the &lt;strong&gt;explicit wait&lt;/strong&gt; because it only pauses before continuing, but you will need to decide on what suits your situation best. For more information on waits in &lt;strong&gt;Webdriver&lt;/strong&gt;, please follow &lt;a href="http://seleniumhq.org/docs/04_webdriver_advanced.html"&gt;this link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have created a small sample with the tests used in this post. For more information - please &lt;a href="http://c512911.r11.cf3.rackcdn.com/SeleniumWait/WaitExample.zip"&gt;download here&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=D_ds2kJZhSI:QecfPsrTZdc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/D_ds2kJZhSI" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Selenium%20Webdriver%20-%20Wait%20for%20an%20element%20to%20load/64</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/KDg9t_jrhv0/63</link><title>Rendering PDFs with pdf.js using HTML5 and JavaScript</title><description>&lt;p&gt;The web is full of &lt;strong&gt;PDFs&lt;/strong&gt; floating around out there. How many times have you tried to open a &lt;strong&gt;PDF&lt;/strong&gt; file on a machine and not had the correct software installed? It can be very frustrating. For most users out there they already have the correct software installed to view &lt;strong&gt;PDFs&lt;/strong&gt;, but as users move towards tablets or newer machines - they may not have it installed. Another issue is that often certain &lt;strong&gt;PDF&lt;/strong&gt; readers and plugins don't support important &lt;strong&gt;PDF&lt;/strong&gt; features - which is a bit of a problem if you want your website to be accessible to everyone out there and if you want all your users to have the same experience.&lt;/p&gt;
&lt;br /&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/PDFJS/pdf-firefox.jpg" style="display: block;margin-left: auto;margin-right: auto"  alt="PDF.js Logo"&gt;

&lt;br /&gt;

&lt;p&gt;A couple of clever guys over at &lt;a href="http://andreasgal.com/2011/06/15/pdf-js/"&gt;Mozilla&lt;/a&gt; have thought about this and have come up with a genius way of displaying &lt;strong&gt;PDFs&lt;/strong&gt; inside your browser using &lt;strong&gt;Javascript&lt;/strong&gt; and &lt;strong&gt;HTML5&lt;/strong&gt;. The code is available for download on &lt;a href="https://github.com/andreasgal/pdf.js"&gt;Github&lt;/a&gt;. PDF.js is community-driven and supported by &lt;strong&gt;Mozilla Labs&lt;/strong&gt; which means its good news for us as developers. In the long run this plugin is intended to render &lt;strong&gt;PDFs&lt;/strong&gt; natively within Firefox itself and will eventually ship with Firefox. For now though, we can start using the power of this plugin within our applications today.&lt;/p&gt;

&lt;p&gt;Here I am going to run through a simple implementation of &lt;strong&gt;PDF.js&lt;/strong&gt; and show you how easy it is to use. First head on over to Github and download the latest code required to start developing.&lt;/p&gt;

&lt;p&gt;Then create a web page and embed similar to the following page.&lt;/p&gt;

&lt;script src="https://gist.github.com/1280533.js?file=PDFjs.html"&gt;&lt;/script&gt;

&lt;p&gt;As you will notice, there is a file called HelloWorld.js in the HEAD tag of the code above. My HelloWorld.js file looks like the code below - but you can also include the code directly in your page instead of linking to the file externally.&lt;/p&gt;

&lt;script src="https://gist.github.com/1280538.js?file=PDFjs-HelloWorld.html"&gt;&lt;/script&gt;

&lt;p&gt;I have created a simple demo page that showcases the features that &lt;strong&gt;PDF.js&lt;/strong&gt; offers. Please &lt;a href="http://deanhume.com/content/postimages/pdfjs/pdfjs.htm"&gt;click here to view.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I was testing with different &lt;strong&gt;PDF&lt;/strong&gt; files, I noticed that certain characters aren't quite supported yet. As this is still an experiment and a work in progress, I expect new developments and additions will be constantly added. Keep this in mind if you notice any irregularities when working with this.&lt;/p&gt;

&lt;p&gt;Using &lt;strong&gt;PDF.js&lt;/strong&gt; also brings a security improvement for our users. It uses only safe web languages and doesn’t contain any native code pieces attackers could exploit. The only disadvantage that I can think of when using this code is that it might not work on some older browsers, which either way they can still view the documents using a traditional &lt;strong&gt;PDF&lt;/strong&gt; viewer. Hopefully a polyfill will arrive soon for older browsers. For further information take a look on &lt;a href="https://github.com/andreasgal/pdf.js/#readme"&gt;Github&lt;/a&gt; and the &lt;a href="http://andreasgal.com/2011/06/15/pdf-js/"&gt;PDF.js team's website.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go ahead and start using &lt;strong&gt;PDF.js&lt;/strong&gt; in your applications today!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=KDg9t_jrhv0:yZjtACZKXXM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/KDg9t_jrhv0" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Rendering%20PDFs%20with%20pdf.js%20using%20HTML5%20and%20JavaScript/63</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/LwZmikSfYZM/Memcached%20for%20C</link><title>Memcached for C# - A Walkthrough</title><description>&lt;p&gt;A while ago I wrote about &lt;a href="http://deanhume.com/Home/BlogPost/object-caching----net-4/37"&gt;Object caching in .NET 4&lt;/a&gt;. I think that the &lt;strong&gt;Object Caching in .NET 4&lt;/strong&gt; is a great tool to use for caching and literally takes minutes to get up and running. However, one of the downsides of using the &lt;em&gt;System.Runtime.Caching&lt;/em&gt; in .NET 4 is that every time your application pool recycles in IIS, you lose the objects in cache. The same happens if you make a change to your web.config or redeploy your application.&lt;/p&gt;

&lt;p&gt;This isn't a problem if you are running smaller applications and cached data isn't vital to their performance. However, for high-traffic applications that need to have the cache up all the time, this becomes a problem. Another thing to consider is the possibility of load-balanced servers - using the &lt;strong&gt;Object Caching in .NET 4&lt;/strong&gt;
isn't distributed. That means it will only store its cache per application pool. If you have two servers it means that you will have two different cache stores.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Memcached/memcached-logo.png" alt="Memcached Logo" /&gt;&lt;/p&gt;

&lt;p&gt;I have recently been introduced to the world of &lt;a href="http://memcached.org/"&gt;Memcached&lt;/a&gt;. &lt;strong&gt;Memcached&lt;/strong&gt; is a free &amp;amp; open source, high-performance, distributed memory object caching system intended for use in speeding up dynamic web applications by alleviating database load. You can think of it as a short-term memory for your applications. The brilliant thing about &lt;strong&gt;Memcached&lt;/strong&gt; is that you run it on one server and point all the applications to the &lt;strong&gt;Memcached&lt;/strong&gt; server. This way all servers use the same cache! Another bonus is that even if you redeploy your app, or recycle the app pool in any way - the cached objects are still there. This is great news for larger applications that need to be online constantly and can't afford any downtime with regards to it's cache.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Memcached/memcached-usage.png" alt="Memcache server usage" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memcached&lt;/strong&gt; is no new comer to the web. It is used by major players such as Wikipedia, Flickr, Twitter, Youtube, WordPress.com and Digg. The advantages of using &lt;strong&gt;Memcached&lt;/strong&gt; are endless and getting it setup on your machine is really simple. There are two parts to getting Memcached setup - you need the &lt;strong&gt;Memcached&lt;/strong&gt; server and then you need to get the client API. There are few client API &lt;a href="http://code.google.com/p/memcached/wiki/Clients"&gt;available&lt;/a&gt; for most of the common languages out there (Ruby, C#, PHP, C, Java).&lt;/p&gt;

&lt;p&gt;I had a bit of trouble actually finding a decent ready-to-go implementation of &lt;strong&gt;Memcached&lt;/strong&gt; for Windows. I got my version 1.4 from &lt;a href="http://blog.elijaa.org/index.php?post/2010/10/15/Memcached-for-Windows&amp;amp;similar"&gt;this site&lt;/a&gt;, but it seems that there are also other versions available &lt;a href="http://splinedancer.com/memcached-win32/"&gt;here&lt;/a&gt; and &lt;a href="http://code.jellycan.com/memcached/"&gt;here&lt;/a&gt;. Once you have downloaded the files, you can either run &lt;strong&gt;Memcached&lt;/strong&gt; as a console application or install it as a Windows service (This is the recommended option). In order to install it as a service, run the following from the command line:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;C:\yourmemcachedpath\memcached -d install&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, you need to get the client API to start using the cache. There are a few different options with regards to the C# client API, but I chose &lt;a href="https://github.com/enyim/EnyimMemcached"&gt;Enyim Memcached&lt;/a&gt;. Open Visual Studio, create a new project and add a reference to the &lt;strong&gt;Enyim.Caching&lt;/strong&gt; library that you downloaded.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Memcached/Add-Reference.png" alt="Add Reference" /&gt;&lt;/p&gt;

&lt;p&gt;You will also need to update your web.config or app.config to include the following lines. In your configSections:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Memcached/Enyim-Memcached-ConfigSections.png" alt="Enyim Memcached Config" /&gt;&lt;/p&gt;

&lt;p&gt;And then just before the end of the web.config file add the following:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Memcached/Enyim-memcached-Web-config.png" alt="Enyim Memcached Config" /&gt;&lt;/p&gt;

&lt;p&gt;You will notice that the address is &lt;strong&gt;"127.0.0.1"&lt;/strong&gt; and port &lt;strong&gt;"11211"&lt;/strong&gt;. This would normally be the network location that your Memcached server is hosted on, but in this instance I am testing it locally and this is the default. &lt;/p&gt;

&lt;p&gt;Using the library is really simple and intuitive. Although it's not a real world example, the following code will store and retrieve a value from the cache.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Memcached/enyim-memcached-code-example.png" alt="Enyim Memcached Code" /&gt;&lt;/p&gt;

&lt;p&gt;A while ago I wrote about &lt;a href="http://deanhume.com/Home/BlogPost/object-caching----net-4/37"&gt;Object caching in .NET 4&lt;/a&gt;. I created a little wrapper that used simple syntax and wrapped around the &lt;strong&gt;System.Runtime.Caching&lt;/strong&gt; namespace. Using the same class, we can just update it to point to our &lt;strong&gt;Memcached&lt;/strong&gt; server. If it makes it easier for you to use the class I wrote and combined with the&lt;strong&gt; Memcached  API&lt;/strong&gt;, it is available for download &lt;a href="http://c512911.r11.cf3.rackcdn.com/Memcached/CacheLayer.zip"&gt;here.&lt;/a&gt; Also, just in case the Memcached servers are not available at any of the locations I defined above - you can download version 1.4  &lt;a href="http://c512911.r11.cf3.rackcdn.com/Memcached/memcached-server.zip"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I searched the web and found that there is very little documentation with regards to C# out there - I hope this article helped to get you up to speed with Memcached! &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=LwZmikSfYZM:Qc7x8y9oKBA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/LwZmikSfYZM" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Memcached%20for%20C#%20-%20A%20Walkthrough/62</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/uuyLG_aIJpA/61</link><title>MVC Data URI HTML Helper</title><description>&lt;p&gt;I have recently been looking into &lt;strong&gt;web page performance&lt;/strong&gt; and one of the things I came across is the &lt;a href="http://en.wikipedia.org/wiki/Data_URI_scheme"&gt;Data URI scheme&lt;/a&gt;. When you reference an image in your HTML, the client needs to go and retrieve the image. This creates an HTTP request and adds to the time it takes for the page to load. &lt;/p&gt;

&lt;p&gt;What is the &lt;strong&gt;Data URI scheme&lt;/strong&gt;? - well, it is a URI scheme that provides a way to include data in-line in web pages as if they were external resources.  Instead of adding a reference to your image as a path or URL, you embed the image directly into the document using a Base64 encoded string. The browser automatically understands the string and decodes it there and then - instead of retrieving it via an HTTP request.&lt;/p&gt;

&lt;p&gt;Normally you would retrieve the image like so:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/DataUri/image-tag.png" alt="Image Tag" /&gt;&lt;/p&gt;

&lt;p&gt;Instead, if you used Data URI's it would look something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/DataUri/image-tag-data-uri.png" alt="Image Tag Data URI" /&gt;&lt;/p&gt;

&lt;p&gt;By changing your code to the above example to use Data URI's, it means one less HTTP request. Imagine if you had a resource intensive page - if you updated your HTML to include the &lt;strong&gt;Data URI's&lt;/strong&gt; that would cut down significantly on the HTTP requests and this would in turn speed up the load time! This means that we never need to request that image again!&lt;/p&gt;

&lt;p&gt;This opens up a world of possibilities in terms of serving slower internet connections. If you are serving your site to Mobile browsers, this is an ideal way to speed up the load time. The code above can also be included in CSS.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/DataUri/css-data-uri.png" alt="CSS Data URI" /&gt;&lt;/p&gt;

&lt;p&gt;Another advantage of using &lt;strong&gt;Data URI's&lt;/strong&gt; is that web browsers are usually configured to make only a certain number (often two) of concurrent HTTP connections to a domain, so inline data frees up a download connection for other content.&lt;/p&gt;

&lt;h2&gt;Putting it all together&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;So, what's the catch I hear you say&lt;/em&gt;? Well, as with most new features the older browsers don't offer support. However, it's better than you think. FireFox, Chrome, Opera, Safari and IE8+ all offer support for &lt;strong&gt;Data URI's&lt;/strong&gt;. Another factor to take into consideration is that every time you make a change to an image you need to update the &lt;strong&gt;Data URI&lt;/strong&gt;. This could become quite a maintenance nightmare if your site was quite image intensive. This is where &lt;strong&gt;Asp.net MVC&lt;/strong&gt; comes in.&lt;/p&gt;

&lt;p&gt;Using the power of HTML helpers in &lt;strong&gt;MVC&lt;/strong&gt;, I decided to put together a small project that would handle progressive enhancement and older browsers. In my MVC project, I created a new class and called it "ImageHelper". Then I added a method to check the browser version and determine if it is capable of handling &lt;strong&gt;Data URI's&lt;/strong&gt;:&lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5038748.js"&gt;&lt;/script&gt;

&lt;p&gt;I then added another method that would convert the given image to a Base64 string.&lt;/p&gt;

&lt;script src="https://gist.github.com/deanhume/5038736.js"&gt;&lt;/script&gt;

&lt;p&gt;In the above method, I am getting the path of the image on the server then reading it into a &lt;strong&gt;MemoryStream&lt;/strong&gt; and converting the bytes to a Base64 string. After that it's all wrapped up in a method that creates the image tag for us.&lt;/p&gt;


&lt;script src="https://gist.github.com/deanhume/5037675.js"&gt;&lt;/script&gt;

&lt;p&gt;Then you simply call it on your view like so:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/DataUri/Html-Helper.png" alt="Html Helper" /&gt;&lt;/p&gt;

&lt;p&gt;You may wish to extend the above method to handle any further &lt;a href="http://www.w3schools.com/tags/tag_img.asp"&gt;image attributes&lt;/a&gt; such as id, style, width, etc. Another way that this could be extended would be to add a layer of caching so that once the Base64 string has been converted, it simply needs to be retrieved from cache. I have previously written about &lt;a href="http://deanhume.com/home/blogpost/object-caching----net-4/37"&gt;caching in .Net.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have noticed that the Base64 strings are quite large depending on the size of your image. &lt;strong&gt;Base64-encoded data URI's&lt;/strong&gt; are 1/3 larger in size than their binary equivalent. However, this overhead is reduced to 2-3% if the HTTP server compresses the response using Gzip. I use the MVC Gzip Actionfilter as described on this &lt;a href="http://weblogs.asp.net/rashid/archive/2008/03/28/asp-net-mvc-action-filter-caching-and-compression.aspx"&gt;page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That's pretty much it! If you view the source on this page you will notice that quite a few of the images are using &lt;strong&gt;Data URI's&lt;/strong&gt;. It's really easy to get up and running and it can add a significant improvement to your page load times. The project is available for &lt;a href="http://c512911.r11.cf3.rackcdn.com/DataUri/ImageProject.zip"&gt;download here&lt;/a&gt;, or if you would simply like to include the class in your project you can &lt;a href="http://c512911.r11.cf3.rackcdn.com/DataUri/ImageHelper.zip"&gt;download it here&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=uuyLG_aIJpA:A_HrK_kkM5A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/uuyLG_aIJpA" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20Data%20URI%20HTML%20Helper/61</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/FRsyHQYLQK8/60</link><title>Responsive Design and CSS3 Media Queries</title><description>&lt;p&gt;Regular readers on this site will notice that there has been a major change on the site lately. The design of the site has changed as well as the layout. I have been playing around with the idea of &lt;strong&gt;Responsive design&lt;/strong&gt; and also updating the look and feel of this site for a while. It was quite colourful before and was in need of some serious updating!&lt;/p&gt;

&lt;p&gt;This is how it used to look before the update:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ResponsiveDesign/dean-hume-old-site.png" alt="Dean Hume Old Site" /&gt;&lt;/p&gt;

&lt;h3&gt;Responsive design&lt;/h3&gt;

&lt;p&gt;So, what is &lt;em&gt;Responsive design&lt;/em&gt;? Well, it is the approach that suggests that design and development should respond to the user’s behaviour and environment based on screen size, platform and orientation. The term &lt;em&gt;Responsive Web Design&lt;/em&gt; was coined by &lt;strong&gt;Ethan Marcotte&lt;/strong&gt; and is the practice of using fluid grids, flexible images, and &lt;strong&gt;media queries&lt;/strong&gt; to progressively enhance a web page for different viewing contexts. Imagine only having to code one front end and 
having it adapt no matter what the screen size or device that you are using. This is what responsive design aims to achieve. If you resize the browser on this page you will notice that the layout adapts accordingly - give it a try!&lt;/p&gt;

&lt;p&gt;The advantage of using &lt;strong&gt;Responsive web design&lt;/strong&gt; is that we only have to support one UI layer and we don't need to worry about the device that is accessing the page. Previously I would intercept the User-Agent of the user and if it matched a list of devices, I would redirect to a specially designed mobile page. Now, all I need to do is provide the correct layout according to the screen size.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ResponsiveDesign/responsive-web-design.png" alt="Responsive Web Design"&gt;&lt;/p&gt;

&lt;p&gt;For more information on &lt;strong&gt;Responsive design&lt;/strong&gt; check out this &lt;a href="http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/"&gt;article&lt;/a&gt;.There is also a great gallery for responsive design called &lt;a href="http://mediaqueri.es/" &gt;Mediaqueri.es&lt;/a&gt;. Scott Hanselman also recently updated his &lt;a href="http://www.hanselman.com/blog/LearningAboutProgressiveEnhancementSupportingMobileBrowsersWithCSS3MediaQueries.aspx"&gt;blog to use CSS3 mediaqueries&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Using the CSS&lt;/h3&gt;

&lt;p&gt;Now, I'm no UI developer and I'm not really that good with CSS - so I needed a way to get this site developed quickly and easily. I have also been experimenting with responsive design and &lt;em&gt;CSS3&lt;/em&gt; media queries in order to get this site enhanced to be able to handle any screen size. &lt;/p&gt;

&lt;p&gt;The advantage of using media queries is that you can display different CSS styles depending on the size of the browser window and viewport. You simply use it in your stylesheet like normal CSS.&lt;/p&gt;

&lt;p&gt;The following CSS will apply if the viewing area is smaller than 600px.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ResponsiveDesign/mediaquery-600.png" alt="Mediaquery CSS3 media screen" /&gt;&lt;/p&gt;

&lt;p&gt;And the following CSS will apply if the viewing area is greater than 900px.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ResponsiveDesign/mediaquery-900.png" alt="Mediaquery CSS3 media screen" /&gt;&lt;/p&gt;

&lt;p&gt;You can also combine multiple queries.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://deanhume.com/Zip/Image?Path=/Content/PostImages/ResponsiveDesign/mediaquery-600-900.png" alt="Mediaquery CSS3 media screen" /&gt;&lt;/p&gt;

&lt;p&gt;As I'm no expert with &lt;strong&gt;CSS&lt;/strong&gt; and &lt;strong&gt;Responsive design&lt;/strong&gt;, I needed a boilerplate that would make development quick and easy. After some searching on the net, I came across &lt;a href="http://www.getskeleton.com/"&gt;Skeleton&lt;/a&gt;. I can't emphasize enough how easy it is to use this boilerplate. &lt;strong&gt;Skeleton&lt;/strong&gt; uses best practices and works alongside your styling. It is not a UI framework, it's a development kit that provides the most basic styles as a foundation, but is ready to adopt whatever your design or style is. &lt;strong&gt;Skeleton&lt;/strong&gt; is based on a variation of the 960 grid system and getting up to speed with it takes no time at all.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ResponsiveDesign/mediaquery-600-900.png" alt="Mediaquery CSS3 media screen" /&gt;&lt;/p&gt;

&lt;p&gt;If you were using Skeleton and the above snippet of HTML, it would resize according to resolution automatically. Simply download the files from the &lt;a href="http://www.getskeleton.com/"&gt;site&lt;/a&gt; and get coding!&lt;/p&gt;

&lt;h3&gt;Fallback&lt;/h3&gt;

&lt;p&gt;Okay, so do older browsers support &lt;strong&gt;CSS3 mediaqueries&lt;/strong&gt;? Well, unfortunately they don't - but there is a solution. There are a few different libraries out there that will simply allow older browsers to handle the queries. I use &lt;a href="http://code.google.com/p/css3-mediaqueries-js/"&gt;css3-mediaqueries-js&lt;/a&gt; and there is also the popular &lt;a href="https://github.com/scottjehl/Respond"&gt;Respond.js&lt;/a&gt;. Both of these libraries will allow older browsers such as IE 5+, Firefox 1+ and Safari 2 to support &lt;strong&gt;CSS3 mediaqueries&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you haven't already taken a look at the &lt;a href="http://mediaqueri.es/"&gt;Mediaqueri.es&lt;/a&gt; website - take a look at some awesome responsive websites out there.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=FRsyHQYLQK8:VV8z_YnqHtY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/FRsyHQYLQK8" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Responsive%20Design%20and%20CSS3%20Media%20Queries/60</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/PPtTnOCA38o/59</link><title>MVC and the HTML5 Application Cache</title><description>&lt;p&gt;&lt;strong&gt;HTML5&lt;/strong&gt; has loads of awesome features and recently I have been playing around with a feature called the &lt;strong&gt;Application Cache&lt;/strong&gt;. The &lt;strong&gt;Application Cache&lt;/strong&gt; is designed to allow you to run your web application offline - that is, without a network connection. A web browser that implements &lt;strong&gt;HTML5 offline applications&lt;/strong&gt; will read the list of URLs from the manifest file, download the resources, cache them locally, and automatically keep the local copies up to date as they change. When you don't have a network connection, the browser will automatically switch over to the local copies instead. Most modern browsers offer support for the Application Cache this includes FIREFOX (3.5+), SAFARI (4.0+), CHROME (5.0+), OPERA (10.6+), IPHONE and ANDROID. Unfortunately, Internet Explorer doesn't currently offer support for Application Cache.&lt;/p&gt;

&lt;p align="center"&gt;
&lt;img src="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/html5-logo-black.png" /&gt;
&lt;/p&gt;

&lt;p&gt;So...what if we could use the benefits of the &lt;strong&gt;Application Cache&lt;/strong&gt; with an online application? The user could access all the resources that they
need from the &lt;strong&gt;Application Cache&lt;/strong&gt; instead of the server, and in turn the page would load a lot faster. Another added advantage of using the &lt;strong&gt;Application Cache&lt;/strong&gt; is that there would be  a reduced server load and the browser only needs to download anything new instead of fetching the resources that it already has.&lt;/p&gt;

&lt;p&gt;Let's get started with the basics of using the &lt;strong&gt;Application Cache&lt;/strong&gt; in an &lt;strong&gt;ASP.net MVC&lt;/strong&gt; project. In order to enable the &lt;strong&gt;Application Cache&lt;/strong&gt; you need to include the manifest attribute on the HTML tag.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/Application-Cache-Manifest-File.png" /&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;manifest&lt;/strong&gt; file can be located anywhere on your web server and contains a list of the things that you want to store in the Application
Cache. You could always simply link to a static text file on your server, but I quite like to use the &lt;strong&gt;MVC ActionResult&lt;/strong&gt; and View to return a dynamic manifest file. The browser will continue to use the cached version of the resources until the manifest file has changed or been updated. It can sometimes make debugging your application a nightmare, so if you are reloading your page and find that you are only seeing the cached version - you will need to make a change to the manifest file in order for the browser to fetch the new version.&lt;/p&gt;

&lt;p&gt;Right, let's create our dynamic manifest page. Add a new method on your controller - I called mine "Manifest". Notice how the MVC route matches up to the manifest attribute link we supplied on the HTML tag.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/Application-Cache-MVC-Controller.png" /&gt;&lt;/p&gt;

&lt;p&gt;Next, add a view for that &lt;strong&gt;ActionResult&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/Application-Cache-Manifest.png" /&gt;&lt;/p&gt;

&lt;p&gt;Close to the top of the View you will notice a &lt;strong&gt;ContentType&lt;/strong&gt; of "text/cache-manifest". All manifest files must be served with a content type of text/cache-manifest. The manifest file also needs to begin with &lt;strong&gt;"CACHE MANIFEST"&lt;/strong&gt; on the first line. &lt;/p&gt;

&lt;p&gt;You should also notice that on that View there is a method called AppendHash(). Thanks to my colleague &lt;a href="http://twitter.com/#!/ShirtlessKirk"&gt;@ShirtlessKirk&lt;/a&gt; for coming up with this idea, this is the Ninja way of handling changing resources.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/Application-Cache-AppendHash.png" /&gt;&lt;/p&gt;

&lt;p&gt;The method reads the resources and creates a Hash string based on the contents. This way the Hash Key only changes based on whether the resource has changed. This is then appended onto the end of the filename with a Querystring. The Hash Key will only change if the file has changed - this means no updating your manifest file every time a resource (CSS, Javascript, etc.) file has changed! I won't go into too much detail about the class and method that appends the Hash to the file URL, but the whole solution in this article is available for download &lt;a href="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/OfflineCache.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In order to see the &lt;strong&gt;Application Cache&lt;/strong&gt; in action, let's fire up a browser. I quite like to test with &lt;strong&gt;Google Chrome&lt;/strong&gt;, because the Developer Tools make it quite easy to see what's in the Application Cache. If you hit CTRL-SHIFT-J you should notice the &lt;strong&gt;Google Chrome&lt;/strong&gt; Developer Tools appear. The first time a page loads with the manifest and Application Cache you will notice something like this appearing in the tools console:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/Application-Cache-Download-First.png" /&gt;&lt;/p&gt;

&lt;p&gt;As you can see it is downloading the resources that are in the manifest file. If you choose the &lt;strong&gt;RESOURCES&lt;/strong&gt; tab, and then drill down to the Application Cache, you should notice something like this (&lt;i&gt;notice the hash appended&lt;/i&gt;):&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/App-Cache-Chrome-Developer-Tools.png" /&gt;&lt;/p&gt;

&lt;p&gt;If we reload the page, all the resources will be loaded from the Application Cache and not be downloaded from the server. Check the
Developer Tools console:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/Application-Cache-Download.png" /&gt;&lt;/p&gt;

&lt;p&gt;An important thing to keep in mind is that any pages that you add the manifest attribute to will be cached in the browser - this &lt;strong&gt;INCLUDES
THE PAGE ITSELF&lt;/strong&gt;! You can't just cache the resources and not the page - it's not really designed to work this way. So, the disadvantage of 
using the &lt;strong&gt;Application Cache&lt;/strong&gt; is that it doesn't play too well with server side dynamic pages. If you think of a website, the pages that you would add to the Application Cache would normally be the pages that are static or pages that don't change that often. If you add the manifest attribute to your &lt;strong&gt;Master Page&lt;/strong&gt; you will cache your entire application and not notice any changes when refreshing - Instead consider only adding this to pages that aren't updated regularly. &lt;/p&gt;

&lt;p&gt;For more information on the &lt;strong&gt;HTML5 Application Cache&lt;/strong&gt;, please take a look at this &lt;a href="http://diveintohtml5.org/offline.html"&gt;website.&lt;/a&gt; If you would like to download the example solution used in this article, please download it &lt;a href="http://c512911.r11.cf3.rackcdn.com/ApplicationCache/OfflineCache.zip"&gt;here.&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=PPtTnOCA38o:loqce2dNUko:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/PPtTnOCA38o" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20and%20the%20HTML5%20Application%20Cache/59</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/IfQvGNUW4II/C</link><title>C# Parallel Invoke</title><description>&lt;p&gt;While working through some code, I noticed a method that I have never seen before. I knew that the &lt;strong&gt;.Net 4 Framework&lt;/strong&gt; had introduced a Parallel Class that helped make parallel &lt;a href="http://msdn.microsoft.com/en-us/library/dd460720.aspx"&gt;ForEach Loops&lt;/a&gt; easier, but after some searching I came across the &lt;strong&gt;ParallelInvoke()&lt;/strong&gt; method.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ParallelInvoke/Parallel-Invoke-Dot-Net-4.png" alt="Parallel Invoke .Net 4" title="" /&gt;&lt;/p&gt;

&lt;p&gt;So, I jumped on the &lt;a href="http://msdn.microsoft.com/en-us/library/dd460705.aspx"&gt;MSDN site&lt;/a&gt; and learnt a little
bit more about &lt;a href="http://msdn.microsoft.com/en-us/library/dd537609.aspx"&gt;Task Parallels&lt;/a&gt;. It makes running one or more independent tasks concurrently really easy with it's fluent interface. After some reading, I noticed that there are a few benefits that can be gained from running tasks asynchronously. This is taken from the &lt;strong&gt;MSDN&lt;/strong&gt; site:-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;More efficient and more scalable use of system resources.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Behind the scenes, tasks are queued to the &lt;strong&gt;ThreadPool&lt;/strong&gt;, which has been enhanced with algorithms (like &lt;a href="http://en.wikipedia.org/wiki/Hill&amp;#95;climbing"&gt;hill-climbing&lt;/a&gt;) that determine and adjust to the number of threads that maximizes throughput. This makes tasks relatively lightweight, and you can create many of them to enable fine-grained parallelism. To complement this, widely-known work-stealing algorithms are employed to provide load-balancing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;More programmatic control than is possible with a thread or work item.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tasks and the framework built around them provide a rich set of APIs that support waiting, cancellation, continuations, robust exception handling, detailed status, custom scheduling, and more.&lt;/p&gt;

&lt;p&gt;So, let's write some code examples! In order to run two tasks concurrently, you need to follow the pattern below.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Parallel.Invoke(() =&gt; DoSomeWork(), () =&gt; DoSomeOtherWork());&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the &lt;strong&gt;Parallel Library&lt;/strong&gt; uses a lot of Lambda expressions to define delegates. If you would like more information on Lambda expressions, please read this &lt;a href="http://deanhume.com/Home/BlogPost/useful-lambda-expressions/14"&gt;article.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before you get started adding any code you will need to add a reference in your project to the&lt;strong&gt;System.Threading.Tasks&lt;/strong&gt; library. Next, add the method following the above pattern.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ParallelInvoke/Parallel-Invoke.png" alt="Parallel Invoke" title="" /&gt;&lt;/p&gt;

&lt;p&gt;As you can see the three methods will run concurrently, and it was pretty straightforward to implement! For more information on the Task Parallel Library, please check out the &lt;a href="http://msdn.microsoft.com/en-us/library/dd537609.aspx"&gt;MSDN site&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=IfQvGNUW4II:DD_IYHx9BOA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/IfQvGNUW4II" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/C#%20Parallel%20Invoke/58</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/AJqkR-jeaNw/57</link><title>Automatic Resource File Translation with the Microsoft Translator Service </title><description>&lt;p&gt;On a recent project that I have been working on, we needed the application to be multi-lingual and localized for different countries. The best option for us on this project was to use resource files (.resx) and let .Net handle the rest for us. Now creating these resource files wasn't really a problem, but adding and translating one for each of the languages we needed was going to take some time. This made me think if there was an easier way to do this. I had also recently been playing around with the &lt;a href="http://www.microsofttranslator.com/dev/"&gt;Microsoft Translator Service&lt;/a&gt; and also wrote a &lt;a href="http://deanhume.com/Home/BlogPost/microsoft-translator-api/55"&gt;blog post about it&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;When using resource files, we already have the English version of the text - so why not simply just translate that into the languages that we need? I decided to write a tool that would use the &lt;strong&gt;Microsoft Translator Service&lt;/strong&gt; to translate and create different resource files in the languages in needed. The tool reads the Resource file (it is an xml file) and makes a request to the service and once complete writes a new resource file in the appropriate language. It uses a separate config file to choose the languages that it needs to translate to.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Translator-Diagram.png" alt="Microsoft Translator Diagram" title="" /&gt;&lt;/p&gt;

&lt;h2&gt;Pros and Cons&lt;/h2&gt;

&lt;p&gt;Yeah....I know that using translation services might not always produce entirely accurate translations, but one of the great things about using the &lt;strong&gt;Microsoft Translator Service&lt;/strong&gt; is that it lets you choose a rating level of the translation which ensures a better 'quality' of the translated text. I would also say that there are a lot of &lt;em&gt;common&lt;/em&gt; keywords that we use in everyday applications - for example 'email' or 'home page'. Using this tool / service to translate the resource files save time and you could always review the resource files and tidy up the discrepancies afterwards. It also makes testing your multi-lingual applications a breeze. Every time you add new text to your default resource file, just run the tool and it will regenerate the resources files in the languages of your choice.&lt;/p&gt;

&lt;p&gt;There are three files that are needed to run this tool - a T4 file, the DLL that does the translation and the config file that contains the languages to translate into - and that's it. All you need to do is drop the 3 files into your &lt;strong&gt;App&amp;#95;GlobalResources&lt;/strong&gt; folder on your MVC application/Webforms application and you are ready to go.&lt;/p&gt;

&lt;p&gt;Let's run through a simple example. If you haven't already you will need to sign up for a &lt;a href="http://www.bing.com/developers/appids.aspx"&gt;BING appId.&lt;/a&gt; I have also written a previous article on how to use the &lt;a href="http://deanhume.com/Home/BlogPost/microsoft-translator-api/55"&gt;Microsoft Translator API.&lt;/a&gt; You will need to add the &lt;b&gt;BING appId&lt;/b&gt; to the config.xml in order for your translations to go through. Next, drop the three files in the &lt;strong&gt;App&amp;#95;GlobalResources&lt;/strong&gt; folder on your Web application.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Global-Resources.png" alt="Global Resources" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Next, you are going to need to include the T4 file in your application. Click the "Show all files" button in your Solution Explorer in &lt;strong&gt;Visual Studio&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Show-all-files.png" alt="Show All Files" title="" /&gt;&lt;/p&gt;

&lt;p&gt;If you expand your App&amp;#95;GlobalResources folder you will notice that there is a TT4 file called "TranslateResources.tt". Right click and choose "Include in project". Once it is included in your project right click the file and choose "Run custom tool". &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Custom-tool.png" alt="T4 Custom Tool" title="" /&gt;&lt;/p&gt;

&lt;p&gt;It's that easy - the T4 file will run in the background and translate your resource files. If you look in the &lt;strong&gt;App&amp;#95;GlobalResources&lt;/strong&gt; folder, you will notice that it has been translated into the languages configured in the config.xml file!&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Translated-Resource-Files.png" alt="Translated Resource Files" title="" /&gt;&lt;/p&gt;

&lt;p&gt;TT4 files are a great way to run custom tasks in &lt;strong&gt;Visual Studio&lt;/strong&gt;. For more information on &lt;a href="http://www.hanselman.com/blog/T4TextTemplateTransformationToolki.aspx"&gt;T4 code generation&lt;/a&gt; please &lt;a href="http://msdn.microsoft.com/en-us/library/bb126408.aspx"&gt;check this out&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you would like to download just the three files that are needed to get translating - &lt;a href="http://c512911.r11.cf3.rackcdn.com/Translator/TranslationLibrary.Resources.zip"&gt;click here&lt;/a&gt;, else if you would like to download the source and play around - &lt;a href="http://c512911.r11.cf3.rackcdn.com/Translator/Translating.zip"&gt;click here&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=AJqkR-jeaNw:W_K7OZQ1nLk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/AJqkR-jeaNw" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Automatic%20Resource%20File%20Translation%20with%20the%20Microsoft%20Translator%20Service%20/57</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/lSNCO_gF-XI/56</link><title>Measuring Web Page Performance with Selenium 2 and the Web Timings API</title><description>&lt;p&gt;I have always been interested in measuring &lt;strong&gt;web performance&lt;/strong&gt;, and especially in measuring the improvements in performance. A while ago I attended a &lt;a href="http://www.meetup.com/seleniumlondon/"&gt;Selenium Meetup in London&lt;/a&gt; and heard an interesting presentation by one of the &lt;a href="http://www.theautomatedtester.co.uk"&gt;QA guys&lt;/a&gt; working at &lt;strong&gt;Mozilla&lt;/strong&gt;. He talked about measuring the performance of a web page over a period of time using &lt;strong&gt;Selenium 2&lt;/strong&gt; and logging these statistics so we can track client-side performance improvements.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumScreenShot/big-logo.png" /&gt;&lt;/p&gt;

&lt;p&gt;Only recently I came across one of his &lt;a href="http://www.theautomatedtester.co.uk/blog/2010/selenium-webtimings-api.html"&gt;articles&lt;/a&gt; that talked about using the built-in &lt;a href="https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html"&gt;Web Timings API&lt;/a&gt; that most new browsers use. &lt;strong&gt;IE9, Chrome, and Firefox&lt;/strong&gt; are adding a new API for web pages and it is also a standard that is being introduced by the &lt;strong&gt;W3C&lt;/strong&gt;. This is great news for us as developers, and it enables us to benchmark our performance over a period of time. Imagine every time your set of
Unit Tests run when you check in and at the same time it logs the page metrics. As you add new functionality or improve on page speed, the tests would log these metrics. This would allow us to chart the improvements / decrease in performance with real stats - awesome!&lt;/p&gt;

&lt;p&gt;I have to be honest, most of this idea is inspired by the &lt;a href="http://www.theautomatedtester.co.uk/blog/2010/selenium-webtimings-api.html"&gt;article on his site&lt;/a&gt;. I wanted to put it all together and provide a quick page to view these statistics. Let's take a look at the steps.&lt;/p&gt;

&lt;p&gt;Firstly, I used the standard method that was provided.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumWebTimings/Web-Timings-Extension.png" alt="Web Timing API Selenium Extension" title="" /&gt;&lt;/p&gt;

&lt;p&gt;I created a class that calculates the performance metrics and saves them to an XML file for us to retrieve later. I won't go into detail about that class, except that it basically takes page timings and uses the values to calculate a more readable value in milliseconds and saves them to an XML file. A few of the timings might look something like this:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;connectStart: 1280867125399&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;connectEnd: 1280867125489&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;If you notice, it isn't entirely readable but if we take the connectEnd and minus it from the connectStart - we get a more readable value in milliseconds for the connect time. Just to give you an idea of how the timings work, here is a diagram showing the overview of the timings.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumWebTimings/timing-overview.png" alt="Web Timing API Overview" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Once the extension has been added you simply use it on your unit test like so:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumWebTimings/Web-Timings-Selenium-Unit-Test.png" alt="Web Timing Selenium Unit Test" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Lastly, I added a small &lt;strong&gt;.net MVC application&lt;/strong&gt; that reads the XML files that have been created over a period of time and displays them using a &lt;strong&gt;Google Chart&lt;/strong&gt;. This gives us  a basic overview of our performance history&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumWebTimings/Web-Timings-Performance-History.png" alt="Selenium Performance History" title="" /&gt;&lt;/p&gt;

&lt;p&gt;If you notice the change in the chart, you can see that as more functionality was added the chart peaked. Towards the end of the chart, and the most recent data, you should notice that the load time dropped. &lt;/p&gt;

&lt;p&gt;I have included a small project that details the work that I did to get this up and running. Please &lt;a href="http://c512911.r11.cf3.rackcdn.com/SeleniumWebTimings/Selenium.Examples.zip"&gt;click here&lt;/a&gt; to download.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=lSNCO_gF-XI:GAS592VEdZY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/lSNCO_gF-XI" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Measuring%20Web%20Page%20Performance%20with%20Selenium%202%20and%20the%20Web%20Timings%20API/56</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/aW1Gkl3FIrw/55</link><title>Microsoft Translator API</title><description>&lt;p&gt;As the web grows, more and more international businesses are turning to the web. The demand for a multi-lingual website has never been so great.
There are currently a few pay services out there that offer a translation API and also a few free ones (&lt;a href="http://code.google.com/apis/language/translate/overview.html"&gt;Google&lt;/a&gt; and &lt;a href="http://www.microsofttranslator.com"&gt;Microsoft&lt;/a&gt;). One of the services that I have been looking at recently
is the &lt;a href="http://www.microsofttranslator.com/dev/"&gt;Microsoft Translator service&lt;/a&gt;. The API has support for &lt;strong&gt;SOAP, AJAX and HTTP&lt;/strong&gt; which is a great addition to the API.&lt;/p&gt;

&lt;p align="center"&gt;
&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Microsoft-Translator-Logo.png" alt="Microsoft Translator"  /&gt;&lt;/p&gt;

&lt;p&gt;In this example, we are going to take a look at the Translator &lt;strong&gt;SOAP API&lt;/strong&gt;. It's really easy to use you get up and running in a matter of minutes. One of the great things I like about this service, is that you can add your own translations to the translation memory. This means that you can add your own self translated text if you prefer. Eventually this will keep on building and the service will improve over time. The API also allows you to choose your translated text based on a rating, which is useful if you are looking for accurate translations. &lt;/p&gt;

&lt;p&gt;First, sign up for a &lt;a href="http://www.bing.com/developers/appids.aspx"&gt;BING appId&lt;/a&gt;. Once signed up you will need to use this &lt;strong&gt;appId&lt;/strong&gt; in order to make any requests to the service. Sign in with your Windows Live ID and generate an application ID according to the instructions. So, keep it in a safe place and don't share it where necessary.&lt;/p&gt;

&lt;p&gt;Let's start off by translating some simple text. You need to add a service reference in your project to the translator API. Right click on references in your project in the solution explorer and choose &lt;em&gt;"Add Service Reference"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Translator-Service-Reference.png" alt="Add Service Reference" /&gt;&lt;/p&gt;

&lt;p&gt;Then add the following address. We are going to call our Namespace "&lt;em&gt;TranslateService&lt;/em&gt;".&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Translator-Namespace.png" alt="Microsoft Translator Namespace" /&gt;&lt;/p&gt;

&lt;p&gt;I added another class to my project to wrap these methods around the Visual Studio generated code, but you could always call it directly - depending on your preferences. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Translate-Text-Method.png" alt="Translate Text" /&gt;&lt;/p&gt;

&lt;p&gt;I am calling these methods via unit tests, but normally this would go in your application code.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Translator-Unit-Test.png" alt="Unit Test" /&gt;&lt;/p&gt;

&lt;p&gt;Call it and voila! We have our translated text.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Translator-Returned-Text.png" alt="Microsoft Translator returned text" /&gt;&lt;/p&gt;

&lt;p&gt;Another great feature of this API is that you can request a &lt;strong&gt;WAV file&lt;/strong&gt; with the translated speech. Once the method has been included in our project, you simply call it and it will return the URL of a WAV file
containing an audio version of the text you requested.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Translator/Translator-Get-Speech.png" alt="Translator Get Speech" /&gt;&lt;/p&gt;

&lt;p&gt;I've only really touched on a few of the features, but adding translated text to your site based on the user preference could be a great addition to your site. This tool is a great starting point - hope this helped a little!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=aW1Gkl3FIrw:n2To2T_4yg0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/aW1Gkl3FIrw" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Microsoft%20Translator%20API/55</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/_H_hOvwGtjE/Explicit%20Interface%20Usage%20in%20C</link><title>Explicit Interface Usage in C#</title><description>&lt;p&gt;Where possible, I try and program against interfaces as much as possible. I do this because I like &lt;strong&gt;Interface-based&lt;/strong&gt; programming and because I like the characteristics that it brings to the table:
&lt;strong&gt;reusability, maintainability, and extensibility&lt;/strong&gt;. It also allows you to effectively test your code using &lt;a href="http://deanhume.com/Home/Tagged?tag=Moq"&gt;Mocks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Whether or not you like to code this way, you may however find that there are certain situations in which you need to explicitly set the usage of an interface. When working in a team of developers it is possible that a method on a class could be called using the concrete class instead of an interface. This would break the general interface based concept as a whole and it would also make it a lot harder to find at a later stage.&lt;/p&gt;

&lt;p&gt;Now there is a quick way to get around this, however &lt;em&gt;it still needs to be enforced as a coding style&lt;/em&gt;. Let's say we have the following Interface:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Interfaces/Interface.png" alt="Interface"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;Normally, we would call it like this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Interfaces/Interface-Implementation-Old.png" alt="Interface"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;Instead, if we call it like this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Interfaces/Interface-Implementation.png" alt="Interface Implementation"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;It now forces the next person to call the method to do so from the &lt;strong&gt;interface&lt;/strong&gt;. If they try to call the concrete class the following error should occur.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Interfaces/Interface-Error.png" alt="Interface Error"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;But when called correctly:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Interfaces/Interface-Success.png" alt="Interface"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;It's also not too late to do this change to an existing project, it will show up all the concrete classes that have been called.&lt;/p&gt;

&lt;p&gt;For some further reading, please check out this link on &lt;a href="http://msdn.microsoft.com/en-us/library/aa260635(v=vs.60).aspx"&gt;MSDN&lt;/a&gt; and this one for a tutorial on &lt;a href="http://msdn.microsoft.com/en-us/library/aa288461(v=vs.71).aspx"&gt;MSDN&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=_H_hOvwGtjE:8xLRx-kw-3Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/_H_hOvwGtjE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Explicit%20Interface%20Usage%20in%20C#/54</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/2e_YAIx-s9w/53</link><title>Asp.net MVC HTML5 Toolkit - Latest Updates</title><description>&lt;p&gt;&lt;b&gt;HTML5&lt;/b&gt; has some fantastic features available to us, and I've tried to add as many of those features as I can to this toolkit. For more information on some of the features available to HTML5 form fields, please take a look at this &lt;a href="http://diveintohtml5.org/forms.html"&gt;article&lt;/a&gt;. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/5730.png" alt="HTML5" title="" /&gt;&lt;/p&gt;

&lt;p&gt;I've added quite a few updates to the latest release of the &lt;b&gt;ASP.net HTML5 Toolkit&lt;/b&gt;. If you haven't worked with the &lt;a href="http://mvchtml5.codeplex.com/"&gt;MVC Html5 toolkit&lt;/a&gt; before, please take a look at the following &lt;a href="http://deanhume.com/Home/BlogPost/asp-net-mvc-html5-toolkit/29"&gt;post&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Video &amp;amp; Audio&lt;/h2&gt;

&lt;p&gt;Support has been added for &lt;b&gt;Audio and Video&lt;/b&gt;. In order to start using the video control, you simply call it the way you would call a normal textbox - &lt;i&gt;with a slight twist!&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/HTML5-Video.png" alt="HTML5 Video" title="" /&gt;&lt;/p&gt;

&lt;p&gt;With the video control you will be able to add the &lt;b&gt;controls attribute&lt;/b&gt; and the &lt;b&gt;autoplay attribute&lt;/b&gt; to your video. Once the control has rendered, it will look something like this:&lt;/p&gt;

&lt;p&gt;&lt;video src="http://slides.html5rocks.com/src/chrome&amp;#95;japan.mp4" width="390" controls&gt;Your browser does not support the video tag&lt;/video&gt;&lt;/p&gt;

&lt;p&gt;The Audio control is quite similar &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/HTML5-Audio.png" alt="HTML5 Audio" title="" /&gt;&lt;/p&gt;

&lt;p&gt;When the control renders, it will look something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/HTML-Audio-Control.png" alt="HTML5 Audio Control" title="" /&gt;&lt;/p&gt;

&lt;h2&gt;Autofocus, Readonly and Disabled&lt;/h2&gt;

&lt;p&gt;You can now add the following HTML5 features to your input fields.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://diveintohtml5.org/forms.html#autofocus"&gt;Autofocus&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Readonly&lt;/li&gt;
&lt;li&gt;Disabled&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The library is still tiny and is only 10 kb, so it is &lt;b&gt;super lightweight and efficient&lt;/b&gt;. The &lt;a href="http://nuget.org/Packages/Packages/Details/MVCHtml5Toolkit-1-2-0"&gt;Nuget&lt;/a&gt; package has also been updated and is available for &lt;a href="http://deanhume.com/Home/BlogPost/asp-net-mvc-html5-toolkit-is-now-available-as-a-nuget-package/50"&gt;download&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope you enjoy! &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=2e_YAIx-s9w:keA_ZVSuFI4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/2e_YAIx-s9w" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Asp.net%20MVC%20HTML5%20Toolkit%20-%20Latest%20Updates/53</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/071UlMuGkso/52</link><title>Selenium 2 - Get Number of Rows in a Table</title><description>&lt;p&gt;I was recently browsing through some of the questions on &lt;a href="http://stackoverflow.com/"&gt;StackOverflow&lt;/a&gt; and came across this &lt;a href="http://stackoverflow.com/questions/4903144/using-seleniums-python-api-how-do-i-get-the-number-of-rows-in-a-table"&gt;question&lt;/a&gt;. The question was around how you would count the number of rows in a table using &lt;a href="http://seleniumhq.org"&gt;Selenium 2&lt;/a&gt;  and &lt;strong&gt;Python&lt;/strong&gt;. If you need a bit of a background to &lt;strong&gt;Selenium 2&lt;/strong&gt;, I have written a &lt;a href="http://deanhume.com/Home/BlogPost/automated-testing-with-selenium-2-and-nunit/47"&gt;little&lt;/a&gt; about it &lt;a href="http://deanhume.com/Home/BlogPost/capturing-web-page-screenshots-with-selenium-2/48"&gt;before&lt;/a&gt;.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumXPath/selenium.png" alt="Selenium Logo" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Now although the question was about the &lt;strong&gt;Python API&lt;/strong&gt;, I wanted to try and get it working using the &lt;strong&gt;C# API&lt;/strong&gt;. It was a pretty basic question and I wasn't really working on anything at the time so I started to have a look. &lt;a href="http://seleniumhq.org"&gt;Selenium&lt;/a&gt; has got built in support for &lt;strong&gt;XPath&lt;/strong&gt; and this makes the solution to the question a lot easier.&lt;/p&gt;

&lt;p&gt;Start off by navigating to the page that you want to verify.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumXPath/Selenium2-Navigate.png" alt="Selenium Navigate" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Then find the element you are working with - in our case it will be a table.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumXPath/Selenium-Find-Elements.png" alt="Selenium Find Element" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Next, let's use a little &lt;a href="http://deanhume.com/Home/BlogPost/useful-lambda-expressions/14"&gt;Lambda Expression&lt;/a&gt; to find the elements that match the &lt;strong&gt;XPath&lt;/strong&gt; - &lt;em&gt;tr&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumXPath/Selenium-Get-Table-Rows.png" alt="Selenium Get Table Rows" title="" /&gt;&lt;/p&gt;

&lt;p&gt;We can wrap this all together in a method.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumXPath/Selenium-Get-Table-Rows-Method.png" alt="Selenium Get Table Rows Method" title="" /&gt;&lt;/p&gt;

&lt;p&gt;And call it like so in a test using the new class we have created.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumXPath/Selenium-Test-Method.png" alt="Selenium Test Method" title="" /&gt;&lt;/p&gt;

&lt;p&gt;You could also use this method to count any number of tags in HTML. I've put this all together in a little helper class and included a sample on how to count the number of options in a select list. The full solution source code is available for download &lt;a href="http://c512911.r11.cf3.rackcdn.com/SeleniumXPath/Selenium.Examples.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=071UlMuGkso:DvM3b02yXY4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/071UlMuGkso" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Selenium%202%20-%20Get%20Number%20of%20Rows%20in%20a%20Table/52</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/gxd0gvxBrBY/51</link><title>MVC 3 and Remote Validation</title><description>&lt;p&gt;I must admit, I've been a bit of a slow starter when it comes to &lt;strong&gt;Asp.net MVC 3&lt;/strong&gt;. I am an avid fan of &lt;strong&gt;MVC 2&lt;/strong&gt; and haven't really taken the time to look at &lt;strong&gt;MVC 3&lt;/strong&gt; until now. Wow - I am impressed though! There are a load of new features that have been added and the product just feels like it is getting better and better. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/asp-net-mvc-3.gif" alt="MVC 3" title="" /&gt;&lt;/p&gt;

&lt;p&gt;While I was browsing the &lt;a href="http://www.asp.net/mvc/mvc3"&gt;Asp.net MVC 3 Home page&lt;/a&gt; and reading through the feature list, one of the things that caught my eye was the new &lt;strong&gt;Remote Validation&lt;/strong&gt; support that has been added. 
Remote Validation is the ability to call a custom server-side validation method via the client-side. This is very handy if you want real time validation without posting your form to validate the fields and see the results. &lt;/p&gt;

&lt;p&gt;One very useful real world example where you could apply &lt;strong&gt;Remote Validation&lt;/strong&gt;, is the ability to check if a Username already exists when registering a user. Another example could also be checking if a password meets a certain complexity requirement. &lt;/p&gt;

&lt;p&gt;Let's take a look at the example of checking if a username exists.&lt;/p&gt;

&lt;p&gt;Firstly create the Model that we are going to use and validate.
You need to add the RemoteAttribute above the UserName field. The parameters that are passed in are the ActionName and the Controller Name. This is where our custom validation method is going to reside.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/MVC-Model.png" alt="MVC Model" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Then add the View that you would like to validate.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/MVC-View.png" alt="MVC View" title="" /&gt;&lt;/p&gt;

&lt;p&gt;And the code in your controller.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; The validation won't work if OutputCache has been added, this is because we need to check the user's input dynamically.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/MVC-Controller.png" alt="MVC Controller" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Next we need to add the method that is going to validate the field. As good practice it is better to split the validation onto another &lt;strong&gt;Validation Controller&lt;/strong&gt;. You could always have your validation on the same controller as the View - it's also a matter of preference.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/MVC-Validation-Controller.png" alt="MVC Validation Controller" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Finally, in the Master page (&lt;em&gt;or simply the View&lt;/em&gt;), you need to add the JavaScript references to :&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/Remote-Validation-References.png" alt="Remote Validation References" title="" /&gt;&lt;/p&gt;

&lt;p&gt;That's it - fire up your application and test with some values. If the username has already been taken you should notice a View similar to the following:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/View-Failure.png" alt="MVC View Failure" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Else the username has not been taken and you will notice something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/View-Success.png" alt="MVC View Success" title="" /&gt;&lt;/p&gt;

&lt;p&gt;If you view the source on the page, you should also notice that there are some attributes that have been auto-generated and added to the textbox. The remote URL is also visible and that is the Action and Controller that we are using to validate the username.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/RemoteValidation/Remote-Validation-Attributes.png" alt="Remote Validation Attributes" title="" /&gt;&lt;/p&gt;

&lt;p&gt;As you might have noticed, it's really easy to add custom validation with the new features that have been added to &lt;strong&gt;MVC 3&lt;/strong&gt;, so get out there and get playing!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=gxd0gvxBrBY:Pm1TvGbEHuQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/gxd0gvxBrBY" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%203%20and%20Remote%20Validation/51</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/_ETb2Xb0yXw/50</link><title>ASP.net MVC HTML5 Toolkit is now available as a Nuget Package</title><description>&lt;p&gt;Great news for those of you out there that use the &lt;b&gt;MVC HTML5 Toolkit&lt;/b&gt; - it is now available to download as a &lt;a href="http://nuget.org/Packages/Packages/Details/MVC-Html5-Toolkit-1-0-0"&gt;Nuget package&lt;/a&gt;. If you haven't already had a look at the &lt;b&gt;MVC HTML5 Toolkit&lt;/b&gt;, please read &lt;a href="http://deanhume.com/Home/BlogPost/asp-net-mvc-html5-toolkit/29"&gt;this article&lt;/a&gt; for more info or visit the &lt;a href="http://mvchtml5.codeplex.com/"&gt;Codeplex site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;br/&gt;&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Nuget/nuget-logo.png" alt="Nuget Logo" title="" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br/&gt;&lt;/p&gt;

&lt;p&gt;For those of you out there that haven't yet heard of &lt;b&gt;Nuget&lt;/b&gt; or started playing with it yet, please go to the website for more on how to &lt;a href="http://nuget.codeplex.com/"&gt;install it&lt;/a&gt;. Basically, it's a free open source developer focused 
package management system for the .NET platform that simplifies the process of incorporating third party libraries into a .NET application during development. If you are working with a complicated library that has many dependencies, instead of manually adding each one and updating your configuration files - you simply download the Nuget package and it will update your entire project with the libraries and relevant config settings.&lt;/p&gt;

&lt;p&gt;Once you have installed the Nuget tools, it literally takes seconds to add the &lt;b&gt;MVC HTML5 Toolkit&lt;/b&gt; to your project. There are two ways of adding a package to your project.&lt;/p&gt;

&lt;p&gt;Firstly, you can add a library package reference via the solution explorer.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Nuget/Add-Library-Package.png" alt="Add Library Package" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Then search for MVC HTML5.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Nuget/Nuget-Package-Source.png" alt="Nuget Package Source" title="" /&gt;&lt;/p&gt;

&lt;p&gt;There is also the alternate way to add packages to your project via the Package Manager Console. You need to search and filter for the package you are looking for. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Nuget/Package-Manager-Console-Filter.png" alt="Console Filter" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Then run the command to install the package.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Nuget/Package-Manager-Console-Install-Package.png" alt="Install Package" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Once you have completed either of these methods you will notice that the reference has been added to the solution explorer. Every time the toolkit is updated and &lt;i&gt;you request it again&lt;/i&gt; you will be able to see the updates on the Library Package page and get the latest version without any effort!&lt;/p&gt;

&lt;p&gt;Even if you don't use Nuget in your projects you may still want to download the &lt;a href="mvchtml5.codeplex.com"&gt;HTML5 toolkit&lt;/a&gt; and add it manually. There are many benefits of HTML5 that I have blogged about before, 
please have a read &lt;a href="http://deanhume.com/Home/BlogPost/html5-input-types/25"&gt;here&lt;/a&gt; and &lt;a href="http://deanhume.com/Home/BlogPost/asp-net-mvc-html5-toolkit/29"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There are loads of other great projects that have been added to the &lt;b&gt;Nuget&lt;/b&gt; gallery already. Please check them out at &lt;a href="http://nuget.org/"&gt;Nuget.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have also created a quick video that gives a run through on how to download the package using Nuget, please check it out.&lt;/p&gt;

&lt;iframe src="http://player.vimeo.com/video/19386394?byline=0&amp;amp;portrait=0&amp;amp;color=ed0000" width="400" height="300" frameborder="0"&gt;&lt;/iframe&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=_ETb2Xb0yXw:WRQdNf6HPmA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/_ETb2Xb0yXw" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/ASP.net%20MVC%20HTML5%20Toolkit%20is%20now%20available%20as%20a%20Nuget%20Package/50</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/NTWlCiUk0UU/A%20Simple%20Guide%20to%20using%20OAuth%20with%20C</link><title>A Simple Guide to using OAuth with C#</title><description>&lt;p&gt;If you are a newbie to OAuth you might understand how confusing it can be at first! I started off looking at building a small application that consumed an &lt;a href="http://soundcloud.com/developers"&gt;OAuth service&lt;/a&gt; as a side project. I kinda just dived right in without understanding how OAuth worked and got myself very confused. I have found that there are loads of examples out there explaining in Ruby, Java and Python - but not that many in &lt;strong&gt;C#&lt;/strong&gt;.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OAuth/OAuth-Logo.png" alt="OAuth Logo" title="OAuth Logo" /&gt;&lt;/p&gt;

&lt;p&gt;Eventually I found something on Stackoverflow that explained everything to me. The answer was well detailed and even included a &lt;a href="http://stackoverflow.com/questions/4002847/oauth-with-verification-in-net"&gt;code sample&lt;/a&gt;  This kinda got the ball rolling and I managed to get a working example running. In this article I'll explain a little bit more about OAuth and how simple it really is once you get started.&lt;/p&gt;

&lt;p&gt;Firstly, let me start by explaining what &lt;strong&gt;OAuth&lt;/strong&gt; is and why you should use it. &lt;strong&gt;OAuth&lt;/strong&gt; is a simple way to publish and interact with protected data. It is a safer way to give people access to this data when they are calling an API, as each request to the API is signed with encrypted details that only last for a defined duration (e.g. 2 Hours). There are quite a few services out there that use the &lt;strong&gt;OAuth&lt;/strong&gt; standard and some of the big ones are Twitter, Twitpic, Digg and Flickr. There is a good &lt;a href="http://oauth.net/about/"&gt;article&lt;/a&gt; on the OAuth site that explains more.&lt;/p&gt;

&lt;p&gt;I'm not going to go too deep into the whole &lt;strong&gt;OAuth&lt;/strong&gt; process, but I always find that a code sample helps explain things better. Let's take a look at a summarized version of how the process works.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Register your app with the service that you are developing it for. e.g. Twitter, Twitpic, SoundCloud etc. You will receive a consumer key and secret.&lt;/li&gt;
&lt;li&gt;You, the developer of the app then initiates the OAuth process by passing the &lt;i&gt;consumer key&lt;/i&gt; and the &lt;i&gt;consumer secret&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;The service will return a &lt;i&gt;Request Token&lt;/i&gt; to you.&lt;/li&gt;
&lt;li&gt;The user then needs to grant approval for the app to run requests. &lt;/li&gt;
&lt;li&gt;Once the user has granted permission you need to exchange the request token for an access token.&lt;/li&gt;
&lt;li&gt;Now that you have received an access token, you use this to sign all http requests with your credentials and access token.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I decided to experiment with the Soundcloud API as I regularly check out new music on the site. There is a great wrapper that has already been built for C# OAuth - I used it to connect to the API. Please download it &lt;a href="http://cropperplugins.codeplex.com/SourceControl/changeset/view/65377#1710422"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To begin the process you need to pass the &lt;em&gt;Consumer Key&lt;/em&gt; and &lt;em&gt;Consumer Secret&lt;/em&gt; to the service to acquire a &lt;strong&gt;Request Token&lt;/strong&gt;. You will get given this when you register your application with the site.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OAuth/Acquire-Request-Token.png" alt="Acquire Request Token" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Now that we have the request token, we need to prompt the user to grant us permission. If you are using a desktop application like I am in this example, use &lt;b&gt;System.Diagnostics.Process&lt;/b&gt; to open a new browser window with the URL.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OAuth/Oauth-Access-Token.png" alt="Access Token" title="" /&gt;&lt;/p&gt;

&lt;p&gt;This should open up a window like the following:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OAuth/OAuth-Connect-Screen.png" alt="OAuth Window" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Once the user has logged in they will be given a key that they need to paste back into your application.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OAuth/OAuth-Connected-Screen.png" alt="OAuth Connected Screen" title="OAuth Connected Screen" /&gt;&lt;/p&gt;

&lt;p&gt;Now, as many users out there might not really be savvy enough to actually do this - the answer on &lt;a href="http://stackoverflow.com/questions/4002847/oauth-with-verification-in-net"&gt;Stackoverflow&lt;/a&gt; has a good example of how to bypass this. The article explains an idea that involves some HTML screen scraping to grab the pin. You could use this to copy the pin and use it in your application. This way the user only really needs to authenticate and your app will do the rest. In this example I am just copying the pin and pasting into the Quick Watch window in &lt;strong&gt;Visual Studio.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Then we need to exchange the Request Token for an Access Token.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OAuth/Access-Token.png" alt="Access Token" title="" /&gt;&lt;/p&gt;

&lt;p&gt;The Access token is used to sign the HTTP request in the Header. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OAuth/Register-App.png" alt="Register App" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Now that we have the header, we can start requesting information. Pass the information to a &lt;strong&gt;GET&lt;/strong&gt; HTTP request with the &lt;em&gt;Content Type&lt;/em&gt; set to "x-www-form-urlencoded" and the Header set as our Authorization Header that we just created. I've bundled this into a separate method as we are going to be using this repeatedly if we need to make other calls to the service.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OAuth/Http-Get.png" alt="Http Get" title="" /&gt;&lt;/p&gt;

&lt;p&gt;That's it! We are now calling a secure service to get the data. &lt;/p&gt;

&lt;p&gt;Here are some further links explaining more about OAuth:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://oauth.net/"&gt;http://oauth.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://hueniverse.com/oauth/"&gt;http://hueniverse.com/oauth/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/OAuth"&gt;http://en.wikipedia.org/wiki/OAuth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And more on the SoundCloud API:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/OAuth"&gt;https://github.com/soundcloud/api/wiki/&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=NTWlCiUk0UU:8mcQP91ptNs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/NTWlCiUk0UU" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/A%20Simple%20Guide%20to%20using%20OAuth%20with%20C#/49</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/6XQ5_AlvN84/48</link><title>Capturing Web Page Screenshots with Selenium 2</title><description>&lt;p&gt;There have been many times when I have run a Unit Test that has failed and afterwards I wondered where it went wrong. The ability to see what occurred on the page or how it looked at the time would be a great benefit. I've been writing a few automated tests lately and looking for a way to implement this functionality. Luckily, &lt;strong&gt;Selenium 2&lt;/strong&gt; provides easy functionality that allows you to capture a screenshot of the page at the time that a unit test is being run - and it's really easy too.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumScreenShot/big-logo.png" alt="Selenium" /&gt;&lt;/p&gt;

&lt;p&gt;If you aren't really familiar with &lt;strong&gt;Selenium 2&lt;/strong&gt;, please check out another post I &lt;a href="http://deanhume.com/Home/BlogPost/automated-testing-with-selenium-2-and-nunit/47"&gt;wrote&lt;/a&gt; that provides a simple guide to getting started with Selenium. There is also quite a few resources available on the &lt;a href="http://code.google.com/p/selenium/w/list"&gt;Google code site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Right, let's get started. I am going to create a simple example that checks if the page has redirected to a different page and if so, we save a screenshot of the page.
Once you have added references to the &lt;strong&gt;Selenium 2&lt;/strong&gt; and &lt;strong&gt;Nunit&lt;/strong&gt; we need to declare our driver. For this instance I am using the &lt;strong&gt;FirefoxDriver&lt;/strong&gt; -  You could also test this using the other drivers that come with &lt;strong&gt;Selenium 2&lt;/strong&gt;, for example &lt;em&gt;IE&lt;/em&gt; and &lt;em&gt;Chrome&lt;/em&gt;.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumScreenShot/Selenium-Declare-Driver.png" alt="Selenium" /&gt;&lt;/p&gt;

&lt;p&gt;Then write the unit test that we will use and check if an error is thrown.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumScreenShot/Selenium2-GetScreenShot.png" alt="Selenium" /&gt;&lt;/p&gt;

&lt;p&gt;Let's break this down.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the URL that we think will throw an error.&lt;/li&gt;
&lt;li&gt;Check if the current URL matches the URL that we originally      navigated to.&lt;/li&gt;
&lt;li&gt;If the current Url and the original URL doesn't match we call the method SaveScreenShot.&lt;/li&gt;
&lt;li&gt;Finally, we fail the test.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the method that we use to save the screenshot.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SeleniumScreenShot/Selenium2-SaveScreenShot.png" alt="Selenium" /&gt;&lt;/p&gt;

&lt;p&gt;Let's break this method down a little further.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, we use the &lt;strong&gt;FireFoxDriver&lt;/strong&gt; to get the screenshot for us.&lt;/li&gt;
&lt;li&gt;Next I am building up a unique file name based on the current date and time, you could change this to anything.&lt;/li&gt;
&lt;li&gt;Then save the image.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is a very simple example and would definitely need to be expanded on in a real world situation. However, there are so many usages that this little function can be applied to. If you wanted you could also save a log file with the details of the unit tests and the reasons for failure. There is also the possibility of forwarding on an email with an attached screenshot when the test fails.&lt;/p&gt;

&lt;p&gt;I have also included a sample project that is available for &lt;a href="http://c512911.r11.cf3.rackcdn.com/SeleniumScreenShot/SeleniumTest.zip"&gt;download&lt;/a&gt;. It contains the example in this post as well as the original examples that were contained in my other Selenium 2 &lt;a href="http://deanhume.com/Home/BlogPost/automated-testing-with-selenium-2-and-nunit/47"&gt;article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hope this helps!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=6XQ5_AlvN84:2tt_WKEYpCo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/6XQ5_AlvN84" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Capturing%20Web%20Page%20Screenshots%20with%20Selenium%202/48</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/DDanuVx0uU4/47</link><title>Automated Testing with Selenium 2 and NUnit</title><description>&lt;p&gt;I have recently been looking into an awesome tool called Selenium.
What is &lt;b&gt;Selenium&lt;/b&gt;? Well, it's a suite of tools that you can use to automate web application testing across many platforms. I recently attended a Selenium Users Group at the &lt;b&gt;Google London Head Offices&lt;/b&gt; where they discussed the many usages of Selenium.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/Google-Offices-London.jpg" alt="Google Offices London" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Why would you want to use it? Well, imagine you had a web application that did the same thing even after a new deployment. You would need to regression test the entire front-end of the application. With &lt;b&gt;Selenium&lt;/b&gt;, you could automate all those tests and run them at the click of a button. Not only that, but you could integrate this into your build process! One of the presentations that were shown to us during the Selenium Users Group meeting was how &lt;b&gt;Mozilla&lt;/b&gt; use &lt;b&gt;Selenium&lt;/b&gt; to test the workings of &lt;b&gt;Firefox&lt;/b&gt;. Previously they would have hundreds of front-end tests to run, but once they automated the process it took a matter of minutes! &lt;/p&gt;

&lt;p&gt;At the moment the latest version of Selenium is available to download - &lt;a href="http://seleniumhq.org/" &gt;Selenium 2&lt;/a&gt;. It is currently and alpha release, but it's still definitely available to &lt;a href="http://seleniumhq.org/download/"&gt;use&lt;/a&gt; and is working well. I have recently been playing around with it to build some automated tests. It easily integrates with &lt;b&gt;Visual Studio and Nunit&lt;/b&gt; (or any testing framework that you use), and the API is also really easy to use.&lt;/p&gt;

&lt;p&gt;There is also a plugin for &lt;b&gt;Firefox&lt;/b&gt; that is available for download. It has an easy to use GUI that records clicks, typing, and other actions to make a test, which you can play back in the browser. However, for this article I am going to write the unit tests using the &lt;b&gt;Selenium 2 API&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;Let's get started. Once you have downloaded Selenium 2 from the website, you need to add a reference to the library in your project. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/Add-Reference.png" alt="Add Reference" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Then, we need to declare an instance of the WebDriver Interface.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/Selenium-Webdriver.png" alt="Selenium WebDriver" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Next I want the test to navigate to my blog's URL. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/Selenium-Navigate.png" alt="Selenium Navigate" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Once it has loaded the page, locate a Search Box in the HTML code, enter a value in the textbox and submit the page.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/Selenium-SendKeys.png" alt="Selenium Sendkeys" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Finally I am just using Nunit to check that the title of the page is correct and matches my search entry.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/Nunit-Assert.png" alt="Nunit Assert" title="" /&gt;&lt;/p&gt;

&lt;p&gt;It's as easy as that! Okay, let's do something a little more detailed. If you access this blog without JavaScript enabled, a small message appears at the top of the page saying "&lt;i&gt;This site is best viewed with JavaScript enabled&lt;/i&gt;". This is a personal preference and just appears because not all of the elements on this site work without JavaScript.
Now, if I wanted to check that this message always appears without JavaScript disabled I could easily write a test to do this - and it can be run again and again in seconds.&lt;/p&gt;

&lt;p&gt;This time - before we instantiate the WebDriver, we set the FireFoxProfile to have JavaScript disabled. After that we use the WebDriver as usual with the new profile.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/Selenium-Javascript-Disabled.png" alt="Selenium Javascript Disabled" title="" /&gt;&lt;/p&gt;

&lt;p&gt;After that, simply search the elements on the page for the matching HTML Table tag. Loop through the results and see if we have our messagebox.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Selenium/Selenium-Loop.png" alt="Selenium Loop" title="" /&gt;&lt;/p&gt;

&lt;p&gt;MessageBox found.....Wahey!!&lt;/p&gt;

&lt;p&gt;One of the great things about this tool is that it has a driver for &lt;b&gt;Firefox, IE and Chrome&lt;/b&gt;. So you can write you tests to run against all these browsers! &lt;/p&gt;

&lt;p&gt;I have created a small demo project that is available for &lt;a href="http://c512911.r11.cf3.rackcdn.com/Selenium/SeleniumTest.zip"&gt;download&lt;/a&gt;. It contains the source code used in these examples as well as a few more.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=DDanuVx0uU4:IU93yo04-tM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/DDanuVx0uU4" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Automated%20Testing%20with%20Selenium%202%20and%20NUnit/47</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/puz0cEnEPNI/46</link><title>A Year of Blogging</title><description>&lt;p&gt;This has been my first year of blogging! Whew! 1 year and 42 articles later - I never thought I'd be writing this. I had always thought about starting my own blog to write some technical articles, but I just never made the time and always had an excuse not to get one started. At first starting your own blog might seem quite daunting. I was also worried that the articles I wrote weren't going to be technical enough. Another worry was that I didn't have enough things to write about. So finally, towards the end of last year I decided that it was time to finally get one started. Would anyone bother reading it? Who knows - It would be a good learning curve though! The next big question was whether or not to use a ready built &lt;strong&gt;CMS / Blog engine&lt;/strong&gt; or build one myself? Well, I decided to do it the hard way and build my own engine. If you've got the time and passion to do this, I would definitely recommend it. There are a lot of things to learn from building every aspect of your own site. That said - there are some awesome &lt;strong&gt;CMS / Blogs&lt;/strong&gt; ready to roll out there. I quite like &lt;a href="http://wordpress.org/"&gt;Wordpress&lt;/a&gt;, &lt;a href="http://www.asp.net/downloads/starter-kits/blog-engine"&gt;BlogEngine.NET&lt;/a&gt; and maybe even &lt;a href="http://www.tumblr.com"&gt;Tumblr&lt;/a&gt;. You could always look on &lt;a href="http://www.codeplex.com"&gt;Codeplex&lt;/a&gt; and even contribute to one of the existing ones on there.&lt;/p&gt;

&lt;p&gt;If you do decide to build your own blog, I do recommend getting some form of source control in place. I use beanstalk to store all my code. 
&lt;/p&gt;

&lt;p align="center"&gt;
&lt;a href="http://beanstalkapp.com/"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/2010Review/beanstalklogo.png" alt="Beanstalk source control"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;They offer great support for &lt;strong&gt;Subversion&lt;/strong&gt; and &lt;strong&gt;Git&lt;/strong&gt; and currently have a trial account option that is more than sufficient for a single developer.&lt;/p&gt;

&lt;h2&gt;Highlights&lt;/h2&gt;

&lt;p&gt;When I first started out it took a while to get visitors flowing regularly through the site. Patience is definitely a big part of blogging - but you should also blog because you love it. You might not get as many hits as you expect on your site or on a certain article that you wrote - but it definitely takes a while to build up the content as well as the traffic on your site.&lt;/p&gt;

&lt;p&gt;Throughout the year there have been a few highlights and things that have kept me blogging. I spent some time and recently wrote an &lt;strong&gt;HTML5&lt;/strong&gt; toolkit for &lt;strong&gt;MVC&lt;/strong&gt; which has had an awesome response from the community out there. I got a few tweets from ScottGu and Scott Hanselman. It was definitely an exciting moment to get recognized by some of the big dogs!&lt;/p&gt;

&lt;p&gt;I also got the toolkit featured on the Asp.net homepage which was great. Unfortunately, when I signed up for my profile to Asp.net I grabbed a goofy picture of myself that I could find on my PC - &lt;i&gt;bad idea.&lt;/i&gt; I didn't actually think that I would get an article featured on the front page of Asp.net! This is what happens when you add goofy photos to your profile!&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/2010Review/asp-net-homepage.png" alt="Asp.net Homepage"/&gt;&lt;/p&gt;

&lt;p&gt;There was also some coverage on the &lt;strong&gt;Channel 9&lt;/strong&gt; weekly roundup video.&lt;/p&gt;

&lt;p align="center"&gt;
&lt;iframe src="http://player.vimeo.com/video/17599311?byline=0&amp;amp;portrait=0&amp;amp;color=59a5d1" width="400" height="300" frameborder="0"&gt;&lt;/iframe&gt;
&lt;br/&gt;
&lt;/p&gt;

&lt;p&gt;If you haven’t already had a look at the &lt;strong&gt;HTML5 toolkit for MVC&lt;/strong&gt;, please check it out on &lt;a href="http://mvchtml5.codeplex.com/"&gt;Codeplex.&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
I originally started off hoping that if  more than ten people read my blog that would be awesome. Surprisingly however there are a lot of developers out there just like me that are constantly reading and crave knowledge from the internet, the response from the community out there has been great. 
&lt;br /&gt;
Throughout the year a few ideas popped into my head and I decided to give them a try - having a blog is a great way to get these ideas out there. For a lot of people out there blogging might not be for you, which is totally understandable considering the time and dedication it takes to keep on writing and editing articles. However, if the idea of having your own blog appeals to you - I would definitely recommend it. It has been a great learning curve for me. It forces you to constantly keep up to date with what is out there on the net and keeps you thinking all the time. There is a great article out there by Scott Hanselman entitled - &lt;a href="http://www.hanselman.com/blog/BlogInteresting32WaysToKeepYourBlogFromSucking.aspx"&gt;32 ways to keep your blog from sucking&lt;/a&gt;
I would definitely recommend you have a read.&lt;/p&gt;

&lt;p&gt;If you feel that blogging is for you, get out there and get writing!&lt;/p&gt;

&lt;p&gt;And finally some stats from the past year - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Hits&lt;/b&gt; - 32,872&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Visits&lt;/b&gt; - 51,290&lt;/li&gt;
&lt;li&gt;Around 400 &lt;b&gt;ReTweets&lt;/b&gt;
......and loads of research!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks for visiting my site!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=puz0cEnEPNI:COVogivp35E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/puz0cEnEPNI" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/A%20Year%20of%20Blogging/46</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/_ZFLK3xNfrk/45</link><title>Basic Introduction to writing unit tests with Moq - Part 3</title><description>&lt;p&gt;&lt;P&gt;This post is the third part of a series on &lt;B&gt;Mocking with Moq&lt;/B&gt;. If you haven't already taken a look at the first two posts on the basics of &lt;B&gt;Moq&lt;/B&gt;, please check it &lt;A href="http://deanhume.com/Home/Tagged?tag=Moq"&gt;out&lt;/A&gt;.&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG alt="Moq Same Class" src="http://c512911.r11.cf3.rackcdn.com/Moq3/moq-small.png"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;/P&gt;
&lt;H2&gt;Mocking a method within the same class&lt;/H2&gt;
&lt;P&gt;So, recently I came across a problem where I had a method on a class that I needed to mock its return value. It had no interface and I wasn't sure if there was a way to mock it. Fortunately there is a way - and it's pretty easy to do! Let's take a look.&lt;/P&gt;
&lt;P&gt;In the &lt;A href="http://deanhume.com/Home/BlogPost/basic-introduction-to-writing-unit-tests-with-moq/16"&gt;previous&lt;/A&gt; &lt;A href="http://deanhume.com/Home/BlogPost/basic-introduction-to-writing-unit-tests-with-moq---part-2/23"&gt;articles&lt;/A&gt; that we have looked at, we wrote a few tests for a simple &lt;B&gt;eCommerce Basket (Cart)&lt;/B&gt; system. In this example we are taking a look at a very simple method that calls another method to get the &lt;B&gt;Geolocation&lt;/B&gt; details of an IP address. If you would like to know more about this &lt;B&gt;Geolocation service&lt;/B&gt; - please check out the article on &lt;A href="http://www.hanselman.com/blog/TheWeeklySourceCode37GeolocationGeotargetingReverseIPAddressLookupInASPNETMVCMadeEasy.aspx"&gt;Scott Hanselman's blog&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;We don't want to call the 3rd party service every time we run our tests, so we need to mock out the return value. In this instance our method doesn't have a matching interface.&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Moq Same Class" src="http://c512911.r11.cf3.rackcdn.com/Moq3/Moq-Same-Class-No-Virtual.png"&gt;&lt;/P&gt;
&lt;P&gt;In the above method we pass in the basket object and an IP Adress that we need to find out the details for. Previously, I would have done this using an Interface - but for the purpose of this example let's say there is no Interface. Where previously we would have mocked the Interface we now need to mock the class under test.&lt;/P&gt;
&lt;P&gt;In our setup we now mock the Class instead of the Interface.&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Moq Same Class Setup" src="http://c512911.r11.cf3.rackcdn.com/Moq3/Mock-Setup.png"&gt;&lt;/P&gt;
&lt;P&gt;There are still a few more things that need to be done in order to get this to work. The method that we are calling needs to made virtual and we need to use the &lt;B&gt;CallBase property&lt;/B&gt; on the Mock. The &lt;B&gt;Callbase property &lt;/B&gt;is a boolean and decides whether or not to call the base member &lt;B&gt;virtual implementation&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Moq Same Class" src="http://c512911.r11.cf3.rackcdn.com/Moq3/Mock-Callbase.png"&gt;&lt;/P&gt;
&lt;P&gt;And update the method signature to &lt;B&gt;virtual&lt;/B&gt;.&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Moq Same Class" src="http://c512911.r11.cf3.rackcdn.com/Moq3/Moq-Same-Class.png"&gt;&lt;/P&gt;
&lt;P&gt;Then we put it all together.&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Moq Same Class" src="http://c512911.r11.cf3.rackcdn.com/Moq3/Moq-Test-Method.png"&gt;&lt;/P&gt;
&lt;P&gt;If you run through this test you will now see that the same class will return a mock value. I've put together this example on top of the code that came with the first two posts and can be downloaded &lt;A href="http://c512911.r11.cf3.rackcdn.com/Moq3/MoqTestExample.zip"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=_ZFLK3xNfrk:LgwwwOFAcsM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/_ZFLK3xNfrk" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Basic%20Introduction%20to%20writing%20unit%20tests%20with%20Moq%20-%20Part%203/45</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/bZN8brOImME/44</link><title>Custom OData API using WCF Data Services</title><description>&lt;p&gt;I have recently been glued to my screen watching some of the awesome presentations that were shown at the recent &lt;a href="http://player.microsoftpdc.com/session"&gt;PDC 2010&lt;/a&gt;. There were some really amazing presentations and one of them really caught my eye. It was a talk about the power of &lt;b&gt;ODATA&lt;/b&gt; and the support that Microsoft are building into Visual Studio for it. The presentation was entitled &lt;i&gt;"Inside Some of The Top OData Services"&lt;/i&gt; by &lt;strong&gt;Pablo Castro&lt;/strong&gt;. You should still be able to stream the presentation on the &lt;a href="http://bit.ly/bqQYL4"&gt;PDC player&lt;/a&gt;. &lt;/p&gt;

&lt;p align="center"&gt;
&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/Odata.png" alt="OData"&gt;&lt;/p&gt;

&lt;p&gt;One of the things that he showcased was the ability to use &lt;strong&gt;Entity Framework&lt;/strong&gt; and &lt;strong&gt;WCF Data Services&lt;/strong&gt; in order to create an &lt;strong&gt;OData API&lt;/strong&gt;. As I watched him quickly put together an example, I thought to myself that there was no way it could be that easy - Really!? So, I decided to put together a small sample using my Blog's Database. These are the steps that I took.&lt;/p&gt;

&lt;p&gt;Firstly, add a new Entity Data Model. Right click on your Project - select &lt;em&gt;Add New Item&lt;/em&gt;. I called mine &lt;em&gt;BlogData&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/add-new-item.png" alt="Add new Entity Data Model"&gt;&lt;/p&gt;

&lt;p&gt;Next, choose &lt;em&gt;Generate from database&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/generate-from-db.png" alt="Generate from Database"&gt;&lt;/p&gt;

&lt;p&gt;On the next screen, choose your database connection and name your Entity Connection Setting. I called mine "DeanTestEntities", but you could call yours anything.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/Connection-Settings.png" alt="Connection Settings"&gt;&lt;/p&gt;

&lt;p&gt;You should then have a screen displaying a Model Browser of your database entities.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/model-browser.png" alt="Model Browser"&gt;&lt;/p&gt;

&lt;p&gt;I need to link my two tables together so that I can associate my comments with the relevant blog entry. Right click on your table and choose &lt;strong&gt;Add | Association&lt;/strong&gt;. I added an association between my BlogPost model and the Comment table. They need to be joined on BlogId.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/constraint.png" alt="Add Association"&gt;&lt;/p&gt;

&lt;p&gt;After that, all I needed to do was to add a &lt;strong&gt;WCF Data Service&lt;/strong&gt; and wire it up. Right click on your project and choose &lt;strong&gt;Add | New Item | WCF Data Service&lt;/strong&gt;. We are almost there, all we need to do is wire it up. Once you have created your &lt;strong&gt;WCF Data Service&lt;/strong&gt; you should be presented with some autogenerated code. You will need to replace the following line with the name of the Entity Connection String we used when we created the Entity Data. Mine was called &lt;em&gt;DeanTestEntities&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Replace &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/data-service.png" alt="Data Service"&gt;&lt;/p&gt;

&lt;p&gt;With the following. I also uncommented the line that contained "SetEntitySetAccessRule". This allows all user to access the API. I hope to talk more about Entity Access rules in a future post.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/data-service-replace.png" alt="Data Service"&gt;&lt;/p&gt;

&lt;p&gt;That's it. We now have a working API that we can start using. Fire up your application. This is what I see when I open the application in my browser.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/page.png" alt="Browser"&gt;&lt;/p&gt;

&lt;p&gt;If I use the &lt;strong&gt;href&lt;/strong&gt; in the data, and update my URL to be http://locahost/blog.svc/BlogPosts. This new URL then navigates to my Blogpost entity and displays like so. Awesome!&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/OData/page2.png" alt="Browser"&gt;&lt;/p&gt;

&lt;p&gt;I can now use the associations and links in the data to get anything I need. If I try changing the URL to -&lt;strong&gt;http://locahost/blog.svc/BlogPosts(2)&lt;/strong&gt; - I get the blog entry with the Id of 2.&lt;/p&gt;

&lt;p&gt;Or if I try - &lt;strong&gt;http://locahost/blog.svc/BlogPosts(2)?expand=Comments&lt;/strong&gt; - I get the blog entry and all comments associated to it. If you remember we set up the associations in the Model Browser.&lt;/p&gt;

&lt;p&gt;I can order by - &lt;strong&gt;http://localhost/blog.svc/BlogPosts?orderby=Title&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Or even get only the value without any xml brackets - &lt;strong&gt;http://localhost/blog.svc/BlogPosts(2)/Title/$value&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Building this small OData sample around my existing application literally only took about 20-30 minutes. I was really surprised at how easy it was. There are a few more things that I would like to take a look at, but I will try and cover that in future post. &lt;/p&gt;

&lt;p&gt;For more information on this awesome feature please take a look at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.hanselman.com/blog/CreatingAnODataAPIForStackOverflowIncludingXMLAndJSONIn30Minutes.aspx"&gt;Scott Hanselman's Article&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;There is a large list of consumers and producers that are available on         the &lt;a href="http://www.odata.org/"&gt;OData website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You could also view the presentation by Pablo on the &lt;a href="http://bit.ly/bqQYL4"&gt;PDC website&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Also check out &lt;a href="http://blogs.msdn.com/b/pablo/"&gt;Pablo's blog&lt;/a&gt; and see what the team are up to.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=bZN8brOImME:Eqsov0iLQjA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/bZN8brOImME" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Custom%20OData%20API%20using%20WCF%20Data%20Services/44</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/3EWcg02lNsE/42</link><title>Proxy Authentication - Helper Class</title><description>&lt;p&gt;If you have ever created an application that requires you to access the internet or call a 3rd party service over the web, you may have come across the issue of the user being behind a proxy server and having to authenticate. The common issue that I have come across is the 
famous error message:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"The remote server returned an error: (407) Proxy Authentication Required".&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Recently, I was working on the &lt;a href="http://smushmysite.codeplex.com/"&gt;SmushMySite Application&lt;/a&gt; and although it worked perfectly on my machine at home - many other people were getting a proxy authentication error. As soon as I tried the application at work - BANG! - I got the same error. As I'm sure that I will come across this issue again, I decided it was probably best to write a little helper class. You may have come across better methods, but this seems to work for me. It might seem a little confusing a first, but it will all come together.&lt;/p&gt;

&lt;p&gt;Firstly, I recommend you take a look at the following &lt;a href="http://deanhume.com/Home/BlogPost/http-head-request---benefits---usages/41"&gt;article&lt;/a&gt; just to get up to speed with &lt;strong&gt;HTTP HEAD requests&lt;/strong&gt; and checking if the user has an internet connection. This is done by making a simple &lt;strong&gt;HTTP HEAD request&lt;/strong&gt; to see if the user can connect. If they can't, we should get a &lt;em&gt;"407 Proxy Authentication Required"&lt;/em&gt; exception.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ProxyAuthentication/Proxy-Requires-Authentication.png" alt="Proxy Requires Authentication" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Okay, let's break this down. The above method I am using checks if the user requires authentication when connecting to the internet. It uses the Default Credentials property to determine if the system credentials in the current security context will work. The &lt;em&gt;CheckExists&lt;/em&gt; method is called, and if a 407 exception is returned then we know that the user needs to authenticate. &lt;/p&gt;

&lt;p&gt;Once the user has provided us with their credentials, we need a method to verify that their details are correct and then authenticate them.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ProxyAuthentication/Try-Authenticate.png" alt="Try Authenticate" title="" /&gt;&lt;/p&gt;

&lt;p&gt;In the above method, we pass in the Credentials and attempt to connect again. Using the &lt;em&gt;CheckExists&lt;/em&gt; method, we can determine if the user is able to connect using the credentials that they entered. If it was successful, the credentials have been set again we can access the internet as normal. However, if the authentication failed, we can prompt the user to re-enter their credentials. This could be due to incorrect username, passwords or domain.&lt;/p&gt;

&lt;p&gt;I have put these methods in a class called ProxyHelper. Let's put it all together and call the methods that we have created.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/ProxyAuthentication/connect.png" alt="Proxy Authentication" title="" /&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the above code, I have added a little bit of extra logic to show useful messages to the user. You might want to handle this slightly differently depending on the setup of your application. &lt;/p&gt;

&lt;p&gt;Just to make this a little easier to understand, I have put all the code above into a WPF example that is available to download. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://c512911.r11.cf3.rackcdn.com/ProxyAuthentication/ProxyAuthenticationExample.zip"&gt;
&lt;img src="http://c512615.r15.cf3.rackcdn.com/download.png" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=3EWcg02lNsE:jb1v1OIu-ao:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/3EWcg02lNsE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Proxy%20Authentication%20-%20Helper%20Class/42</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/mqRdr-TTSHg/41</link><title>HTTP HEAD Request - Benefits / Usages</title><description>&lt;p&gt;Until recently, I had heard of the &lt;strong&gt;HTTP HEAD method&lt;/strong&gt; but never actually used it, or quite understood it's usages. I'm sure most of us have used some of the common &lt;strong&gt;HTTP Verbs&lt;/strong&gt; before such as &lt;strong&gt;GET&lt;/strong&gt; or &lt;strong&gt;POST&lt;/strong&gt;. Let me explain a little bit about the &lt;strong&gt;HTTP HEAD&lt;/strong&gt; request method. According
to &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"&gt;Wikipedia&lt;/a&gt; it does the following:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;How is this useful to us? Well, let's say for example we needed to check if a resource was available or online but we didn't want to download it. We could simply use the &lt;strong&gt;HEAD&lt;/strong&gt; request to check if it was there - it doesn't download any response and this saves us bandwidth. We can also get the Content Length and the Last Modified date which we can use to further decide whether or not to download the resource. Let's take a look at how to do this in .NET - I have created a simple method that checks if the resource exists.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HttpHead/Http-Head.png" alt="HTTP HEAD request" /&gt;&lt;/p&gt;

&lt;p&gt;It's that simple! If we get a response without exception this means that we are able to access the resource. You may want to do some further exception checking, but what you do with it after that is up to you!&lt;/p&gt;

&lt;p&gt;For some further reading, please take a look at:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Hypertext&amp;#95;Transfer&amp;#95;Protocol#Request&amp;#95;methods"&gt;http://en.wikipedia.org/wiki/Hypertext&amp;#95;Transfer&amp;#95;Protocol#Request&amp;#95;methods&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"&gt;http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=mqRdr-TTSHg:eTVriwyRL1A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/mqRdr-TTSHg" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/HTTP%20HEAD%20Request%20-%20Benefits%20/%20Usages/41</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/ZKRR0vVwt5A/40</link><title>jQuery Mobile - Optimizing your Website for Smartphone's and Tablets</title><description>&lt;p&gt;As developers today, our websites are constantly being accessed from different forms of devices - PC's, Mac's, iPhones, Blackberry's, iPads - and the list goes on! Developing websites and content that conforms to all these standards can be a nightmare. Luckily, jQuery has just released a version of their library called &lt;b&gt;jQuery Mobile.&lt;/b&gt; Not only does it provide sleek, clean and semantic HTML - but it is a unified &lt;b&gt;JavaScript User Interface&lt;/b&gt; that works across the most-used Smartphone web browsers and tablets. What does this mean for us as developers?
Well, it means that we now have a unified JavaScript library that we can use to write web-based applications that can be used by Smartphones &amp; Tablets - plus it's really easy to use!&lt;/p&gt;

&lt;p&gt;Let's take a look at a simple example using jQuery mobile. First off, you need to use the new HTML5 doctype in your page.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/html5-doctype.png" alt="Html5 DocType" /&gt;&lt;/p&gt;

&lt;p&gt;Next, include a reference to the &lt;b&gt;jQuery Mobile&lt;/b&gt; library and stylesheets.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/jQuery-Library.png" alt="Jquery Mobile" /&gt;&lt;/p&gt;

&lt;p&gt;Now, we are ready to get started. First off, let's start by defining the layout of the page. Each view or "page" on the mobile device is identified by an element with the &lt;i&gt;data-role="page".&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/Page.png" alt="data-role=page" /&gt;&lt;/p&gt;

&lt;p&gt;Inside that, we can further define the page layout.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/Full-Page.png" alt="data-role=page" /&gt;&lt;/p&gt;

&lt;p&gt;That is all that is needed to start coding your site. It's that easy!
There is also a boilerplate template that is available on the site.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://jquerymobile.com/demos/1.0a1/#docs/pages/page-template.html"&gt;http://jquerymobile.com/demos/1.0a1/#docs/pages/page-template.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay, so now we have defined our page - let's start making it sexy.
The library comes with themes that are even easier to use, plus they take advantage of CSS3 properties. Simply assign a &lt;i&gt;data-theme&lt;/i&gt; attribute to the header or
footer.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/Theme.png" alt="data-theme" /&gt;&lt;/p&gt;

&lt;p&gt;The default theme currently contains five style and you simply define the swatch by the swatch letter.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/Swatches.png" alt="data-theme" /&gt;&lt;/p&gt;

&lt;p&gt;If we wanted to style a link as a button, add the &lt;i&gt;data-role="button"&lt;/i&gt; attribute.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/Button.png" alt="data-role=button" /&gt;&lt;/p&gt;

&lt;p&gt;It then appears as&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/Link-Button.png" alt="data-role=button" /&gt;&lt;/p&gt;

&lt;p&gt;Let's say we wanted to add an icon to our button.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/Button-Refresh.png" alt="data-icon" /&gt;&lt;/p&gt;

&lt;p&gt;Which appears as&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/JQueryMobile/Button-Icon.png" alt="data-icon" /&gt;&lt;/p&gt;

&lt;p&gt;There are many more features available with the &lt;b&gt;jQuery Mobile&lt;/b&gt; library, and I'm sure as it expands and progresses we will see a lot more from it! I've just touched on some of the 
great features that it currently offers, but for more information please check out &lt;a href="http://jquerymobile.com"&gt;http://jquerymobile.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this site, I already had a iPhone enabled version of my site - but it didn't quite work across all mobile devices. I decided that it was time to update the mobile site to make it available to more devices. Please check it out at - &lt;a href="http://www.deanhume.com/mobile"&gt;http://www.deanhume.com/mobile&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=ZKRR0vVwt5A:4EBQpxMOyeM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/ZKRR0vVwt5A" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/jQuery%20Mobile%20-%20Optimizing%20your%20Website%20for%20Smartphone's%20and%20Tablets/40</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/2AotkMsw5UY/39</link><title>SmushMySite - Image Optimization Tool Update</title><description>&lt;p&gt;The &lt;b&gt;SmushMySite&lt;/b&gt; tool has just been updated with a load of new enhancements. For those of you that aren't familiar with the &lt;b&gt;SmushMySite&lt;/b&gt; tool, it is a free image optimization tool that takes advantage of the Yahoo &lt;b&gt;Smush.it™&lt;/b&gt; service. It is a quick and easy way to optimize all images on webpage, or all images on your site. You simply enter the URL of the page with the images you want to optimize and it will process and spit out all the optimized images! If you want to optimize your entire site - you simply point it to your site's sitemap - it's that easy!&lt;/p&gt;

&lt;p&gt;The latest release now has support for CSS images, which means it will now check your URL for any images that are referenced via CSS and optimize them too, making your life a lot easier!&lt;/p&gt;

&lt;p&gt;For more information, please check out the &lt;a href="http://deanhume.com/Home/BlogPost/smushmysite-image-optimization-tool---smush-it-/38"&gt;original article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SmushMySite/New/Main-Small.png" alt="SmushMySite - Main Menu - Smush.it™" title="" /&gt;&lt;/p&gt;

&lt;p&gt;The latest release has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;- List item&lt;/li&gt;
&lt;li&gt;- Support for CSS images&lt;/li&gt;
&lt;li&gt;- Update with Silverlight Jetpack Theme&lt;/li&gt;
&lt;li&gt;- Better validation for URL's and Extensions&lt;/li&gt;
&lt;li&gt;- Now handles ASP.net images - &lt;i&gt;input type="image"&lt;/i&gt; &lt;/li&gt;
&lt;li&gt;- Better checks for duplicate images&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To download the latest version, please visit &lt;a href="http://smushmysite.codeplex.com/"&gt;http://smushmysite.codeplex.com/&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=2AotkMsw5UY:qgFnCcdGuwU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/2AotkMsw5UY" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/SmushMySite%20-%20Image%20Optimization%20Tool%20Update/39</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/IFtK_8mjhuI/38</link><title>SmushMySite Image Optimization Tool - Smush.it™</title><description>&lt;p&gt;When I am developing a web site, I am always looking for ways to improve the speed and page load times. I have used a few tools such as &lt;b&gt;Yahoo's YSlow&lt;/b&gt; and &lt;b&gt;Google's Page Speed Analyzer&lt;/b&gt;. If you have played around extensively with YSlow you may have noticed that there is a small column on the components tab called &lt;b&gt;"Smush.it"&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SmushMySite/YSlow.png" alt="YSlow Smush.it"&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Smush.it™&lt;/b&gt; is an awesome tool that optimizes images by removing unnecessary bytes from the image without changing its look or visual quality. After &lt;b&gt;Smush.it™&lt;/b&gt; runs on a web page it reports how many bytes would be saved by optimizing the page's images and provides a downloadable zip file with the minimized image files.&lt;/p&gt;

&lt;p&gt;I was recently playing around with the tool that is included as part of the YSlow tool for Firebug. Now the tool that comes part of the firebug plugin is great, but the process is a bit manual if you have loads of images on your website. I also had a look at the &lt;a href="http://www.smushit.com/ysmush.it/"&gt;Smush.it site&lt;/a&gt;, which provides an online tool for you to upload images and then retrieve the optimized images as a zip file. On the site, there is also the option to input the URL's of the images on you site. This got me thinking, what if there was a way to optimize all images on my site, or even all images on one of my web pages. &lt;/p&gt;

&lt;p&gt;I decided to write a tool that would help with this. Enter &lt;b&gt;SmushMysite&lt;/b&gt; - it is a tool that allows you to link to a URL or website sitemap, which then processes all the images on the page and copies the optimized images to an output directory. I can sometimes be lazy and any way to automate this process makes life a lot easier. Be sure to download this tool at &lt;a href="http://smushmysite.codeplex.com"&gt;http://smushmysite.codeplex.com&lt;/a&gt;. It has been written using WPF and C# 4, and you might be prompted to install .NET Framework 4 when installing the tool.&lt;/p&gt;

&lt;p&gt;Below is just a quick walkthrough about the tool and how it works.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The Main Menu Screen&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SmushMySite/Main.png" alt="SmushMySite - Main"&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The ability to optimize images for a given URL&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SmushMySite/Smush-Url.png" alt="SmushMySite - Url"&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;The ability to optimize images for a given sitemap. The tool will run through all URL's on the sitemap.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SmushMySite/Smush-Sitemap.png" alt="SmushMySite - Sitemap"&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Once the tool has finished running, you will be able to view the results of the optimization as well as any errors that may have occured during the process.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/SmushMySite/Image-Savings.png" alt="SmushMySite - Sitemap"&gt;&lt;/p&gt;

&lt;p&gt;One thing to keep in mind when using this tool is that it is still in the early development stages and there are a few known issues. If you come across any issues with this tool, or have any advice on how to improve it / suggestions - please contact me and let me &lt;a href="http://deanhume.com/Home/ContactPage"&gt;know.&lt;/a&gt; Please be sure to include the URL that you were running against.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;List of known current issues:&lt;/b&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Doesn't currently process images in CSS files. This is being looked at for future releases.&lt;/li&gt;
&lt;li&gt;Generally only works with image URL's that end in correct image formats (ie. jpg, gif, png, etc.)&lt;/li&gt;
&lt;li&gt;"407 Authentication Error" occurs when connecting from a proxy.
One of the things I am looking at in future releases is to allow for proxies.&lt;/li&gt;
&lt;li&gt;Websites that have too many redirections in the page load may cause errors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are also a few things that I would like to add to this tool and these are some of the upcoming features that I would like to have ready for future releases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ability to loop through the CSS file and retrieve and optimize all the images.&lt;/li&gt;
&lt;li&gt;Full support for proxies and the ability to enter Username and Password when prompted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more details and frequently asked questions on &lt;b&gt;Smush.it™&lt;/b&gt;, please visit the &lt;a href="http://developer.yahoo.com/yslow/smushit/faq.html"&gt;FAQ&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Again, to download the tool please visit - &lt;a href="http://smushmysite.codeplex.com"&gt;http://smushmysite.codeplex.com&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=IFtK_8mjhuI:K28r_VLy23M:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/IFtK_8mjhuI" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/SmushMySite%20Image%20Optimization%20Tool%20-%20Smush.it%E2%84%A2/38</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/GXL2vcfOYyg/37</link><title>Object Caching - .NET 4</title><description>&lt;p&gt;&lt;P&gt;As a developer, we need to use all the tools at our disposal to develop faster and more robust applications. One of the ways we can achieve this is by using caching. &lt;STRONG&gt;Caching&lt;/STRONG&gt; is the process of storing frequently used data on the server to fulfil subsequent requests. Now there are a few different types of caching available to the &lt;STRONG&gt;.NET&lt;/STRONG&gt; developer, but in this article I am going to discuss data caching using the object cache. The cache object enables you to store everything from simple name / value pairs to more complex objects such as datasets and entire pages.&lt;/P&gt;
&lt;P&gt;Previously, the cache object used to fall under the &lt;EM&gt;System.Web.Caching.Cache&lt;/EM&gt; namespace. Due to it's power and awesomeness, many developers would copy this namespace into their projects and use it in other applications such as Windows Forms and WPF apps. With the release of .NET 4, the namespace has been refactored and totally rebuilt into the new namespace of &lt;EM&gt;System.Runtime.Caching&lt;/EM&gt;. The old namespace is still available, but any new enhancements will be added to the &lt;EM&gt;System.Runtime.Caching&lt;/EM&gt; namespace.&lt;/P&gt;
&lt;P&gt;In this example, I am going to take a look at &lt;STRONG&gt;Object Caching&lt;/STRONG&gt;. For more types of caching available to you in the .net framework - check out&amp;nbsp;&lt;A href="http://msdn.microsoft.com/en-us/library/dd985642.aspx"&gt;this link&lt;/A&gt;.&amp;nbsp;Now, let's look at a code example and run through how easy it is to add some caching to your application. I'm going to use an example of some of the caching I use when building on this site.&lt;/P&gt;
&lt;P&gt;To start, you add a reference to the &lt;EM&gt;System.Runtime.Caching&lt;/EM&gt; object in your project.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Add Reference" src="http://c512911.r11.cf3.rackcdn.com/Cache/Add-Reference.png"&gt;&lt;/P&gt;
&lt;P&gt;If you wanted to add an item to the cache, you would need to do the following:&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Add to Cache" align=baseline src="http://c512911.r11.cf3.rackcdn.com/Cache/Add-To-Cache.png"&gt;&lt;/P&gt;
&lt;P&gt;In this line, we are obtaining a reference to the default MemoryCache instance. Using the new .NET Caching runtime, you can have multiple MemoryCaches inside a single application.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;ObjectCache Cache = MemoryCache.Default;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Then we add the object to the cache along with a key. The key allows us to retrieve this at a later point.&lt;/P&gt;
&lt;p&gt;
Sometimes you might come across a scenario where a similar object will have similar name, in this case you might  want to build a dynamic key string to identify your objects.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Cache.Add("Key", objectToCache, DateTime.Now.AddDays(30));&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Retrieving our object is just as simple, but this time let's make a re-usable method that is a lot sexier.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="" align=baseline src="http://c512911.r11.cf3.rackcdn.com/Cache/Cache-Get.png"&gt;&lt;/P&gt;
&lt;P&gt;
For this example I have added the above method to a class called CacheLayer, and if we wanted to call the method that has just been created:&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Cache Get" align=baseline src="http://c512911.r11.cf3.rackcdn.com/Cache/Cache-Get-Example.png"&gt;&lt;/P&gt;
&lt;P&gt;Let's put the whole thing together in a real world example and show the power of caching.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Cache Example" align=baseline src="http://c512911.r11.cf3.rackcdn.com/Cache/Cache-Example.png"&gt;&lt;/P&gt;
&lt;P&gt;In the above example, we check if the cache contains the data that we are looking for based on the key. If it doesn't contain the data, we retrieve it from the Database and then add it to the cache. Then the next time that the method is called it won't have to hit the Database, but simply get the data from memory. This saves a lot of time and overhead!&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE&lt;/STRONG&gt;: If you make changes on your application, you might not see them immediately because they might be in cache. You might need to remove the object in order to see your changes - you can always add&amp;nbsp;them back in!&lt;/P&gt;
&lt;P&gt;In order to wrap all this up, I have created a little class that you can easily call and use for your caching needs. If you would like to download just the class file - click &lt;A href="http://c512911.r11.cf3.rackcdn.com/Cache/CacheObject.zip"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Else if you prefer to download the full class library project with working unit tests &lt;/P&gt;
&lt;P&gt;
&lt;P&gt;&lt;A href="http://c512911.r11.cf3.rackcdn.com/Cache/CacheProject.zip"&gt;&lt;IMG alt=Download src="http://c512615.r15.cf3.rackcdn.com/download.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=GXL2vcfOYyg:L6BhoMpeg6E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/GXL2vcfOYyg" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Object%20Caching%20-%20.NET%204/37</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/PopZgrkcwz8/35</link><title>Analytics - Bounce Rate</title><description>&lt;p&gt;&lt;P&gt;If you are a fellow blogger or Webmaster then read on, because this might interest you somewhat. When I first started out blogging, I added &lt;STRONG&gt;Google Analytics&lt;/STRONG&gt; to my site to track visitors and stats. It's a great free tool and generally a really accurate service, and I'm certain that millions of people use this service. However, one of the things that I found was that my bounce rate was unusually high. It was and still is sitting at around 80%. &lt;BR&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG border=0 hspace=0 alt="Bounce Rate" align=baseline src="http://c512911.r11.cf3.rackcdn.com/BounceRate/Bounce-Rate.jpg"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;BR&gt;Now, if you aren't really familiar with bounce rates Wikipedia gives a great description of &lt;A href="http://en.wikipedia.org/wiki/Bounce&amp;#95;rate"&gt;this&lt;/A&gt;.&lt;BR&gt;&lt;BR&gt;"&lt;STRONG&gt;Bounce rate&lt;/STRONG&gt; (sometimes confused with exit rate) is a term used in web site traffic analysis. It essentially represents the percentage of initial visitors to a site who "bounce" away to a different site, rather than continue on to other pages within the same site."&lt;/P&gt;
&lt;P&gt;The formula used to calculate bounce rate is: &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Bounce Rate&lt;/STRONG&gt; = Total Number of Visits Viewing Only One Page / Total Number of Visits&lt;/P&gt;
&lt;P&gt;Having a high Bounce Rate made me think the articles I was writing weren't getting read - or even worse people were just leaving as soon as they saw the content! A while later, I read a &lt;A href="http://encosia.com/2010/04/23/how-30-seconds-dropped-my-bounce-rate-by-78/"&gt;post by Dave Ward&lt;/A&gt; at Encosia entitled "How 30 seconds dropped my bounce rate by 78%". In it he explains how bounce rates are measured by Google analytics. For example, if you spend five minutes reading this single post and then leave the site, Google Analytics will report your visit the same as if you left instantly. Now, if you are a blogger - this could make your statistics appear as if people aren't bothering to read your articles. However, if Google or any other site analytics package sent a second request to calculate how long you actually spent on a page, this would make your results appear dramatically different.&lt;/P&gt;
&lt;P&gt;After following his advice, I decided to setup and run the same stats provider alongside my Google Analytics tracker. The provider that he uses is called &lt;A href="http://getclicky.com/"&gt;GetClicky&lt;/A&gt;. &lt;STRONG&gt;GetClicky&lt;/STRONG&gt; is a real time web analytics service - this means that when you login and view your stats, you are seeing up to the minute data on the traffic to your web site. They also use a client side tracking code to "ping" the site every now and then and check if the user is still viewing the page. So, instead of relying on a second page view to calculate bounce rates, it uses the "pinging" instead. After a few months of running the two stats services alongside, this is the difference that I noticed:&lt;/P&gt;
&lt;H2&gt;Google&lt;/H2&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Google Bounce Rate" src="http://c512911.r11.cf3.rackcdn.com/BounceRate/Google-Bounce-Rate.png"&gt;&lt;/P&gt;
&lt;H2&gt;GetClicky&lt;/H2&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="GetClicky Bounce Rate" src="http://c512911.r11.cf3.rackcdn.com/BounceRate/Get-Clicky-Bounce-Rate.png"&gt;&lt;/P&gt;
&lt;P&gt;That's quite a remarkable difference! I definitely recommend trying this service out and seeing if you notice any improvements on your bounce rate. I'm not advising against the use of Google Analytics (I still use it), but if you are getting a low bounce rate on your Google Analytics results you might want to try out this service!&lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=PopZgrkcwz8:FZ2eCw0c37A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/PopZgrkcwz8" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Analytics%20-%20Bounce%20Rate/35</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/2SDquWu_GYY/34</link><title>MVC and the Google Visualization API (DataTable)</title><description>&lt;p&gt;&lt;P&gt;Google have created an awesome &lt;A href="http://code.google.com/apis/charttools/index.html"&gt;visualization API&lt;/A&gt;. It enables you to add live charts, graphs and tables to your web pages. It is quite flexible and has some great features that are quite easy to use once you get started. I started playing around with this API and decided to build a datatable using ASP.net MVC and the visualization API. &lt;/P&gt;
&lt;P&gt;Click &lt;A href="http://www.deanhume.com/content/PostImages/GoogleDataTable/DataTableDemo.htm"&gt;here &lt;/A&gt;to view a simple demo.&lt;/P&gt;
&lt;P&gt;Let's start off by adding a reference to the latest jQuery library. Then we will need to add another reference to the Google API script. And finally, we are going to use a Javascript file to write our code to create the table.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Javascript API" align=baseline src="http://c512911.r11.cf3.rackcdn.com/GoogleDataTable/Javascript-Links.png"&gt;&lt;/P&gt;
&lt;P&gt;Add a Javascript file to your project, let's call it "&lt;EM&gt;TableResults.js&lt;/EM&gt;". Add the code below to your Javascript file. I have broken this down into two separate parts for easier readability.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Javascript Datatable" align=baseline src="http://c512911.r11.cf3.rackcdn.com/GoogleDataTable/Javascript-Part-1.png"&gt;&lt;/P&gt;
&lt;P&gt;Okay, let's break this code down to get an idea of what's going on. &lt;/P&gt;
&lt;P&gt;1. Initially we are loading the Google Visualization API and instructing it to use the tables package. &lt;BR&gt;2. This is the location of our MVC Controller that we want to post to. &lt;BR&gt;3. Add the Column names and data types. &lt;BR&gt;4. Loop through all the results that we got back and set the data to the appropriate column.&lt;/P&gt;
And now the second part of the file:
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Javascript Datatable" align=baseline src="http://c512911.r11.cf3.rackcdn.com/GoogleDataTable/Jacascript-Part-2.png"&gt;&lt;/P&gt;
&lt;P&gt;5. We are adding a Number Formatter to the column. If the number is negative, we change the column to red. We are also prepending a currency symbol in front of the value. This is an optional feature that you can use to jazz up your table.
&lt;br&gt;6. This is another Column Formatter, but this time we are adding a colour to the column if it falls between certain range. Again, this is optional.&lt;BR&gt;7. Finally, the paging is being enabled and the paging size is being set to 2. The reason I am setting it so low is because I am only returning a small amount of data for this demo. You may want to set this higher depending on your preferences.&lt;/P&gt;&lt;/p&gt;

&lt;p&gt;
Next, add a method to our Controller. This should be the same as the name that we mapped in our Javascript file.
&lt;br&gt;
&lt;img src="http://c512911.r11.cf3.rackcdn.com/GoogleDataTable/ActionResult.png" alt=""&gt;&lt;/img&gt;
&lt;/p&gt;

&lt;p&gt;&lt;P&gt;We have one last thing to do, and this is just to add a div to our view that will contain the table and its data.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Table Div" align=baseline src="http://c512911.r11.cf3.rackcdn.com/GoogleDataTable/Div.png"&gt;&lt;BR&gt;&lt;BR&gt;&lt;b&gt;And that's it!&lt;/b&gt;&lt;/P&gt;
&lt;P&gt;The great advantages of using this API to help construct your tables is that it has features like Column formatting, paging and sorting, as well as the ability to totally manipulate the look and feel of your table. For more information on &lt;A href="http://code.google.com/apis/visualization/documentation/reference.html#DataTable"&gt;column formatting&lt;/A&gt; and &lt;A href="http://code.google.com/apis/visualization/documentation/reference.html#DataTable"&gt;paging&lt;/A&gt; please refer to the documentation. The API offers some additional features such as the ability to add Bar Formatters and Arrow Formatters.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Bar Formatter&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://code.google.com/apis/visualization/documentation/reference.html#barformatter"&gt;&lt;IMG border=0 hspace=0 alt="Bar Formatter" align=baseline src="http://c512911.r11.cf3.rackcdn.com/GoogleDataTable/DataTable-Bar-Fomatter.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Arrow Formatter&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://code.google.com/apis/visualization/documentation/reference.html#arrowformatter"&gt;&lt;IMG border=0 hspace=0 alt="Arrow Formatter" align=baseline src="http://c512911.r11.cf3.rackcdn.com/GoogleDataTable/DataTable-Arrows.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I've created a small solution based on this tutorial.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://c512911.r11.cf3.rackcdn.com/GoogleDataTable/GoogleDataTable.zip"&gt;&lt;IMG style="WIDTH: 48px; HEIGHT: 47px" border=0 hspace=0 alt=Download align=absMiddle src="http://c512615.r15.cf3.rackcdn.com/download.png"&gt;&lt;/A&gt;&amp;nbsp;Download&lt;/P&gt;
&lt;P&gt;For further reading on this API, please take a look at the following links.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://code.google.com/apis/visualization/documentation/examples.html"&gt;http://code.google.com/apis/visualization/documentation/examples.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://code.google.com/apis/visualization/documentation/reference.html#DataTable"&gt;http://code.google.com/apis/visualization/documentation/reference.html#DataTable&lt;/A&gt;&lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=2SDquWu_GYY:X_KK6fbZTpk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/2SDquWu_GYY" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20and%20the%20Google%20Visualization%20API%20(DataTable)/34</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/fhhrNpAmaJo/31</link><title>A Simple Guide to SQL Compact 4</title><description>&lt;p&gt;There has been quite a lot of interest building up recently around &lt;b&gt;SQL Compact 4&lt;/b&gt;. Now, if you are not familiar with SQL compact, it's basically a database engine that is free and totally embedded. You don't need to install a database anywhere on your server. Not only that, but it works with existing .NET based data API's (Entity Framework, NHibernate). Another great advantage of using a SQL CE database is that it is totally file based and you can store your database files within the \App&amp;#95;data folder of your web application. So, for someone like me who is running a simple blog that doesn't really require a massive DB, this is really ideal. If you use shared hosting services and you need to use &lt;b&gt;SQL Compact&lt;/b&gt; - no problem, it runs under medium trust which means it works perfectly.&lt;/P&gt;
&lt;P&gt;I decided to play around with a few sample exercises using SQL CE, and these are the steps that I took. Firstly, download the preview from this &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0d2357ea-324f-46fd-88fc-7364c80e4fdb&amp;amp;displaylang=en"&gt;link&lt;/A&gt;. Even if you are running your application under .NET 3.5 this will work perfectly. Next, we need to create a database using SQL server:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;.In SQL Server Management Studio, open Object Explorer.&lt;/P&gt;
&lt;P&gt;Note: You can use SQL Server Management Studio or SQL Server Management Studio Express to create a database. If you need to, you can install SQL Server Management Studio Express from &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&amp;amp;displaylang=en"&gt;Microsoft Download Center&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;In Object Explorer, click Connect, and then &lt;b&gt;choose SQL Server Compact.&lt;/b&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Create SQL Compact" align=baseline src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Create-Sql-Compact-DB.png"&gt;&lt;BR&gt;&lt;BR&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;.In the Connect to Server dialog box, select &lt;NEW Database…&gt;from the Database file drop-down list.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;.In the Create New SQL Server Compact&amp;nbsp;Database dialog box, type a file path and file name for the new database file. You can optionally select the default collation, case sensitivity, and choose whether you want to encrypt or password-protect the database. If you choose to encrypt or password-protect the database, type a password, and then click OK.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="SQL Compact" align=baseline src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Create-New-Sql-Compact-Blog.png"&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;.Click Connect to connect to the new SQL Server Compact&amp;nbsp;database. The database is now displayed in Object Explorer.&lt;/P&gt;

&lt;p&gt;&lt;b&gt;UPDATED&lt;/b&gt;
&lt;br&gt;
At present you can only create a SQL 3.5 Compact database using SQL Management Studio. In order to create a &lt;b&gt;SQL 4 Compact Database&lt;/b&gt; you need to use the &lt;a href="http://sqlcetoolbox.codeplex.com" title="SQL CE Toolbox" alt="SQL CE Toolbox"&gt;SQL CE toolbox&lt;/a&gt;. Full instructions are available on the site.
&lt;/p&gt;

&lt;P&gt;Okay, so now we have created our database let's add a table to it. Right click on &lt;I&gt;tables&lt;/I&gt; and choose new table. Let's name ours &lt;I&gt;blog.&lt;/I&gt; After that, we are going to add some fields to the DB.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Create new table" align=baseline src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Create-New-Table.png"&gt;&lt;/P&gt;
&lt;P&gt;Now that the database is complete, you need to copy the &lt;I&gt;.sdf&lt;/I&gt; file from it's file location and paste in under the \App&amp;#95;Data folder on your website.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Copy sdf file" align=baseline src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Add-Sql-Compact-Db.png"&gt;&lt;BR&gt;&lt;BR&gt;In order to start coding, we need to add a reference to the &lt;b&gt;SQL Server Compact 4.0 libraries.&lt;/b&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG alt="Copy Dlls" src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Copy-Dlls.png"&gt;&lt;/P&gt;
&lt;P&gt;For this example I am going to use Entity Framework as the data API. Next, add a new entity data model to our project. Right click on the solution explorer and choose add =&amp;gt; new item =&amp;gt; ADO.net entity data model, let's call ours "CompactRepository". &lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Generate New" align=baseline src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Generate-New.png"&gt;&lt;/P&gt;
&lt;P&gt;Next, choose generate from database. Then select your database from the drop down list. Then, choose all the tables / stored procedures you want to include in your model. Finally click finish.&lt;/P&gt;
&lt;P&gt;Let's start writing some code. Using EF makes our life a lot easier and now we can start coding against our database. We can start by adding an entry to our &lt;I&gt;blog&lt;/I&gt; table. &lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Insert Record" align=baseline src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Insert-Record.png"&gt;&lt;/P&gt;
&lt;P&gt;And then writing code to retrieve a record is just as simple.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Retrieve Record" align=baseline src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Retrieve-Record.png"&gt;&lt;/P&gt;
&lt;P&gt;One thing that I noticed while working on this is that it sometimes threw an exception - "&lt;EM&gt;SQL Server Compact Edition is not intended for ASP.NET development&lt;/EM&gt;". I'm not sure what is causing this, but it could be down to this being a CT edition. If you add the following line of code to your app - - it should all be sorted. Depending on your solution structure, you might want to put it in the global.asax.&lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Global asax" align=baseline src="http://c512911.r11.cf3.rackcdn.com/SQLCompact/Global-asax.png"&gt;&lt;/P&gt;
&lt;P&gt;For some further reading and information on SQL Compact 4, check out this &lt;A href="http://weblogs.asp.net/scottgu/archive/2010/06/30/new-embedded-database-support-with-asp-net.aspx"&gt;link&lt;/A&gt;&lt;/p&gt;
&lt;br&gt;
&lt;P&gt;&lt;A href="http://www.deanhume.com/content/postimages/SQLCompact/Compact.zip"&gt;&lt;IMG style="WIDTH: 48px; HEIGHT: 47px" border="0" hspace="0" alt="Download" align="absMiddle" src="http://c512615.r15.cf3.rackcdn.com/download.png"&gt;&lt;/A&gt;&amp;nbsp;Download this sample&lt;/P&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=fhhrNpAmaJo:LqUMFCflxSQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/fhhrNpAmaJo" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/A%20Simple%20Guide%20to%20SQL%20Compact%204/31</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/uSzf_730Q0A/30</link><title>MVC Experiment : An Alternative to Captcha</title><description>&lt;p&gt;I'm sure most of you have at some point been exposed to a CAPTCHA control on the net. They come in loads of forms and are used to tell the difference between humans and computers (bots). If you have a website on the net, you are prone to lots of different kinds of attacks from bots - such as &lt;a href="http://en.wikipedia.org/wiki/Cross-site&amp;#95;scripting" alt="CSRF (Cross-Site Request Forgery)" title="CSRF (Cross-Site Request Forgery)"&gt;CSRF (Cross-Site Request Forgery)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may have noticed that on some sites you get asked simple math questions or other simple questions when submitting or posting information. One of the more common controls out there is a captcha like control:&lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/reCaptcha.png" title="reCaptcha" alt="reCaptcha" /&gt;

&lt;br /&gt;
&lt;br /&gt;

&lt;p&gt;Generally these types of verification work very well, but personally I have always been annoyed by them. However, I even use a captcha control on this site from &lt;a href="http://www.google.com/recaptcha" title="reCAPTCHA" alt="reCAPTCHA"&gt;reCAPTCHA&lt;/a&gt;. Some users out there might not be very technical and these controls can confuse them, which may lead to a drop conversion rates. That said, this sort of verification is vital to keep our application secure.&lt;/p&gt;

&lt;p&gt;I was recently browsing the net when I came across this &lt;a href="http://www.lukew.com/ff/entry.asp?1138 " alt="Alternative to Captcha" title="Alternative to Captcha"&gt;article&lt;/a&gt; about an alternative to CAPTCHA. It involved making the user slide a slider to the end of a bar in order
to verify that they are human. It really got me thinking how I could get this implemented in MVC as well as keeping it as secure as possible.&lt;/p&gt;

&lt;p&gt;So, let's start off by creating a simple MVC application just to test this approach. First we build our model - &lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/MVC-Model.png" title="MVC Model" alt="MVC Model" /&gt;

&lt;p&gt;Then let's update our view:&lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/MVC-View.png" title="MVC View" alt="MVC View" /&gt;

&lt;p&gt;We need to include the references to jQuery and the jQuery UI toolkit.&lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/jQuery-Links.png" title="jQuery Links" alt="jQuery Links" /&gt;

&lt;p&gt;Then let's whack together a little bit of Javascript to handle the slider:&lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/jQuery-Slider.png" title="jQuery Slider" alt="jQuery Slider" /&gt;

&lt;p&gt;Okay, let me break this down a little and explain whats going on here. In Part 1, I'm creating a variable with a random number between 40 and 100. This variable is used to determine the max value of the slider, as well as determine how far the user has slid the control.&lt;/p&gt;

&lt;p&gt;In Part 2, I am using the &lt;i&gt;stop&lt;/i&gt; event on the slider. For more information on the jQuery UI slider, check out - &lt;a href="http://jqueryui.com/demos/slider/" title="jQuery Slider" alt="jQuery Slider"&gt;http://jqueryui.com/demos/slider/&lt;/a&gt; . Part 3 takes advantage of the random number that we set earlier and basically just checks that slider's current value has exceeded the random number. Once it has,
we submit the form using jQuery &lt;i&gt;submit();&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;Finally in Part 4, we are setting the max amount that the slider can be - ie. the random number. I decided to use a random number for this because every time the page refreshes it will generate a different number, so writing some dangerous script that could repeatedly run this would be slightly more difficult.&lt;/p&gt;

&lt;p&gt;We have one last thing to do in our controller before this is complete. As this code stands a user could still post to our controller which raises the problem of repeat posting. We can then build an attribute that would be able to look out for this. Enter the ASP.NET MVC AntiForgeryToken. If we add the following code on our view:&lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/AntiForgeryToken.png" title="MVC AntiForgeryToken" alt="MVC AntiForgeryToken" /&gt;

&lt;p&gt;It renders like so:&lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/AntiForgery-Render.png" title="MVC AntiForgeryToken" alt="MVC AntiForgeryToken" /&gt;

&lt;p&gt;So, now we can create our attribute and add it to our HTTPPost method on our controller:&lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/AntiForgeryToken-UrlReferrer.png" title="MVC AntiForgeryToken" alt="MVC AntiForgeryToken" /&gt;

&lt;p&gt;The ValidateAntiForgeryToken Attribute checks to see that the cookie and hidden form field left by the Html.AntiForgeryToken() HtmlHelper essentially exists and match. If they do not exist or match, it throws an HttpAntiForgeryException. Let's try and combine that with a check to see if the UrlReferrer is not null and the UrlReferrer matches this site. If it doesn't match, then we know that the post didn't come from this site - so in this instance it can't be safe.&lt;/p&gt;

&lt;p&gt;And that's it! If someone tries to fake a post to your site instead of going through the controller they will get an error. One of the things to keep in mind with this option is that it is merely an alternative to CAPTCHA and it is something that I have been exploring. This hasn't been fully tested and I can't guarantee that this will keep spammers at bay. Another one of the downfalls of using this is that the user needs to have javascript enabled, but there could be workarounds to that. If you have any other ideas on how to make this option more secure please let me know! This is a very simple screenshot of how this demo would look - it could do with some jazzing up.&lt;/p&gt;

&lt;img src="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/jQuery-Slider.png" title="jQuery Slider" alt="jQuery Slider" /&gt;

&lt;p&gt;For some more information about the ASP.net AntiForgeryToken check out this &lt;a href="http://blog.stevensanderson.com/2008/09/01/prevent-cross-site-request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken-helper/" title="AntiForgeryToken" alt="AntiForgeryToken"&gt;link&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;And some more useful information on &lt;a href="http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html" title="Model Validation" alt="Model Validation"&gt;Brad Wilson's site.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have also created a demo project that you can download:&lt;/p&gt;

&lt;P&gt;&lt;A href="http://c512911.r11.cf3.rackcdn.com/AlternativeCaptcha/AlternativeCaptcha.zip"&gt;&lt;IMG style="WIDTH: 48px; HEIGHT: 47px" border="0" hspace="0" alt="Download" align="absMiddle" src="http://c512615.r15.cf3.rackcdn.com/download.png"&gt;&lt;/A&gt;&amp;nbsp;Download&lt;/P&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=uSzf_730Q0A:XNu4RCldY5g:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/uSzf_730Q0A" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20Experiment%20:%20An%20Alternative%20to%20Captcha/30</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/ffw9Bj6EiHg/29</link><title>ASP.net MVC HTML5 Toolkit</title><description>&lt;p&gt;If you haven't started playing around with HTML5 yet, you should definitely check it out. I've blogged about some of the features of HTML5 before, so if you take a look at this &lt;a href="http://deanhume.com/Home/BlogPost/html5-input-types/25" alt="HTML5 Input Types"&gt;post&lt;/a&gt;, it should give you a fairly idea of what HTML5 is about. &lt;/p&gt;

&lt;p&gt;I try and play around with ASP.net MVC as much as possible and this site is also written in &lt;b&gt;MVC 2&lt;/b&gt;. One of the things that I thought about adding to MVC is the ability to have all the textboxes and controls updated to use &lt;b&gt;HTML5&lt;/b&gt;. One of the great things about HTML5 is that even though some browsers do not currently support it, you will still be able to use it in your web applications and the browser will just handle it as a normal HTML control if it doesn't recognize it.&lt;/p&gt;

&lt;p&gt;So, I've finally got around to creating a proper project and solution for these controls. You can find the project on codeplex at &lt;a href="http://mvchtml5.codeplex.com/" title="ASP.net MVC HTML5 Toolkit" alt="ASP.net MVC HTML5 Toolkit"&gt;http://mvchtml5.codeplex.com/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Getting started&lt;/h2&gt;

&lt;p&gt;Firstly, you need to add a reference in your project. Simply right-click on your project in the solution explorer and select &lt;b&gt;"Add reference"&lt;/b&gt;. Then browse to the location of the System.Web.Mvc.Html5.dll.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/Add-Reference.png" alt="HTML5 Toolkit" title="HTML5 Toolkit"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;Then, you simply call it the same way you would call a normal textbox in your MVC view.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/Html5-Textbox.png" alt="HTML5 Toolkit" title="HTML5 Toolkit"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;There is also added support for &lt;i&gt;Strongly-Typed HTML Helpers &lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/Html5-Textbox-Dynamic.png" alt="HTML5 Toolkit" title="HTML5 Toolkit"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;And any additional html attributes:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/Html5-Attributes.png" alt="HTML5 Toolkit" title="HTML5 Toolkit"&gt;&lt;/img&gt;&lt;/p&gt;

Another great thing about &lt;b&gt;HTML5&lt;/b&gt; is that it offers native support for placeholders - no more need for heavy javascript!

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/HTML5-PlaceHolder.png" alt="HTML5 Placeholder" title="HTML5 Placeholder"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;You can also call the new Html5 Range and Number input types.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/HTML5-Range.png" alt="HTML5 Range" title="HTML5 Range"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/HTML5-Number.png" alt="HTML5 Number" title="HTML5 Number"&gt;&lt;/img&gt;&lt;/p&gt;

And they display like so:

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/HTML5-Range-Display.png" alt="HTML5 Range" title="HTML5 Range"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/HTML5-Number-Display.png" alt="HTML5 Number" title="HTML5 Number"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;p&gt;If you currently use model validation in your controllers, you will be happy to know that this is also supported. So, if you check if your model state and it is not valid, the appropriate CSS will be added in the same way that it currently is with the standard textboxes.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5Toolkit/Model-State.png" alt="MVC Model State" title="MVC Model State"&gt;&lt;/img&gt;&lt;/p&gt;

&lt;h2&gt;Additional Information&lt;/h2&gt;

&lt;p&gt;These are some extra attributes that are also available with this toolkit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Support for Textbox Placeholders&lt;/li&gt;
&lt;li&gt;Support for HTML attributes &lt;/li&gt;
&lt;li&gt;Support for HTML5 Range and Number input types.&lt;/li&gt;
&lt;li&gt;There is also support for the following input types in the toolkit:
Text, Color, Email, Search, Time, Tel, File, Date, Datetime, Month, Week, Range, Number&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In terms of requirements to be able to use this toolkit, you will need:
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Asp.net MVC 2&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;Asp.net 3.5 framework sp1 - download &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7&amp;amp;displaylang=en" alt="Asp.net 3.5 framework sp1 "&gt;here.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you would like to contribute to this project, or you simply find any bugs and would like to report them please let me know.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=ffw9Bj6EiHg:4ckVJd1Oot8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/ffw9Bj6EiHg" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/ASP.net%20MVC%20HTML5%20Toolkit/29</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/rtgsMB7AkxU/28</link><title>Test your MVC routes with Moq</title><description>&lt;p&gt;Routing is a great feature that ships with MVC. The &lt;strong&gt;ASP.NET Routing&lt;/strong&gt; module is responsible for mapping incoming browser requests to particular MVC controller actions. One of the great things about routing in MVC is the ability to rewrite a URL and make it a lot more readable. This is also meant to be better for &lt;strong&gt;SEO&lt;/strong&gt;, but I like that fact the URL's are easy to type and easier to remember. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/MvcRouteTest/route-mvc.jpg" alt="MVC URL Route" title="MVC URL Route" /&gt;&lt;/p&gt;

&lt;p&gt;If you've had a look at an ASP.NET MVC application before you will notice that it handles URL's differently to your standard ASP.NET Webforms. One of the things that I worry about when playing around with the routing is messing up other routes. This is where unit testing comes in very handy.&lt;/p&gt;

&lt;p&gt;A great way to test this would be to use a Mocking framework. I normally use &lt;a href="http://code.google.com/p/moq/"&gt;&lt;b&gt;Moq&lt;/b&gt;&lt;/a&gt;, but you could use any .Net based &lt;strong&gt;mocking framework&lt;/strong&gt;. For this example however, we will stick to &lt;strong&gt;Moq&lt;/strong&gt;. If you haven't worked with Moq before, please take a look at these two other posts that I have written on them &lt;a href="http://deanhume.com/Home/BlogPost/basic-introduction-to-writing-unit-tests-with-moq---part-2/23"&gt;here&lt;/a&gt; and &lt;a href="http://deanhume.com/Home/BlogPost/basic-introduction-to-writing-unit-tests-with-moq/16"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Lets take a look at the default route that is included in our &lt;strong&gt;Global.asax&lt;/strong&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/MvcRouteTest/Map-Route-Default.png"
alt="Global Asax MVC Route Default" title="Global Asax MVC Route Default" /&gt;&lt;/p&gt;

&lt;p&gt;One of the advantages of using &lt;b&gt;Moq&lt;/b&gt; in this instance, is that it allows us to create a fake &lt;strong&gt;HttpContextBase&lt;/strong&gt; and &lt;strong&gt;HttpRequestBase&lt;/strong&gt;. Lets apply this and write a unit test to test this:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/MvcRouteTest/Mvc-Test-Route-Home.png" alt="Global Asax MVC Route Default Test Moq" title="Global Asax MVC Route Default Test Moq" /&gt;&lt;/p&gt;

&lt;p&gt;In the first section (Arrange), we are setting up the fake data that the &lt;strong&gt;HttpContextBase&lt;/strong&gt; should return. Once that is done we tell it to return the route &lt;i&gt;"~/Home/About"&lt;/i&gt;.&lt;/p&gt;

&lt;p&gt;We then get our RouteCollection to return the route data for that HttpContextBase that we have setup. &lt;/p&gt;

&lt;p&gt;And finally, we are checking all the values that are returned to see if they match the Controller, the action and any Id that was passed in. Let's try this same pattern for another route that is a little more complicated. We should be able to test for similar results.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/MvcRouteTest/Map-Route-Product.png" alt="MVC URL Route Global Asax" title="MVC URL Route Global Asax" /&gt;&lt;/p&gt;

&lt;p&gt;In this instance, the route is slightly different. We are also going to add a bit of complexity by adding some parameters.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/MvcRouteTest/Mvc-Test-Route-Product.png" alt="MVC URL Route Test Moq" title="MVC URL Route Test Moq" /&gt;&lt;/p&gt;

&lt;p&gt;Again we are mocking an &lt;strong&gt;HttpContext&lt;/strong&gt; and setting it up to return the route &lt;i&gt;"~/Home/Product/Jeans/2"&lt;/i&gt;. If this were in a controller and we were passing a model to the view, we would expect the view to return a product with an id of 2 - ie a pair of jeans.&lt;/p&gt;

&lt;p&gt;Finally, we can test that the values passed in the URL - &lt;i&gt;"~/Home/Product/Jeans/2"&lt;/i&gt; are getting sent and the routes are getting mapped correctly.&lt;/p&gt;

&lt;p&gt;I hope this helps with any issues you may have had with testing your routes in &lt;strong&gt;MVC&lt;/strong&gt;. It might also be a good idea to run a set of tests against your routes whenever you make any changes! &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=rtgsMB7AkxU:1JyLO4Azcsk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/rtgsMB7AkxU" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Test%20your%20MVC%20routes%20with%20Moq/28</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/WeCwaoBXKJ8/27</link><title>Professional Asp.net Mvc 2 Book Giveaway - Result</title><description>&lt;p&gt;Firstly, I would like to thank everyone that entered the competition and also everyone that contributed by leaving a comment on the blog. There have been a load of great ideas and I will definitely be implementing them on the site. Hopefully you will see these changes over the next few weeks!&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/GiveAway/book-winner.jpg" alt="Professional Asp.net MVC 2 Book Giveaway" title="Professional Asp.net MVC 2 Book Giveaway" /&gt;&lt;/p&gt;

&lt;p&gt;Okay, so in terms of the draw - it took place last night and the lucky winner is Paul Irvine. I hope you enjoy the book and I will be in contact shortly regarding getting the book to you. &lt;/p&gt;

&lt;p&gt;For those of you that didn't win, I still recommend you get yourselves a copy of the &lt;b&gt;Professional Asp.net Mvc 2 Book&lt;/b&gt; as I have one myself and it is a great book if you are keen to learn about &lt;b&gt;Asp.net MVC&lt;/b&gt;! Thanks again to everyone that entered!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=WeCwaoBXKJ8:bEiH9Q48D8Y:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/WeCwaoBXKJ8" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Professional%20Asp.net%20Mvc%202%20Book%20Giveaway%20-%20Result/27</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/_TOkyuANKM4/26</link><title>Professional Asp.net Mvc 2 Book Giveaway</title><description>&lt;p&gt;If you haven't already read &lt;a href="http://www.amazon.com/Professional-ASP-NET-MVC-Jon-Galloway/dp/0470643188"&gt;Professional Asp.net Mvc 2&lt;/a&gt;, you should really check it out. Luckily though, I also have a free copy of this freshly released book to give away. If you are new to Asp.net MVC, this book is a great way to get you up to speed and help you build real world websites with the framework. It is written by a host of great authors such as  Jon Galloway, Phil Haack, Scott Hanselman, Scott Guthrie, and Rob Conery. The book covers pretty much everything you need to be a MVC 2 ninja!&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/GiveAway/profaspnetmvc_.jpg" alt="Asp.net Mvc" title="Asp.net Mvc" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br/&gt;&lt;/p&gt;

&lt;p&gt;So, it's really easy to win this book and there are three ways to win. You can either comment on this thread, you can subscribe to the RSS feed or via email, or you can retweet this page's url. If you comment 
on this thread, please let me know what aspects of this site you would like to see improved, any interesting topics that you would like to see on the site, or just to say hi really! If you aren't already subscribed to the site, you can do so by clicking &lt;a href="http://feeds.feedburner.com/DeanHumesBlog"&gt;here for RSS&lt;/a&gt; and &lt;a href="http://feedburner.google.com/fb/a/mailverify?uri=DeanHumesBlog&amp;amp;loc=en&amp;#95;US"&gt;here for email&lt;/a&gt;. Also, if you comment on this thread please be sure to include a valid email address so that I can get in contact if you win!&lt;/p&gt;

&lt;p&gt;And finally, the winner will be chosen at random on the night of Sunday 01/08/2010.&lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=_TOkyuANKM4:3IQEDwH-7kU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/_TOkyuANKM4" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Professional%20Asp.net%20Mvc%202%20Book%20Giveaway/26</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/TS1H0498uqI/25</link><title>HTML5 Input Types</title><description>&lt;p&gt;If you've been browsing around the web lately, you may have noticed that there has been a lot of hype and attention slowly building around &lt;a href="http://en.wikipedia.org/wiki/HTML5"&gt;Html5&lt;/a&gt;. Now, I didn't really understand it all until I started to take a look at some of the awesome new features that Html5 has. 
At the moment, most modern browsers support Html5, but only a few of them truly take advantage of it's power.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/html5.png" alt="HTML5 Placeholder" title="" /&gt;&lt;/p&gt;

&lt;p&gt;One of the great aspects of Html5 is the new set of input types and how the browser handles them. Now instead of using Javascript or heavy CSS to enable any features, the browser will offer native support. A good example of this would be the placeholder attribute on a textbox. Previously, we would use jQuery or Javascript to accomplish this, but now all you need to do is include this as an attribute on your 
Html.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/placeholder.png" alt="HTML5 Placeholder" title="" /&gt;&lt;/p&gt;

&lt;p&gt;And this is the result:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/colourInput.png" alt="HTML5 Placeholder" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Very cool stuff indeed. So let's say we also wanted to include some validation on our input fields. Let's validate an email address. Just add the attribute type like so:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/imageValidation.png" alt="Html5 Validation" title="" /&gt;&lt;/p&gt;

&lt;p&gt;And a little css to show the validation error:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/css.png" alt="Css" title="" /&gt;&lt;/p&gt;

&lt;p&gt;And the result is the following:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/Validation1.png" alt="Css" title="" /&gt;&lt;/p&gt;

&lt;p&gt;As soon as you enter the correct value it reverts as normal:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/validation2.png" alt="Css" title="" /&gt;&lt;/p&gt;

&lt;p&gt;It's that simple, and this extends to a load of other input types.
For example: search, tel, url, email, datetime, date, month, week, time, datetime-local, number, range and color. Using  the native widgets means you don't need to send the heavy Javascript and CSS required to pull off these widgets, speeding up page load and improving responsiveness. Plus, the new input types look really good a page!&lt;/p&gt;

&lt;p&gt;At the moment, Chrome and Opera and IE (sort of!) are the only browsers to offer native support for these features, although most browsers with new releases should offer support for this very soon. Even if your browser doesn't support it at the moment, you can get your Html ready for when it does as adding these attributes will not have a negative impact at all. If you are running the latest version of Chrome/ Opera / IE at the moment, click on this link and check out some of the cool features that are on offer in &lt;a href="http://c512911.r11.cf3.rackcdn.com/HTML5/html5.html"&gt;HTML5.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Besides the cool input types, there are a load of awesome new features that Html 5 offers that can enhance and speed up your site. Check out this &lt;a href="http://www.html5rocks.com/tutorials/speed/quick/"&gt;link&lt;/a&gt; for more
information.&lt;/p&gt;

&lt;p&gt;Another cool feature that I have started playing with is the Html5 support for audio and video elements. This allows us to easily embed media into HTML documents. Simply add the following tag in your HTML:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/Audio.png" alt="Css" title="" /&gt;&lt;/p&gt;

&lt;p&gt;And Video:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HTML5/video.png" alt="Css" title="" /&gt;&lt;/p&gt;

&lt;p&gt;If you would like to see how your browser fares up with HTML5, run the HTML5 test and see your &lt;a href="http://html5test.com/"&gt;score&lt;/a&gt;. So, get started today using these awesome new features and feel the power of HTML5!&lt;/p&gt;

&lt;p&gt;Some further reading and great sites:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.html5rocks.com"&gt;http://www.html5rocks.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://html5tutorial.net/"&gt;http://html5tutorial.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HTML5 and Css - &lt;a href="http://www.storiesinflight.com/html5/backgrounds.html"&gt;http://www.storiesinflight.com/html5/backgrounds.html&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=TS1H0498uqI:zuJvKpog-LY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/TS1H0498uqI" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/HTML5%20Input%20Types/25</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/2-dIACOlvLo/24</link><title>Compiling LINQ queries for improved performance</title><description>&lt;p&gt;I've been using Linq to Sql for quite a while now, and here and there I have heard of compiling your Linq queries mentioned. Now I know that this feature has been around for a while in terms of .net,
but I have never actually got round to using it. I started to look into it and found out that it is actually really easy, and it really does improve the performance of your query.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/LINQ/Linq.png" /&gt;&lt;/p&gt;

&lt;p&gt;So this is how you would write a standard linq query:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/LINQ/NotCompiled.png" /&gt;&lt;/p&gt;

&lt;p&gt;But if we wanted to compile it, we need to write it slightly differently. First we start off with a func&lt;T&gt; :&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/LINQ/FuncT.png" /&gt;&lt;/p&gt;

&lt;p&gt;And then if we need to call this, we simply do the following:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/LINQ/Compiled.png" /&gt;&lt;/p&gt;

&lt;p&gt;The magic is all in the CompiledQuery.Compile() !&lt;/p&gt;

&lt;h2&gt;Things to consider&lt;/h2&gt;

&lt;p&gt;You may not benefit from precompiling your queries in all circumstances. Bear in mind that a compiled query needs to be run more than once for the compilation and caching to be truly effective. In some circumstances, if you are using a complex query, precompiling might add a little overhead. Overall though, I would definitely still recommend that you compile your LINQ queries to improve your performance. You will definitely notice the results!&lt;/p&gt;

&lt;p&gt;Here are some links I came across whilst researching this topic:-&lt;/p&gt;

&lt;p&gt;Some more information about the positives and negatives of precompiling LINQ queries - 
&lt;a href="http://msdn.microsoft.com/en-us/magazine/ee336024.aspx"&gt;
http://msdn.microsoft.com/en-us/magazine/ee336024.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the MSDN site:- 
&lt;a href="http://msdn.microsoft.com/en-us/library/bb399335.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb399335.aspx&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=2-dIACOlvLo:X8jTeyXnVHg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/2-dIACOlvLo" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Compiling%20LINQ%20queries%20for%20improved%20performance/24</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/-bb-LIxEkz0/23</link><title>Basic introduction to writing unit tests with Moq - Part 2</title><description>&lt;p&gt;This post is the second part of a series on Mocking with Moq. If you haven't already taken a look at the first post on the basics of Moq, please check it &lt;a href="http://www.deanhume.com/Home/BlogPost/basic-introduction-to-writing-unit-tests-with-moq/16"&gt;out&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Moq2/UnitTest.jpg" alt="Unit Test" title="Unit Test" /&gt;&lt;/p&gt;

&lt;p&gt;In this post, I hope to cover some other basic aspects of mocking such as Verifying, Exceptions and strict Mock behaviour. There are a lot of awesome aspects of mocking out there, and I still try and experiment with them as much as possible. In the first post, I talked about the advantages of using mocking to simulate different objects and exceptions that we need to work with. For these examples you will need to have &lt;a href="http://www.nunit.org/"&gt;nUnit&lt;/a&gt; and &lt;a href="http://code.google.com/p/moq/"&gt;Moq&lt;/a&gt; installed. Let take a look at some of these features.&lt;/p&gt;

&lt;h2&gt;Exception Handling&lt;/h2&gt;

&lt;p&gt;Let's say for example you wanted to simulate an exception that your code would throw and you weren't sure how your code would react. This exception might also be a difficult exception to simulate under normal 
circumstances, but with mocking we can throw this easily and test the results.&lt;/p&gt;

&lt;p&gt;Let try an example:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Moq2/exceptionMoq.png" alt="Exception Moq" title="" /&gt;&lt;/p&gt;

&lt;p&gt;In the above code, we are setting up our mock object and telling it exactly what it is going to return. So in this instance we are telling it to throw an ArgumentOutOfRangeException, this could be any exception
that you might want to test, as well as any custom exceptions you may have. It's as simple as that to start testing for exceptions.&lt;/p&gt;

&lt;p&gt;Now we also want to check with nUnit that this exception was actually thrown.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Moq2/exception.png" alt="Exception Moq" title="" /&gt;&lt;/p&gt;

&lt;h2&gt;Verifying&lt;/h2&gt;

&lt;p&gt;Sometimes you might also want to check that a certain method was called, or even how many times that method was called. An easy way to do this is by using the Verify() method.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Moq2/VerifyMoq.png" alt="Verify Moq" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Once you have setup your mock, verifying is an easy task:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Moq2/Verify.png" alt="Verify" title="" /&gt;&lt;/p&gt;

&lt;p&gt;The above code checks that the method GetBasket() was called once. There is also more options to choose 
from when deciding how many times the method was called, such as AtLeast, AtMost, Exactly, Between, etc.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Moq2/Times.png" alt="Moq Times" title="" /&gt;&lt;/p&gt;

&lt;h2&gt;Strict Mock Behaviour&lt;/h2&gt;

&lt;p&gt;When we are initially setting up initializing all our variables and setting up our mock objects, we can also set the mock behaviour of that object. 
For example:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Moq2/behavior.png" alt="Moq Behavior" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Now, if we haven't set up any of the interfaces, Moq will throw a nasty error. If I run my test again with the new strict mock behaviour I get the following error:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Moq.MockException : IBasketDal.GetCustomerName(1) invocation failed with mock behavior Strict. All invocations on the mock must have a corresponding setup.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is because there is another method that I haven't setup correctly. Once the missing method has been setup this will go green!&lt;/p&gt;

&lt;h2&gt;And finally&lt;/h2&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/Moq2/mock.gif" alt="Moq Behavior" title="" /&gt;&lt;/p&gt;

&lt;p&gt;I hope this post has helped a little with understanding more about mocking and using Moq. Hopefully now you will become a master of mocking like &lt;a href="http://en.wikipedia.org/wiki/Nelson&amp;#95;Muntz"&gt;Nelson&lt;/a&gt; above. Again, I've included a project with some of the examples that we run through in this post - &lt;a href="http://c512911.r11.cf3.rackcdn.com/Moq2/MoqTestExample.zip"&gt;download here&lt;/a&gt;. If you are using MS Test, you might want to update the 
project to accordingly.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=-bb-LIxEkz0:LtlHT-0-ZDc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/-bb-LIxEkz0" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Basic%20introduction%20to%20writing%20unit%20tests%20with%20Moq%20-%20Part%202/23</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/dEWN-CJCZ8g/22</link><title>Lazy loading images with jQuery</title><description>&lt;p&gt;Some of the articles written on this site are pretty image intensive and take up a lot of resources when loading up. An awesome way to improve page load times as well as providing a better user experience is to use lazy loading for your site.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/LazyLoad/lazyload.jpg" alt="Homer &amp;amp; Monkey" title="" /&gt;&lt;/p&gt;

&lt;p&gt;There is a excellent jQuery plugin called Lazy Loader which delays the loading of images in long webpages. If you have a blog site like this or a site that has long posts and requires the user to scroll down, this might be a good option for you. Basically, it only loads the images inside the visible part of the page that the user is viewing. You may have already noticed this effect while browsing other sites, or even this &lt;a href="http://deanhume.com/Home/BlogPost/set-up-iis-7-to-run-a-secure-site-locally---https/21"&gt;site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Another good thing about this plugin is that it is really easy to use.
Take a look at this code for example:&lt;/p&gt;

&lt;p&gt;First add the references to jQuery and the plugin.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/LazyLoad/js_ref.png" alt="Javascript References" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Then add the javascript.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/LazyLoad/javascript.png" alt="Javascript" title="" /&gt;&lt;/p&gt;

&lt;p&gt;In order to get the greyed loading effect with your images, you will need to add a 1px grey image placeholder. Add the reference to the image in your code as above.&lt;/p&gt;

&lt;p&gt;On &lt;a href="http://deanhume.com/Home/BlogPost/set-up-iis-7-to-run-a-secure-site-locally---https/21"&gt;this site&lt;/a&gt; there is a good example of a long article that uses lazy loading. If you are building your site for &lt;a href="http://en.wikipedia.org/wiki/Progressive&amp;#95;enhancement"&gt;progressive enhancement&lt;/a&gt;, this will also just not load so the user won't notice anything different.&lt;/p&gt;

&lt;p&gt;Check out the site for more info on this &lt;a href="http://www.appelsiini.net/projects/lazyload"&gt;plugin&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've also included a really simple example project, &lt;a href="http://c512911.r11.cf3.rackcdn.com/LazyLoad/LazyLoaderApp.zip"&gt;check it out&lt;/a&gt;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=dEWN-CJCZ8g:uuWayy8o00s:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/dEWN-CJCZ8g" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Lazy%20loading%20images%20with%20jQuery/22</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/A9POxNGvPcQ/21</link><title>Set up IIS 7 to run a secure site locally - HTTPS</title><description>&lt;p&gt;I've recently been working on a project where I needed to get a development site running using SSL on IIS 7. If its the first time you've done this it can be a little tricky, but IIS 7 has made it super easy to create self signed certificates. You may also need to be able to run your site on IIS locally instead of using cassini, so that you can still debug. These are some of the steps I took to get it up and running:&lt;/p&gt;

&lt;p&gt;If you dont already have IIS installed on your PC, go to Control Panel -&gt; Programs -&gt; Programs and features and select “Turn Windows Features on or off”. Select Internet Information Services. Make sure ASP.NET is 
selected under World Wide Web Services -&gt; Application Development Features.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/IIS%207-Settings.jpg" alt="IIS 7 settings" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Go to Control Panel -&gt; Systems and Security -&gt; Administrative Tools -&gt; 
Internet Information Services (IIS) Manager.&lt;/p&gt;

&lt;p&gt;Select your Computer Name on the left under Connections. Now double click Server Certifcates under IIS group.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/ssl.png" alt="Certificates" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Select Create Self-Signed Certificate from the actions panel. Enter a name for your certificate. A new certificate should be added to the list with the name you just gave it.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/certificate.png" alt="Certificate" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Select a site in the tree view and click Bindings... in the Actions pane.  This brings up the bindings editor that lets you create, edit, and delete bindings for your Web site. Click Add... to add your new SSL binding to the site. Select Bindings from Actions panel. Select Add and then select https for type and select the cerificate you just created for SSL certificate. Select OK. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/bindings.png" alt="bindings" title="" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/sitebinding.png" alt="Site Binding" title="" /&gt;&lt;/p&gt;

&lt;p&gt;The web site should now have 2 bindings, one for *.80 (http) and one for *.443 (https). &lt;/p&gt;

&lt;p&gt;We need to go back to Visual Studio, right-click the Secure Web Site Project and select Properties. Now select the Web tab. For Servers select to use Local IIS Web Server. Set the Project Url to be 
https://localhost (or whatever you have named your website to be in IIS)&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/visualstudio.png" alt="Visual Studio" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Some browsers will display an error page because the self-signed certificate was issued by your computer, not a trusted Certificate Authority (CA). If you just click "Continue to this website", you will
be redirected as normal. &lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/continue.jpg" alt="Continue" title="" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;br/&gt;&lt;/p&gt;

&lt;h2&gt;Enabling 32 bit applications&lt;/h2&gt;

&lt;p&gt;I have also come across this little curveball before:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;System.BadImageFormatException: Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;&lt;b&gt;System.BadImageFormatException: is not a valid Win32 application&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;If you have recently deployed your asp.net application and it used to run perfectly, and then all of a sudden when running in IIS7 you get the above error, you might need to enable 32 bit applications in your application pool.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/appPool.png" alt="App Pool" title="" /&gt;&lt;/p&gt;

&lt;p&gt;Basically, go into your IIS 7 manager console, find the application pool your app is running in, right-click on it, go to Advanced Settings, and change the Enable 32-bit Applications setting to true:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IIS7/32bit.png" alt="32 Bit" title="" /&gt;&lt;/p&gt;

&lt;p&gt; Tada! Hopefully everything should be running again!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=A9POxNGvPcQ:FYi8CqEfsrg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/A9POxNGvPcQ" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Set%20up%20IIS%207%20to%20run%20a%20secure%20site%20locally%20-%20HTTPS/21</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/ZCmH3AQRS2I/20</link><title>MVC Google Maps HtmlHelper - Dynamic Maps</title><description>&lt;p&gt;&lt;P&gt;
&lt;P&gt;I've recently been looking for a MVC helper class for Google maps. I came across &lt;A href="http://blog.aquabirdconsulting.com/?p=49"&gt;this&lt;/A&gt; well written MVC HtmlHelper for static Google maps. Unfortunately I was looking for a helper that was for the dynamic version of Google charts. I needed to be able to add markers on the maps with dynamic text and possibly even images.&lt;/P&gt;
&lt;P&gt;&lt;IMG title="" alt="Google Maps" src="http://c512911.r11.cf3.rackcdn.com/GoogleMaps/google_map.jpg"&gt;&lt;/P&gt;
&lt;P&gt;So, a great way to re-use code in MVC 2 is the Htmlhelper class. I have also &lt;A href="http://deanhume.com/Home/BlogPost/mvc-htmlhelper-for-google-charts/8"&gt;written about this before&lt;/A&gt; where I wrote a Google Charts Htmlhelper. For this example however, I also needed to take advantage of the great way that MVC combines with Javscript to return JSON data.&lt;/P&gt;
&lt;P&gt;First, I wrote a method that would return my JSON data to the client side.&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ActionResult&lt;/SPAN&gt; GetMarkers()&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// This would normally be our call to the Db, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;//else we could populate this&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// with some data as Ive done here.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;MarkerList&lt;/SPAN&gt; markers = GetMarkersObjects();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; Json(markers, &lt;SPAN style="COLOR: #2b91af"&gt;JsonRequestBehavior&lt;/SPAN&gt;.AllowGet);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;I wrote a small Javascript file that will handle the JSON and pass it on to Google and draw the map.&lt;/P&gt;
&lt;P&gt;Incorporating this into a Html helper was pretty easy:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; Draws the map.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;param name="helper"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;The helper.&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;param name="key"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;The key.&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;param name="jsonUrl"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;The json URL.&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;param name="mapWidth"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;Width of the map.&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;param name="mapHeight"&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;Height of the map.&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;returns&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;The html of the map.&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/returns&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; DrawMap(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;HtmlHelper&lt;/SPAN&gt; helper, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; key, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; jsonUrl, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; mapWidth, &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; mapHeight)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;StringBuilder&lt;/SPAN&gt; mapHtml = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;StringBuilder&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Google Maps API Link&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;script src=\"http://maps.google.com/maps"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"?file=api&amp;amp;amp;v=2&amp;amp;amp;sensor=false&amp;amp;amp;key="&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(key);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"\" type=\"text/javascript\"&amp;gt;&amp;lt;/script&amp;gt;"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Hidden value&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;input type=\"hidden\" "&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"id=\"MarkerUrl\" value=\""&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(jsonUrl);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"\" /&amp;gt;"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Map Div&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;div id=\"map\" style=\"width: "&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(mapWidth);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"px; height: "&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(mapHeight);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"px\"&amp;gt;&amp;lt;/div&amp;gt;"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Maps javascript file&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"&amp;lt;script type=\"text/javascript\" "&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;mapHtml.Append(&lt;SPAN style="COLOR: #a31515"&gt;"src=\"/Content/GoogleMapping.js\"&amp;gt;&amp;lt;/script&amp;gt;"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; mapHtml.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;/P&gt;Now when you call the Html you simply need to do the following in your page:
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;&amp;lt;%&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt; Html.DrawMap(&lt;SPAN style="COLOR: #a31515"&gt;"your&amp;#95;api&amp;#95;key&amp;#95;goes&amp;#95;here"&lt;/SPAN&gt;,&lt;SPAN style="COLOR: #a31515"&gt;"/Home/GetMarkers"&lt;/SPAN&gt;,&lt;SPAN style="COLOR: #a31515"&gt;"550"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"400"&lt;/SPAN&gt;)&lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;%&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The first parameter is the API key that you need when accessing Google maps, it's free and easy to sign up for one, just go to &lt;A href="http://code.google.com/apis/maps/signup.html"&gt;http://code.google.com/apis/maps/signup.html&lt;/A&gt;. The second parameter is the location of the JSON service that we need to call to get the data (The name of the method that we wrote in the controller).Finally the third and fourth parameters are the width and height respectively.&lt;/P&gt;
&lt;P&gt;This is how the map will look.&lt;/P&gt;
&lt;P&gt;&lt;IMG title="" alt=Map src="http://c512911.r11.cf3.rackcdn.com/GoogleMaps/map.png"&gt; 
&lt;P&gt;I have created a sample project that you can download, but you will need to get an API key in order for the map to display correctly. There is also a minified version of the Javascript included in the project that you might want to switch to.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://c512911.r11.cf3.rackcdn.com/GoogleMaps/GoogleMaps.zip"&gt;&lt;IMG style="WIDTH: 48px; HEIGHT: 47px" border=0 hspace=0 alt=Download align=absMiddle src="http://c512615.r15.cf3.rackcdn.com/download.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;B&gt;Download&lt;/B&gt;&lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=ZCmH3AQRS2I:-0YaozDn3p8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/ZCmH3AQRS2I" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20Google%20Maps%20HtmlHelper%20-%20Dynamic%20Maps/20</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/Ug9I0_6yXlc/19</link><title>Rich Snippets and Structured Data - RDFa</title><description>&lt;p&gt;&lt;P&gt;I've always been interested in optimizing this site for search engines and trying my best to make this site as efficient as possible. I recently stumbled across a blog post by the &lt;A href="http://googlewebmastercentral.blogspot.com/"&gt;Google webmaster team&lt;/A&gt; that explained a little about rich snippets and how search results are returned when they have been marked up using structured HTML. I was pretty impressed with the way the results showed up.&lt;/P&gt;
&lt;P&gt;&lt;IMG title="" alt="Google Rich Snippets" src="http://c512911.r11.cf3.rackcdn.com/RichSnippets/google_snippets.png"&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG title="" alt="Yahoo SearchMonkey" src="http://c512911.r11.cf3.rackcdn.com/RichSnippets/yahoo_snippets.png"&gt;&lt;/P&gt;
&lt;P&gt;Try some of these other queries and notice how the search results appear:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://search.yahoo.com/search?p=the+simpsons+apples"&gt;Simpsons Apples&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;A href="http://search.yahoo.com/search?p=avila+boston"&gt;Avila Boston&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Both Google and Yahoo provide support for structured data, and I'm sure many more will follow soon (I don't think that Bing supports it just yet). Surprisingly, updating your site is really easy, and all you need is a basic knowledge of HTML.&lt;/P&gt;
&lt;P&gt;You can mark up your structured HTML content in any of three formats:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;microdata 
&lt;LI&gt;microformats 
&lt;LI&gt;RDFa &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;For this site I chose to use RDFa, although you can use any of the three formats and it will be picked up by Google and Yahoo. Below is an example of some of my HTML that I have updated to include RDFa.&lt;/P&gt;
&lt;P&gt;Here is an example of the HTML: &lt;IMG alt=RDFa src="http://c512911.r11.cf3.rackcdn.com/RichSnippets/html.png"&gt;&lt;/P&gt;
&lt;P&gt;Yahoo and Google have testing tools that you can use to check your results. I would say that I prefer the Yahoo version (called SearchMonkey) for now, merely because it offers a much better UI and a lot of work has been put into SearchMonkey. I would still recommend checking your pages in both tools for consistency. Google will probably offer better support for structured HTML soon.&lt;/P&gt;
&lt;P&gt;These are the results for the&amp;nbsp;above&amp;nbsp;page on the SearchMonkey testing tool:&lt;/P&gt;
&lt;P&gt;&lt;IMG title="" alt="Yahoo Search Monkey" src="http://c512911.r11.cf3.rackcdn.com/RichSnippets/yahoo_results.png"&gt;&lt;/P&gt;
&lt;P&gt;And Google rich snippets testing tool:&lt;/P&gt;
&lt;P&gt;&lt;IMG title="" alt="Google Rich Snippets" src="http://c512911.r11.cf3.rackcdn.com/RichSnippets/google_results.png"&gt;&lt;/P&gt;
&lt;P&gt;At the time of this article going live, this site was not included in the Yahoo search results. I have just re-submitted this site to the search engine crawlers again and I am hoping for it to be updated soon. However you can check that the structured HTML is being parsed by the &lt;A href="http://developer.search.yahoo.com/help/objects/news"&gt;search engines&lt;/A&gt;. Try this link (&lt;A href="http://www.deanhume.com/Home/About"&gt;http://www.deanhume.com/Home/About&lt;/A&gt;)&amp;nbsp;in the validate markup section.&lt;/P&gt;
&lt;P&gt;Marking up your data for rich snippets won't affect your page's ranking in search results, and the search engines also don't guarantee that the markup will be included in search results. However, RDFa&amp;nbsp;makes web browsers smarter by giving people more options when viewing a web page, such as adding you to their address book, adding an event to their calendar, getting directions to a place described by RDFa, or searching online bookstores for a book marked up using RDFa. I would definitely recommend using it!&lt;/P&gt;
&lt;P&gt;Here are some useful links to get you started:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://developer.search.yahoo.com/start"&gt;http://developer.search.yahoo.com/start&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.google.com/support/webmasters/bin/answer.py?answer=99170"&gt;http://www.google.com/support/webmasters/bin/answer.py?answer=99170&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://knol.google.com/k/google-rich-snippets-tips-and-tricks#Basic&amp;#95;instructions"&gt;http://knol.google.com/k/google-rich-snippets-tips-and-tricks#Basic&amp;#95;instructions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://rdfa.info/wiki/RDFa&amp;#95;Wiki"&gt;http://rdfa.info/wiki/RDFa&amp;#95;Wiki&lt;/A&gt;&lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=Ug9I0_6yXlc:phav4O4-QhY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/Ug9I0_6yXlc" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Rich%20Snippets%20and%20Structured%20Data%20-%20RDFa/19</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/n0beZrC9XHo/18</link><title>Measuring the Performance of Built-in .Net Classes</title><description>&lt;p&gt;&lt;P&gt;
&lt;P align=left&gt;I've always wondered which built-in .Net classes are faster compared to others. There is a lot of conventional wisdom surrounding certain code classes in .Net and which ones are better to use than others.&amp;nbsp;One thing that I&amp;nbsp;always try and keep in mind when&amp;nbsp;writing code is that&amp;nbsp;different situations have different needs. As I am always keen to learn more about my trade, I decided to write some simple performance tests to see how these different classes&amp;nbsp;compare against one another. Once I got into writing them, I decided to test more and more built in .net operations. &lt;/P&gt;
&lt;P&gt;First off, I wrote a simple class using the .Net&amp;nbsp;Stopwatch Class&amp;nbsp;that would measure and record the time that each operation took to complete.&amp;nbsp;I found this to be a great exercise to learn about these .Net operations and also how to write better, more efficient code. &lt;/P&gt;
&lt;P align=center&gt;&lt;IMG title="" alt="measure performance" src="http://c512911.r11.cf3.rackcdn.com/Performance/measure.jpg"&gt;&lt;/P&gt;
&lt;P&gt;Firstly, I started off by comparing the &lt;EM&gt;For Loop&lt;/EM&gt; and the &lt;EM&gt;Do While Loop&lt;/EM&gt;.&amp;nbsp;The two methods below just add a incremented string to a generic list. This is the code I used:&lt;/P&gt;
&lt;H5&gt;While Loop vs. For Loop&lt;/H5&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;///&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: gray; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;summary&amp;gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; Loops through the list until it &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; reaches a count of 3000.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; WhileLoop()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; list = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; x = 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;do&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;list.Add(&lt;SPAN style="COLOR: #a31515"&gt;"Test"&lt;/SPAN&gt; + x);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;x++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;} &lt;SPAN style="COLOR: blue"&gt;while&lt;/SPAN&gt; (x &amp;lt; 3000);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Then the &lt;EM&gt;For Loop&lt;/EM&gt;:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; Loops through the loop until it reaches a count of 3000&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;///&lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ForLoop()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt; list = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = 0; i &amp;lt; 3000; i++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;list.Add(&lt;SPAN style="COLOR: #a31515"&gt;"Test"&lt;/SPAN&gt; + i);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;Now surprisingly, the while loop was faster in every circumstance that I ran it. I ran them both in different orders, and I also varied the size of the object that I was testing with. I also understand that this is a very simple way of testing, but it&amp;nbsp;basically proves the performance for each of these methods.&amp;nbsp;So far I found this pretty interesting, so next why not test a lambda expression versus a two different kinds of loops. Basically, I wanted to find the quickest way to search through a list. &lt;/P&gt;
&lt;H5&gt;Lambda Expression vs. ForEach Loop vs. For Loop&lt;/H5&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Using a &lt;EM&gt;Lambda Expression:&lt;/EM&gt;&lt;/P&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;populatedList.Find(x =&amp;gt; x == &lt;SPAN style="COLOR: #a31515"&gt;"Test2500"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Using a &lt;EM&gt;ForEach Loop:&lt;/EM&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; findString &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; populatedList)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (findString == &lt;SPAN style="COLOR: #a31515"&gt;"Test2500"&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;
&lt;P&gt;Using&amp;nbsp; a &lt;EM&gt;For Loop:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i = 0; i &amp;lt; ListLoop.Count; i++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (populatedList[i] == &lt;SPAN style="COLOR: #a31515"&gt;"Test2500"&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 10pt" class=MsoNormal align=left&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;IMG border=0 hspace=0 alt="Test Results" align=baseline src="http://c512911.r11.cf3.rackcdn.com/Performance/TestResults.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;So this time, I found a definite difference in speed. The Lambda expression was a lot faster than looping through the list until I found what I wanted. Surprisingly though, using a for loop was quite significantly slower than the Lambda expression. Now I know the difference between these times is very small, but when you use these a lot in an application any small&amp;nbsp;gain in performance&amp;nbsp;can increase exponentially.&lt;/P&gt;
&lt;H5&gt;HashSet&amp;lt;T&amp;gt; vs. List&amp;lt;T&amp;gt;&lt;/H5&gt;
&lt;P&gt;For the next test, I wanted to test the performance of &lt;EM&gt;HashSet&lt;/EM&gt; versus a &lt;EM&gt;Generic List&lt;/EM&gt;. I kinda already knew that a &lt;EM&gt;HashSet&lt;/EM&gt; would be faster because it has been built for high performance operations, but I wanted to see how much faster. &lt;/P&gt;
&lt;P&gt;&lt;IMG border=0 hspace=0 alt="Hash Results" align=baseline src="http://c512911.r11.cf3.rackcdn.com/Performance/HashResults.png"&gt;&lt;/P&gt;
&lt;P&gt;Surprisingly, when I had a small amount of records in my object that I was searching I only really received a small difference between the two. But, when I upped the records from 3000 to 13,000 and then searched through the records I noticed a definite difference. The &lt;EM&gt;HashSet&lt;/EM&gt; was taking 0.0003ms to return results as opposed to the &lt;EM&gt;List&lt;/EM&gt; which took about 0.2148ms. That's quite a difference! &lt;/P&gt;
&lt;H2&gt;Conclusion&lt;/H2&gt;
&lt;P&gt;One thing to bear in mind that there are a lot of factors involved in performance testing something like this, and also times and speed will vary from machine to machine. However, I can draw an overall conclusion based on the facts that these tests proved time and time again that certain classes were faster than the other. I am using Visual Studio 2008 and NUnit to run these tests.&lt;/P&gt;
&lt;P&gt;So to finalize what I observed:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A &lt;EM&gt;While Loop&lt;/EM&gt; is slightly faster than a &lt;EM&gt;For Loop&lt;/EM&gt; when adding to a list. 
&lt;LI&gt;A &lt;EM&gt;HashSet&lt;/EM&gt; is a lot faster than a &lt;EM&gt;Generic List&lt;/EM&gt; (Although it is not always applicable to use a hashset) 
&lt;LI&gt;Using a &lt;EM&gt;Lambda&lt;/EM&gt; expression is a lot faster than searching through a &lt;EM&gt;Generic List&lt;/EM&gt; using a loop.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Also, for more information on Lambda expressions&amp;nbsp;take a look at my other &lt;A href="http://www.deanhume.com/Home/BlogPost/useful-lambda-expressions/14"&gt;post &lt;/A&gt;that I wrote.&lt;BR&gt;If anyone has any suggestions or techniques that they prefer to use then please give me a &lt;A href="http://www.deanhume.com/Home/ContactPage"&gt;shout.&lt;/A&gt;&lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=n0beZrC9XHo:Rn_7JVX4Jvc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/n0beZrC9XHo" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Measuring%20the%20Performance%20of%20Built-in%20.Net%20Classes/18</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/jSdFve5JEGc/17</link><title>Useful SQL Script to generate Countries &amp; US States</title><description>&lt;p&gt;&lt;P&gt;I'm currently working on a project where I need to quickly insert a list of Countries and Us States into a database table. This is not the first time that I've needed to have a useful script handy for this sort of thing. I had a quick look around the net and couldn't find exactly what I needed. So, I've put together two scripts, one to create a table of US States and one to create a table of Countries. &lt;/P&gt;
&lt;P align=center&gt;&lt;IMG border=0 hspace=0 alt=Globe align=baseline src="http://c512911.r11.cf3.rackcdn.com/UsefulScripts/globe.jpg"&gt;&lt;/P&gt;
&lt;P align=left&gt;Download the two scripts:&lt;/P&gt;
&lt;P align=left&gt;Countries - &lt;A href="http://c512911.r11.cf3.rackcdn.com/UsefulScripts/CreateCountries.txt"&gt;here &lt;/A&gt;&lt;BR&gt;US States - &lt;A href="http://c512911.r11.cf3.rackcdn.com/UsefulScripts/CreateUsStates.txt"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;P align=left&gt;If you've got any useful SQL scripts like this please let me know and I'll add it to this list.&lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=jSdFve5JEGc:PFwPWyvpnJs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/jSdFve5JEGc" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Useful%20SQL%20Script%20to%20generate%20Countries%20&amp;%20US%20States/17</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/BBg721mWdvo/16</link><title>Basic Introduction To Writing Unit Tests With moq</title><description>&lt;p&gt;What is mocking? Well....according to Wikipedia it is:&lt;/p&gt;

&lt;p&gt;"In object-oriented programming, mock objects are simulated objects that mimic the behavior of real objects in controlled ways. A computer programmer typically creates a mock object to test the behavior of some other object"&lt;/p&gt;

&lt;p&gt;In short,&amp;nbsp;Mock objects&amp;nbsp;are a great way to simulate an object that we need to work with. Sometimes we may also come across situations or states that are difficult to reproduce. Say for example we need to simulate a network error, or a specific error in our DB, with a mocking framework we can easily do this. Another great thing about mocking frameworks is whatever external data is being used won't be affected. We can simulate a DB call and not affect our DB at all. You can also write a mock for a piece of code that doesnt exist.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img title="" alt="alt text" src="http://c512911.r11.cf3.rackcdn.com/Moq/mock.jpg"&gt;&lt;/p&gt;

&lt;h2&gt;Why use Mocks&lt;/h2&gt;

&lt;p&gt;When writing unit tests, we only need to write tests that cover a specific area of code. The code under test or &lt;em&gt;class under test&lt;/em&gt;&amp;nbsp;may interact with other classes or external systems, but we only need to isolate the class that we are working with. Enter a mocking framework, this makes it a lot easier for us to re-use our mock objects and write great unit tests.&lt;/p&gt;

&lt;p&gt;When I first started to get into TDD, it took me a while to get my head around mocking. Personally I feel that Moq is a really easy framework to use. That said, there are loads of other frameworks out there &lt;link&gt;. For this example (and also because I have only worked with this framework), I'm going to use the Moq framework &lt;link&gt;&lt;/p&gt;

&lt;h2&gt;Implementation&lt;/h2&gt;

&lt;p&gt;Moq is an open source framework and has adopted an API that tries to be both simple to learn and easy to use. The API also follows the arrange-act-assert style and relies heavily on .NET 3.5 features, such as lambdas and extension methods. The learning curve is quite easy, but you need to feel comfortable with using lambdas. &lt;br&gt;&lt;br&gt;Let's say we need to mock the data layer for our example project. &lt;br&gt;&lt;br&gt;First, lets set up our mock that we are going to use. &lt;br&gt;&lt;br&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;var&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; _mock = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;Mock&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;IBasketDal&lt;/span&gt;&amp;gt;();&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Then we need to tell this mock what its going to do, and what it will return &lt;/p&gt;

&lt;p style="MARGIN: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;#95;mock.Setup(x =&amp;gt; x.GetCustomerTotal(&lt;span style="COLOR: #2b91af"&gt;It&lt;/span&gt;.IsAny&amp;lt;&lt;span style="COLOR: blue"&gt;int&lt;/span&gt;&amp;gt;())).Returns(25.5);&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;In the above line of code, we are telling the framework to pass in any variable into the &lt;em&gt;GetCustomerTotal&lt;/em&gt; method, and we are telling this method to return a value of&amp;nbsp; &lt;em&gt;22&lt;/em&gt;. In this way, we never hit the database - our mock will intercept and tell the method to return the result that we chose. This way, we can test for certain scenarios easily. We don't have to mess with the data to get a certain circumstance to work, we just tell it what we want it to do! Simples! &lt;br&gt;&lt;br&gt;We call our method and check that the result returned is correct. &lt;br&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;br&gt;DataAccess.&lt;span style="COLOR: #2b91af"&gt;Basket&lt;/span&gt; totals = _target.CalculateBasketTotals(1);&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;Assert&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;.That(totals.Total, &lt;span style="COLOR: #2b91af"&gt;Is&lt;/span&gt;.EqualTo(25.5), &lt;span style="COLOR: #a31515"&gt;"The basket totals did not add up correctly"&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;As you can see using a mocking framework is a great way to go about TDD. I hope this tutorial helped a bit with understanding the basics of writing mocks using Moq. It is a very basic introduction to Moq, but for more info please check out the website for more information.&lt;br&gt;&lt;br&gt;&lt;a href="http://www.clariusconsulting.net/labs/moq/index.html"&gt;Moq Details&lt;/a&gt; &lt;br&gt;&lt;a href="http://code.google.com/p/moq/"&gt;Google repository&lt;/a&gt; &lt;br&gt;&lt;a href="http://www.clariusconsulting.net/blogs/kzu/archive/2008/03/17/WhydoweneedyetanotherNETmockingframework.aspx"&gt;Clarius Consulting&lt;/a&gt; &lt;br&gt;&lt;a href="http://stephenwalther.com/blog/archive/2008/06/12/tdd-introduction-to-moq.aspx"&gt;Introduction to moq&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;
&lt;/p&gt;&lt;p&gt;Ive included a small demo project to go along with this &lt;a href="http://c512911.r11.cf3.rackcdn.com/Moq/MoqTestExample.zip"&gt;post.&lt;/a&gt;&amp;nbsp;In order to run this project, you will need to install nUnit and moq. You could also eaily adapt this to run with another testing framework.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=BBg721mWdvo:cnYs8wdR4Pc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/BBg721mWdvo" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Basic%20Introduction%20To%20Writing%20Unit%20Tests%20With%20moq/16</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/vClC3hak3aM/15</link><title>Postmark - Email delivery for web apps</title><description>&lt;p&gt;&lt;P&gt;I recently stumbled across the following &lt;A href="http://wildbit.com/"&gt;site&lt;/A&gt; and looked at some of their applications that they have on offer. One of the great tools that they offer is a tool called Postmark. Postmark helps deliver and track transactional emails. The service basically replaces using SMTP, and allows you to send mails and track statistics for emails sent, bounces and spam complaints. Its pretty awesome if you are a blogger like myself and need to track your emails easily and with less cost.&lt;/P&gt;
&lt;P&gt;&lt;IMG title="" alt="alt text" src="http://c512911.r11.cf3.rackcdn.com/Postmark/postmark.png"&gt;&lt;/P&gt;
&lt;P&gt;At the moment it is still currently in beta, although you can request and invite to start playing around with at this stage. It has full support for .Net as well as Ruby, Php, and Python among others. There is currently a &lt;A href="http://github.com/lunarbits/postmark-dotnet"&gt;github directory&lt;/A&gt; to download the .Net support library from. Another great feature of Postmark is that it has support for JSON.&lt;/P&gt;
&lt;P&gt;Postmark removes the setup and server maintenance that would normally be associated with setting up something like this. Check it &lt;A href="http://postmarkapp.com/"&gt;out&lt;/A&gt;. There is also some more info on their &lt;A href="http://wildbit.com/blog/2009/10/21/announcing-postmark-email-delivery-in-the-cloud/"&gt;blog&lt;/A&gt; &lt;/P&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=vClC3hak3aM:zxL9_32oVg0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/vClC3hak3aM" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Postmark%20-%20Email%20delivery%20for%20web%20apps/15</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/lpYa3FDp6Eg/14</link><title>Useful Lambda Expressions</title><description>&lt;P&gt;A really useful built in feature of .Net is the Lambda expression. I've been using these for a while, but until I started looking into it, I never realized how useful these can actually be. There are loads of quick, nifty ways to get things done that might take twice as long if not using a lambda expression.&lt;/P&gt;
&lt;P&gt;All lambda expressions use the lambda operator =&amp;gt;, which is read as "goes to". Sometimes these expressions look a little confusing, but once you understand the general use they are quite easy to read.&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG border=0 hspace=0 alt=Lambda align=baseline src="http://c512911.r11.cf3.rackcdn.com/Lambda/lambda.jpg"&gt;&lt;/P&gt;
&lt;P align=left&gt;Lets take a look at how we traditionally found an item in a generic list:&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Car&lt;/SPAN&gt;&amp;gt; carColours = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Car&lt;/SPAN&gt;&amp;gt;();&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;foreach&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; (&lt;SPAN style="COLOR: #2b91af"&gt;Car&lt;/SPAN&gt; car &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; carColours)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (car.Colour&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;== &lt;SPAN style="COLOR: #a31515"&gt;"red"&lt;/SPAN&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; car.Colour;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P align=left&gt;The above code works, but lets try and make this sexy with a Lambda expression:&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Car&lt;/SPAN&gt;&amp;gt; carColours = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Car&lt;/SPAN&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;carColours.FirstOrDefault(car =&amp;gt; car.Colour == &lt;SPAN style="COLOR: #a31515"&gt;"Red"&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P align=left&gt;
&lt;P align=left&gt;So, let me explain the code above. Im using the lambda expression to search the list for the first value that has a colour of &lt;EM&gt;Red. &lt;/EM&gt;In one line, I can now do what previously took me four. I also find that this is a lot easier to read. Here are some other useful expressions to use :-&lt;/P&gt;
&lt;P align=left&gt;&lt;STRONG&gt;1. Populate a new list with values that match&lt;BR&gt;&lt;/STRONG&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;BR&gt;List&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Car&lt;/SPAN&gt;&amp;gt; matches = carColours.FindAll(val =&amp;gt; val.Colour != &lt;SPAN style="COLOR: #a31515"&gt;"Red"&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P align=left&gt;&lt;STRONG&gt;2. Another example of getting values from a list&lt;/STRONG&gt;&lt;BR&gt;&lt;BR&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; weightLessThanSix = carColours.TakeWhile(n =&amp;gt; n.Weight &amp;lt; 6);&lt;BR&gt;&lt;BR&gt;&lt;/SPAN&gt;We could supply multiple parameters and return all numbers until a number is encountered whose value is less than its position.&lt;BR&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;BR&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; matches = carColours.TakeWhile((n, index) =&amp;gt; n.Weight &amp;gt;= index);&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P align=left&gt;&lt;STRONG&gt;3. Say for example I wanted to provide a cleaner way to declare a event handler.&lt;/STRONG&gt;&lt;BR&gt;&lt;BR&gt;This was the traditional way:&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; CreateControls()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DropDownList1.SelectedIndexChanged += &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;EventHandler&lt;/SPAN&gt;(DropDownList1_SelectedIndexChanged);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; DropDownList1_SelectedIndexChanged(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// Do something&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P align=left&gt;Which now becomes - &lt;BR&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;BR&gt;public&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; CreateControlsLambda()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;DropDownList1.SelectedIndexChanged += (sender, e) =&amp;gt; { Button1.Text = &lt;SPAN style="COLOR: #a31515"&gt;"Event Fired"&lt;/SPAN&gt;; };&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P align=left&gt;
&lt;P align=left&gt;Much slicker!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P align=left&gt;&lt;STRONG&gt;4. Find the lowest or highest value in a list&lt;/STRONG&gt;&lt;BR&gt;&lt;BR&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;decimal&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; maxWeight = cars.Max(car =&amp;gt; car.Weight);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;decimal&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; minWeight = cars.Min(car =&amp;gt; car.Weight);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;o:p&gt;Or the weight between a range&lt;BR&gt;&lt;BR&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;o:p&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;decimal&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; weightBetween = cars.FirstOrDefault(car =&amp;gt; car.Weight &amp;lt; 9.0m).Weight;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/o:p&gt;
&lt;P align=left&gt;
&lt;P align=left&gt;As you can see, using lambda expressions&amp;nbsp;can make your code a lot slicker and more readable. Some of the examples I have given are only really the tip of the iceberg when it comes to working with lambda expressions. If you have any examples that could be useful or any suggestions, please let me &lt;A href="http://deanhume.com/Home/ContactPage"&gt;know &lt;/A&gt;and I'll add it to this list.&lt;/P&gt;
&lt;P align=left&gt;For some further reading check out:&lt;/P&gt;
&lt;P align=left&gt;&lt;A href="http://blogs.msdn.com/ericwhite/pages/Lambda-Expressions.aspx"&gt;http://blogs.msdn.com/ericwhite/pages/Lambda-Expressions.aspx&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb397687.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb397687.aspx&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://www.informit.com/articles/article.aspx?p=1245158&amp;amp;seqNum=4"&gt;http://www.informit.com/articles/article.aspx?p=1245158&amp;amp;seqNum=4&lt;/A&gt;&lt;/P&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=lpYa3FDp6Eg:Eq01aumGF5c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/lpYa3FDp6Eg" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Useful%20Lambda%20Expressions/14</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/-M_N-xR11uE/13</link><title>Rendering a Usercontrol as a String for Webservices</title><description>&lt;p&gt;I am currently working a project at work that requires us to use progressive enhancement so that our site is accessible to all users regardless of whether they have javascript enabled. One of the issues that we came across was keeping only one version of the html that we needed to use, regardless whether we were rendering our HTML client side or server side. &lt;/p&gt;
&lt;p&gt;That way, we only ever had one version of the HTML and this also allowed us to use the same usercontrol server side. This also makes it easier for us to maintain the code.We decided to use usercontrols and just render them as a string to the client side, it is a sneaky approach but it seems to be working nicely. &lt;/p&gt;
&lt;p align="center"&gt;&lt;img border="0" hspace="0" alt="Spanner" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/RenderControl/spanner.jpg" width="462" height="295"&gt;&lt;/p&gt;
&lt;p&gt;In order to render your user control as a string, simply do the following. &lt;/p&gt;&lt;font size="2"&gt;
&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; RenderViewDdl(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; path, &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;List&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;lt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;gt; data)&lt;br&gt;{&lt;br&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Page&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; pageHolder = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Page&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;();&lt;br&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ctlUserControl&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; viewControl = (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;ctlUserControl&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)pageHolder.LoadControl(path);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;viewControl.Data = data;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pageHolder.Controls.Add(viewControl);&lt;br&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringWriter&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; output = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;StringWriter&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;();&lt;br&gt;&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpContext&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Current.Server.Execute(pageHolder, output, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;br&gt;&lt;br&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; output.ToString();&lt;br&gt;}&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;
&lt;p&gt;There is also a public variable on the usercontrol that allows you to set the data to display using these lines.&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;partial&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;ctlUserControl&lt;font size="2"&gt; &lt;/font&gt;&lt;/span&gt;: System.Web.UI.UserControl&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;i&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&amp;lt;string&amp;gt; Data;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR: blue"&gt;protected&lt;/span&gt; &lt;span style="COLOR: blue"&gt;void&lt;/span&gt; Page_Load(&lt;span style="COLOR: blue"&gt;object&lt;/span&gt; sender, &lt;span style="COLOR: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddlItems.DataSource = Data;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ddlItems.DataBind();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: Consolas; FONT-SIZE: 8pt"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Arial','sans-serif'; COLOR: #1f497d; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;&lt;p&gt;While working on this, one of my colleagues (Mr. Robin Osborne - thanks Robin!), came across an error while trying to render a usercontrol with an asp.net server side control (For example a drop down list). &lt;/p&gt;
&lt;p&gt;This is the following error he received:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;System.Web.HttpException: Error executing child request for handler System.Web.UI.Page'. ---&amp;gt; System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---&amp;gt; System.Web.HttpException: Control 'ctl00_ddlCities' of type 'DropDownList' must be placed inside a form tag with runat=server.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;1. In order to solve this problem, generate a new “page” class that inherits System.Web.UI.Page and overrides VerifyRenderingInServerForm to do nothing:&lt;br&gt;&lt;br&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;class&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;PageOverride&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; : System.Web.UI.&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Page&lt;br&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;{&lt;br&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&amp;nbsp; public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;override&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; VerifyRenderingInServerForm(System.Web.UI.&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Control&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; control)&lt;br&gt;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;2. When creating your Page holder, use the new page (PageOverride) instead of Page in your rendering:&lt;br&gt;&lt;br&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;Page&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; pageHolder = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;ctlUserControl&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;PageOverride&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;();&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;
&lt;/font&gt;&lt;p&gt;This is sneaky and it works like a charm! I've included a small project that show this in action.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://c512911.r11.cf3.rackcdn.com/RenderControl/WebServices.zip"&gt;&lt;img style="WIDTH: 48px; HEIGHT: 47px" border="0" hspace="0" alt="Download" align="absMiddle" src="http://www.deanhume.com/content/images/download.png"&gt;&lt;/a&gt;&amp;nbsp;Download&lt;/p&gt;
&lt;p&gt;Further reading&lt;br&gt;&lt;a href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript"&gt;http://en.wikipedia.org/wiki/Unobtrusive_JavaScript&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://stevesmithblog.com/blog/render-control-as-string/"&gt;http://stevesmithblog.com/blog/render-control-as-string/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://jamesewelch.wordpress.com/2008/07/11/how-to-render-a-aspnet-user-control-within-a-web-service-and-return-the-generated-html/"&gt;http://jamesewelch.wordpress.com/2008/07/11/how-to-render-a-aspnet-user-control-within-a-web-service-and-return-the-generated-html/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx&lt;/a&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/"&gt;http://encosia.com/2008/02/05/boost-aspnet-performance-with-deferred-content-loading/&lt;/a&gt;&lt;br&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=-M_N-xR11uE:mrBcQZ5PZ5E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/-M_N-xR11uE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Rendering%20a%20Usercontrol%20as%20a%20String%20for%20Webservices/13</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/r4IWj2EvS90/12</link><title>Improving the performance of your MVC application</title><description>&lt;p&gt;In the constant quest to deliver faster, slicker websites it is important to try and improve the&amp;nbsp;users experience. This could include improving the page load speed, smooth navigation or page accessibility.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p style="text-align: center;"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/PageSpeed/speed.png"&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;While working on this site, I have tried to improve page loading speeds as much as possible. There&amp;nbsp;are a lot of tricks that you can do to improve the speed of your site. I have constantly been learning new&amp;nbsp;things by delving into the world of site performance.&lt;/p&gt;&lt;p&gt;These are a few of the steps that I took to speed up my site.&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Caching the Datalayer&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I would say that for this site, caching the data layer has improved my site speed the most.&amp;nbsp;By using the built in caching option that comes with ASP.net it is really easy to do this.&amp;nbsp;Check out this &lt;a href="http://msdn.microsoft.com/en-us/library/aa478965.aspx"&gt;link &lt;/a&gt;for more info.&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Output Caching&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Output caching is another way to greatly increase the speed of your mvc application.&amp;nbsp;It greatly cuts back on the amount of work your application has to do, and I've definitely noticed&amp;nbsp;a big increase in speed since adding this to my site.&lt;/p&gt;&lt;p&gt;By adding:&lt;/p&gt;&lt;p&gt;[OutputCache(Duration = 86400, VaryByParam = "None")]&lt;/p&gt;&lt;p&gt;Check out this &lt;a href="http://www.asp.net/learn/mvc/tutorial-15-cs.aspx"&gt;link &lt;/a&gt;for more details&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Minify Js &amp;amp; CSS&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Minification involves removing unnecessary characters from code to reduce its size. This reduction in&amp;nbsp;size greatly improves load times. There are some great tools out there to use - JSMin, YUI Compressor, etc.&lt;/p&gt;&lt;p&gt;There are also loads of articles out there on how to minify your JS and CSS.&amp;nbsp;If you need a bit of help, I have written a custom T4 template to do this on this &lt;a href="http://deanhume.com/Home/BlogPost/minify-javascript-files-automatically-with-a-t4-template/6"&gt;site&amp;nbsp;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Gzip Compress&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;I have tried to use Gzip compression as much as possible on this site. This is an awesome &lt;a href="http://weblogs.asp.net/rashid/archive/2008/03/28/asp-net-mvc-action-filter-caching-and-compression.aspx"&gt;article&lt;/a&gt; that allows you to easily&amp;nbsp;do this on an MVC site with the use of MVC attributes.&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Use a Content Delivery Network&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Serving your content from multiple worldwide servers allows much faster loads time on the user's side. These servers can be used to cache and deliver all types of content. On this site I am using the&amp;nbsp;Google CDN to load my jQuery API. To do this, you simply need to replace your local version of jQuery with the one on the CDN:&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Google has support for loads of different javascript &lt;a href="http://code.google.com/apis/ajaxlibs/documentation/"&gt;libraries&lt;/a&gt;.&amp;nbsp;Microsoft also offers &lt;a href="http://weblogs.asp.net/scottgu/archive/2009/09/15/announcing-the-microsoft-ajax-cdn.aspx"&gt;Microsoft AJAX CDN&lt;/a&gt;, which service you choose to go with is all up to you.&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;u&gt;Combine Resources&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Combining your resources into one file is another way to speed up your site.&amp;nbsp;After some searching I came across this &lt;a href="http://combres.codeplex.com"&gt;library &lt;/a&gt;called Combres for MVC.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have recently added this functionality to my site and I'm giving it a trial run, but so far I have&amp;nbsp;noticed decent results on different page speed analyzers. I might just keep it in there!&lt;/p&gt;&lt;p&gt;After updating the code as much as possible and following these rules, these are the before and after screen shots of the site speed.&lt;/p&gt;&lt;p&gt;Before:&lt;/p&gt;&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/PageSpeed/before.png"&gt;&lt;/p&gt;&lt;p&gt;After:&lt;/p&gt;&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/PageSpeed/after.png"&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Its still not perfect, but as you can see this is a much better result.&lt;/p&gt;&lt;p&gt;Most of these techniques could also be used on sites that are not MVC sites. If you are a Firefox user, I recommend downloading and installing&amp;nbsp;the page speed &lt;a href="http://code.google.com/speed/page-speed/"&gt;plugin&lt;/a&gt;. It is a great tool to help you identify areas in your site that need speeding up.&amp;nbsp;&lt;/p&gt;&lt;p&gt;If you have any suggestions or tips that you would like to add to this, please drop me a mail. I am always&amp;nbsp;keen to learn new techniques.&lt;/p&gt;&lt;p&gt;While working on this site, these are some of the links I picked up along the way:&lt;/p&gt;&lt;p&gt;&lt;a href="http://codeclimber.net.nz/archive/2009/04/17/how-to-improve-the-performances-of-asp.net-mvc-web-applications.aspx"&gt;http://codeclimber.net.nz/archive/2009/04/17/how-to-improve-the-performances-of-asp.net-mvc-web-applications.aspx&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://developer.yahoo.com/performance/rules.html"&gt;http://developer.yahoo.com/performance/rules.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163854.aspx#S10"&gt;http://msdn.microsoft.com/en-us/magazine/cc163854.aspx#S10&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=r4IWj2EvS90:0-o5LPaY7y0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/r4IWj2EvS90" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Improving%20the%20performance%20of%20your%20MVC%20application/12</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/kjzB_CQrFnE/11</link><title>Developing Applications for Windows 7</title><description>&lt;p&gt;I've just got my hands on a shiny new computer, maxed out with new RAM and Windows 7.&lt;br&gt;So far I am very impressed with Windows 7, although it looks pretty similar to Vista, its a lot slicker and I can't really seem to find&amp;nbsp;any faults just yet.&amp;nbsp;I also find developing a breeze as it seems a lot smoother when building larger solutions in Visual Studio.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img border="0" hspace="0" alt="Windows 7" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/Windows7/windows7.png"&gt;&lt;/p&gt;

&lt;p&gt;So, as with any new toy I decided it was time to get playing. I searched around and&amp;nbsp;got my hands on the Windows 7 &lt;a href="http://code.msdn.microsoft.com/WindowsAPICodePack"&gt;API code pack&lt;/a&gt;. There are some awesome new features in Windows 7, and this pack gives you access them. Jump Lists, Icon Overlay, Progress Bar, Tabbed Thumbnails, and Thumbnail Toolbars just to name a few. First off I started to look at Jump Lists. To open a Jump List, just right-click a program icon on the Windows 7 taskbar.&lt;/p&gt;

&lt;p&gt;You can easily create these for your application and you can customize them too. There are&lt;br&gt;a few apps out there that take advantage of this, check out Google's Chrome for Example. &lt;/p&gt;

&lt;p align="center"&gt;&lt;img alt="Jump List" src="http://c512911.r11.cf3.rackcdn.com/Windows7/jumplist.png"&gt;&lt;/p&gt;

&lt;p&gt;Right, lets get started with our app. First we need to add a reference to the &lt;br&gt;Microsoft.WindowsAPICodePack and the Microsoft.WindowsAPICodePack.Shell&lt;/p&gt;

&lt;p&gt;If we want to create jump lists in an application add the following lines of code:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"&gt;&lt;span style="font-size:
10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:green;mso-no-proof:yes"&gt;// Create the
Category&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"&gt;&lt;span style="font-size:
10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:#2B91AF;mso-no-proof:yes"&gt;JumpListCustomCategory&lt;/span&gt;&lt;span style="font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes"&gt;
customCategory = &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2B91AF"&gt;JumpListCustomCategory&lt;/span&gt;(&lt;span style="color:#A31515"&gt;"Resources"&lt;/span&gt;);&lt;br&gt;&lt;br&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"&gt;&lt;span style="font-size:
10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:#2B91AF;mso-no-proof:yes"&gt;JumpList&lt;/span&gt;&lt;span style="font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes"&gt; jumpList =
&lt;span style="color:#2B91AF"&gt;JumpList&lt;/span&gt;.CreateJumpList();&lt;br&gt;jumpList.AddCustomCategories(customCategory);&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 128, 0); font-family: 'Courier New'; font-size: 13px; "&gt;// Create the
link to open&lt;br&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; "&gt;&lt;span style="font-size:
10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:blue;mso-no-proof:yes"&gt;string&lt;/span&gt;&lt;span style="font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes"&gt;
systemFolder = &lt;span style="color:#2B91AF"&gt;Environment&lt;/span&gt;.GetFolderPath(&lt;span style="color:#2B91AF"&gt;Environment&lt;/span&gt;.&lt;span style="color:#2B91AF"&gt;SpecialFolder&lt;/span&gt;.System);&lt;br&gt;&lt;br&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "&gt;&lt;span style="font-size:
10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:#2B91AF;mso-no-proof:yes"&gt;JumpListLink&lt;/span&gt;&lt;span style="font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes"&gt;
taskManager = &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2B91AF"&gt;JumpListLink&lt;/span&gt;(&lt;span style="color:#2B91AF"&gt;Path&lt;/span&gt;.Combine(systemFolder, &lt;span style="color:
#A31515"&gt;"taskmgr.exe"&lt;/span&gt;), &lt;span style="color:#A31515"&gt;"Task
Manager"&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 128, 0); font-family: 'Courier New'; font-size: 13px; "&gt;&lt;br&gt;// Add the link
to the jumplist&lt;br&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;jumpList.AddUserTasks(taskManager);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"&gt;&lt;span style="font-size:
10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes"&gt;&lt;span style="color:green"&gt;// Refresh the jump list&lt;br&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;jumpList.Refresh();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;The above code creates a category called Resources and a link under the category that points to the Windows Task Manager. Your jumplist can be customized to include any links you need or anything that enhances the users experience. Next, I wanted to take a look at overlay icons on the taskbar. Icon overlays are small images placed at the lower-left corner of the icon that represents a Shell object. They are normally added to an object's icon to provide some extra information.&lt;/p&gt;&lt;p&gt;In order to use overlay icons you need to add the following lines of code:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:
normal;mso-layout-grid-align:none;text-autospace:none"&gt;&lt;span style="font-size:
10.0pt;font-family:&amp;quot;Courier New&amp;quot;;color:#2B91AF;mso-no-proof:yes"&gt;StockIcon&lt;/span&gt;&lt;span style="font-size:10.0pt;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:yes"&gt; stockIcon
= &lt;span style="color:blue"&gt;new&lt;/span&gt; &lt;span style="color:#2B91AF"&gt;StockIcon&lt;/span&gt;(&lt;span style="color:#2B91AF"&gt;StockIconIdentifier&lt;/span&gt;.Error, &lt;span style="color:
#2B91AF"&gt;StockIconSizes&lt;/span&gt;.ShellSize, &lt;span style="color:blue"&gt;false&lt;/span&gt;,
&lt;span style="color:blue"&gt;false&lt;/span&gt;);&lt;br&gt;&lt;br style="mso-special-character:line-break"&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10.0pt;line-height:115%;font-family:
&amp;quot;Courier New&amp;quot;;color:#2B91AF;mso-no-proof:yes"&gt;TaskbarManager&lt;/span&gt;&lt;span style="font-size:10.0pt;line-height:115%;font-family:&amp;quot;Courier New&amp;quot;;mso-no-proof:
yes"&gt;.Instance.SetOverlayIcon(stockIcon.Icon, &lt;span style="color:#A31515"&gt;""&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;I recommend downloading the Windows API code pack and having a look at the samples provided, they cover everything you need to know and have some pretty easy to follow examples. The API pack also has support for sensors and power management, so it's pretty cool if your PC has these capabilites built in. The pack also contains loads of other samples that will help you take advantage of the new features in Windows 7.&lt;/p&gt;&lt;p&gt;I've included a small solution file that showcases the different features that I've written about&lt;br&gt;in this post. It's not really a fully complete project, but it's a good start to get you developing with Windows 7 and WPF.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://c512911.r11.cf3.rackcdn.com/Windows7/Windows7Dev.zip"&gt;&lt;img style="WIDTH: 48px; HEIGHT: 47px" border="0" hspace="0" alt="Download" align="absMiddle" src="http://c512615.r15.cf3.rackcdn.com/download.png"&gt;&lt;/a&gt;&amp;nbsp;&lt;b&gt;Download&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;For further reading check out these sites:&lt;br&gt;&lt;a href="http://www.developer.com/net/article.php/3846211/Take-advantage-of-the-Windows-7-TaskBar-in-your-next-project.htm"&gt;http://www.developer.com/net/article.php/3846211/Take-advantage-of-the-Windows-7-TaskBar-in-your-next-project.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.codeguru.com/csharp/.net/net&amp;#95;general/tipstricks/article.php/c16621/"&gt;http://www.codeguru.com/csharp/.net/net&amp;#95;general/tipstricks/article.php/c16621/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2009/02/16/windows-7-taskbar-overlay-icons-and-progress-bars.aspx"&gt;http://blogs.microsoft.co.il/blogs/sasha/archive/2009/02/16/windows-7-taskbar-overlay-icons-and-progress-bars.aspx&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=kjzB_CQrFnE:Z2o_HCpY924:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/kjzB_CQrFnE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Developing%20Applications%20for%20Windows%207/11</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/ewMVBuCpVuE/10</link><title>Toastify - Hotkeys for Spotify</title><description>Toastify is a great little app that allows you to add&amp;nbsp;hot-keys&amp;nbsp;to Spotify. If you haven't already heard of &lt;a href="http://www.spotify.com/en/help/faq/#about-spotify"&gt;Spotify&lt;/a&gt;, it is a streaming player that allows you to listen to music for free.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: center;"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/General/toastify.jpg"&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I've been looking for a way to add&amp;nbsp;hot-keys&amp;nbsp;to&amp;nbsp;Spotify&amp;nbsp;for ages, and came across this slick application. It's written in C# and WPF.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;From the site:&lt;/div&gt;&lt;div&gt;&lt;i&gt;Toastify adds some missing functionallity to the Spotify client (Windows only). It shows a popup, toast style, dialog on track change and it allows you to use global hot keys for Play/Pause, Next, Previous etc.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;It is fully configurable and uses an XML file to set the&amp;nbsp;hot-keys. Although the keys that it comes with by default are pretty handy.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Check it &lt;a href="http://toastify.codeplex.com/"&gt;out&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=ewMVBuCpVuE:wvHDIEnUn0Y:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/ewMVBuCpVuE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Toastify%20-%20Hotkeys%20for%20Spotify/10</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/4toXGXABjM4/9</link><title>Vote for your favourite .NET DI (IoC) Framework</title><description>&lt;p&gt;I've started to take a look at &lt;strong&gt;Dependency Injection Containers&lt;/strong&gt; (IoC), mostly because we have started using them where I work and also just out of general interest and trying to get my mind around how they work.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/IOC/inject.jpg" alt="Dependency Injection" title=""&gt;&lt;/p&gt;

&lt;p&gt;From Wikipedia: &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Inversion of control, or IoC, is an abstract principle describing an
  aspect of some software architecture designs in which the flow of
  control of a system is inverted in comparison to procedural
  programming. In traditional programming the flow is controlled by a
  central piece of code. Using Inversion of Control this central control
  as a design principle is left behind. Although the caller will
  eventually get its answer, how and when is out of control of the
  caller. It is the callee who decides how and when to answer. The
  principle of Inversion of Control is also known as the Hollywood
  Principle. Inversion of Control as a design guideline serves the
  following purposes:&lt;/p&gt;
  
  &lt;ol&gt;
  &lt;li&gt;&lt;p&gt;There is a decoupling of the execution of a certain task from
  implementation.&lt;/p&gt;&lt;/li&gt;
  &lt;li&gt;&lt;p&gt;Every system can focus on what it is designed for.&lt;/p&gt;&lt;/li&gt;
  &lt;li&gt;&lt;p&gt;Every system does not make assumptions about what other systems do
  or should do.&lt;/p&gt;&lt;/li&gt;
  &lt;li&gt;&lt;p&gt;Replacing systems will have no side effect on other systems.&lt;/p&gt;&lt;/li&gt;
  &lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;During my investigations I came around a load of .Net &lt;strong&gt;IoC&lt;/strong&gt; frameworks, a lot of them had their own pros and cons, and a lot of people were hard core supporters of certain frameworks. Currently where I work we have chosen to go with Castle Windsor, although on this website I am currently playing aroung with &lt;a href="http://www.ninject.org/"&gt;Ninject&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Most of these frameworks have the same common concepts, but I would like to find out what your favourite IoC frameworks are. Below is a voting panel, so please choose your favourite framework and feel free to comment on why you chose yours.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;UPDATE: The voting has closed and this is how the results finished up.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://a43d55f6a02c4be185ce-9cfa4cf7c673a59966ad8296f4c88804.r44.cf3.rackcdn.com/IOC/chart.png" alt="Dependency Injection IOC Results" title=""&gt;&lt;/p&gt;

&lt;p&gt;For some further reading on this topics, these are some of the links I came across whilst researching this topic:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Inversion_of_Control"&gt;http://en.wikipedia.org/wiki/Inversion_of_Control&lt;/a&gt;
&lt;a href="http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx"&gt;http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx&lt;/a&gt; 
&lt;a href="http://www.martinfowler.com/articles/injection.html"&gt;http://www.martinfowler.com/articles/injection.html&lt;/a&gt;
&lt;a href="http://blog.ashmind.com/index.php/2008/08/19/comparing-net-di-ioc-frameworks-part-1"&gt;http://blog.ashmind.com/index.php/2008/08/19/comparing-net-di-ioc-frameworks-part-1&lt;/a&gt;
&lt;a href="http://blog.ashmind.com/index.php/2008/09/08/comparing-net-di-ioc-frameworks-part-2"&gt;http://blog.ashmind.com/index.php/2008/09/08/comparing-net-di-ioc-frameworks-part-2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for your votes!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=4toXGXABjM4:y7rU6ozA1YU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/4toXGXABjM4" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Vote%20for%20your%20favourite%20.NET%20DI%20(IoC)%20Framework/9</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/Q_A5jweRwk0/8</link><title>MVC HtmlHelper for Google Charts</title><description>&lt;p&gt;Asp.net Mvc has an awesome little class called the HtmlHelper class. I have only recently started to get into creating custom HtmlHelpers, and I thought that creating a small Google charting helper would be a good place to start.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/HtmlHelper/helper.gif" alt="Santa's little HTML helper" /&gt;&lt;/p&gt;

&lt;p&gt;From the Microsoft MSDN site:&lt;br&gt;The HtmlHelper class provides a set of helper methods whose purpose is to help you create HTML controls programmatically. All HtmlHelper methods generate plain HTML and return the result as a string.&lt;/p&gt;

&lt;p&gt;This is great if you need to create html that you are constantly reusing. For this example I am using the&amp;nbsp;&lt;a href="http://code.google.com/apis/chart/"&gt;Google&lt;/a&gt; charting API. It allows you to&amp;nbsp;dynamically&amp;nbsp;generate charts and you don't need to download or install anything.&amp;nbsp;There are loads of different charts that you can generate with the API including line charts, bar charts, pie charts and maps to&amp;nbsp;name a few.&amp;nbsp;In order to create a simple chart you need to use the following code:&lt;/p&gt;

&lt;p&gt;&lt;img border="0" hspace="0" alt="" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/HtmlHelper/html.PNG"&gt;&lt;/p&gt;

&lt;p&gt;Which will produce the following:&lt;/p&gt;&lt;img alt="Sample chart" src="http://chart.apis.google.com/chart?chs=250x100&amp;amp;chd=t:60,40&amp;amp;cht=p3&amp;amp;chl=Hello|World"&gt; 
&lt;p&gt;This is a good example to get started with, so lets get started. First, you need to create a new class, lets call it GoogleChart.&lt;/p&gt;

&lt;p&gt;&lt;img style="WIDTH: 530px; HEIGHT: 309px" border="0" hspace="0" alt="" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/HtmlHelper/newclass.PNG" width="564" height="358"&gt;&lt;/p&gt;

&lt;p&gt;Next lets create the method that will accept some values and return the html we need as a string:&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;GoogleChart&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; Draws the chart.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param name="helper"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;The helper.&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param name="chartType"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;Type of the chart.&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param name="chartData"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;The chart data.&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param name="chartSize"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;Size of the chart.&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param name="chartLabel"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;The chart label.&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt 72pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;public&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; DrawChart(&lt;span style="COLOR: blue"&gt;this&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;HtmlHelper&lt;/span&gt; helper, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt;&amp;nbsp;chartType, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; chartData, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; chartSize, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; chartLabel)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt 108pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;StringBuilder&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; chartHtml = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt;(&lt;span style="COLOR: #a31515"&gt;"&amp;lt;img src='http://chart.apis.google.com/chart?chs="&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;chartHtml.Append(chartSize);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;chartHtml.Append(&lt;span style="COLOR: #a31515"&gt;"&amp;amp;amp;chd=t:"&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;chartHtml.Append(chartData);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;chartHtml.Append(&lt;span style="COLOR: #a31515"&gt;"&amp;amp;amp;cht="&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;chartHtml.Append(chartType);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;chartHtml.Append(&lt;span style="COLOR: #a31515"&gt;"&amp;amp;amp;chl="&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;chartHtml.Append(chartLabel);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;chartHtml.Append(&lt;span style="COLOR: #a31515"&gt;"' /&amp;gt;"&lt;/span&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="LINE-HEIGHT: normal; MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; chartHtml.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="MARGIN: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&lt;span style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;
&lt;/p&gt;&lt;p&gt;If we need to call this code on our view we simply do the following.&lt;/p&gt;

&lt;p&gt;&lt;img border="0" hspace="0" alt="" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/HtmlHelper/drawchart.PNG"&gt;&lt;/p&gt;

&lt;p&gt;The intellisense now picks up the values we added in our class, and returns the following code on the view:&lt;/p&gt;

&lt;p style="MARGIN: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;span class="htmltag1"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="htmlelm1"&gt;&lt;font color="#800000"&gt;IMG &lt;/font&gt;&lt;/span&gt;&lt;span class="htmlatr1"&gt;&lt;font color="#ff0000"&gt;src&lt;/font&gt;&lt;/span&gt;&lt;span class="htmltag1"&gt;&lt;font color="#0000ff"&gt;=&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;&lt;font face="Calibri"&gt;&lt;span class="htmlval1"&gt;"http://chart.apis.google.com/chart?chs=250x100&lt;br&gt;&amp;amp;amp;chd=t:40,60,60&lt;br&gt;&amp;amp;amp;cht=p&lt;br&gt;&amp;amp;amp;chl=Pie Chart"&lt;/span&gt;&lt;span class="htmltag1"&gt;&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;And tada....&lt;br&gt;&lt;img src="http://chart.apis.google.com/chart?chs=250x100&amp;amp;chd=t:40,60,60&amp;amp;cht=p&amp;amp;chl=Pie Chart"&gt; &lt;/p&gt;

&lt;p&gt;It's as simple as that and this functionality can be used all over your site. This helper can also be extended to accept different objects, depending on your model, and you may want to consider making this a little more strongly typed. Using the HtmlHelper class can be used in many different circumstances and really just makes life easier.&lt;/p&gt;

&lt;p&gt;I've also created a small demo project that can be downloaded &lt;a href="http://c512911.r11.cf3.rackcdn.com/HtmlHelper/Charting.zip"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Another good example using HtmlHelpers to create a slick little reCaptcha HtmlHelper can be found &lt;a href="http://devlicio.us/blogs/derik&amp;#95;whittaker/archive/2008/12/02/using-recaptcha-with-asp-net-mvc.aspx"&gt;here&lt;/a&gt;. &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=Q_A5jweRwk0:ov7dJLqLMj8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/Q_A5jweRwk0" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20HtmlHelper%20for%20Google%20Charts/8</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/svEJLYHYiqA/Create%20Barcodes%20and%20Pdf's%20in%20C</link><title>Create Barcodes and Pdf's in C# with iTextSharp</title><description>&lt;p align="left"&gt;An easy way to create PDF files is to use iTextSharp. It is an opensource PDF library that allows to you generate PDF files on the fly. It's great if you need to dynamically create a PDF using dynamic data. Also, I found that this is a great tool to easily make barcodes. You can create common barcodes such as Code 128, Code 39, EAN 128, and Code 39 ext.&lt;/p&gt;
&lt;p align="center"&gt;&lt;img border="0" hspace="0" alt="Barcode" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/Barcode/barcode.jpg"&gt;&lt;/p&gt;
&lt;p&gt;You can download a copy of the library &lt;a href="http://itextsharp.sourceforge.net"&gt;here&lt;/a&gt;. There are also a load of tutorials which can be located on the &lt;a href="http://itextsharp.sourceforge.net/tutorial/ch01.html"&gt;site&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I've included a &lt;a href="http://c512911.r11.cf3.rackcdn.com/Barcode/CreatePDF.zip"&gt;copy&lt;/a&gt; of a small project that I've whacked together using the library which shows how to create a barcode in a PDF.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=svEJLYHYiqA:KJey_XsqdIQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/svEJLYHYiqA" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Create%20Barcodes%20and%20Pdf's%20in%20C#%20with%20iTextSharp/7</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/JXjsvygmYnc/6</link><title>Minify Javascript files automatically with a T4 template</title><description>&lt;p&gt;After my last &lt;a href="http://www.deanhume.com/Home/BlogPost/dot-less-and-minifying-css/5"&gt;post,&lt;/a&gt;&amp;nbsp;I decided to dive a little more into T4 templates and learn more about them. After some goofing around, I decided to write a template that would minify js files automatically using the Yahoo YUI compressor for .net - &lt;a href="http://www.codeplex.com/YUICompressor"&gt;http://www.codeplex.com/YUICompressor&lt;/a&gt;.&lt;br&gt;&lt;br&gt;&lt;img border="0" hspace="0" alt="Blueprint" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/T4Templates/blueprint.jpg"&gt;&lt;/p&gt;
&lt;p&gt;T4 is a code generator that is built into Visual Studio, so you can start playing straight away.&lt;/p&gt;
&lt;p&gt;In order to use my T4 template, you simply need to download a copy of YUI compressor and add a reference in your project. You will also need to add a reference to the EcmaScript.Net.modified dll.&lt;/p&gt;
&lt;p align="center"&gt;&lt;img border="0" hspace="0" alt="reference" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/T4Templates/addreferences.JPG"&gt;&lt;/p&gt;
&lt;p align="left"&gt;Once that is done, drop the template into the same folder as your js files. The template will automatically run once its dropped into the folder and it will spit out the minified version of your js. If you need to run it again after making any changes just right click and choose &lt;em&gt;run custom tool&lt;/em&gt;, and it will update the files. &lt;/p&gt;
&lt;p align="center"&gt;&lt;img border="0" hspace="0" alt="Minify tool" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/T4Templates/tool.JPG"&gt;&lt;/p&gt;
&lt;p align="left"&gt;I know that there are a few other ways of minifying your &lt;a href="http://encosia.com/2009/05/20/automatically-minify-and-combine-javascript-in-visual-studio"&gt;javascript&lt;/a&gt; files, but for me this seemed like a nice simple, slick way to do it. Plus I also learnt a little about T4 templates. This is only the tip of the iceberg when it comes to T4 templates, and I reckon there is loads more power that can be harnessed from this cool little tool.&lt;/p&gt;
&lt;p align="left"&gt;Download a copy of the project &lt;a href="http://c512911.r11.cf3.rackcdn.com/T4Templates/MinifyJs.zip"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Some further reading:&lt;br&gt;&lt;a href="http://www.olegsych.com/2008/09/t4-tutorial-creatating-your-first-code-generator/"&gt;http://www.olegsych.com/2008/09/t4-tutorial-creatating-your-first-code-generator/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/webdevtools/archive/2009/01/29/t4-templates-a-quick-start-guide-for-asp-net-mvc-developers.aspx"&gt;http://blogs.msdn.com/webdevtools/archive/2009/01/29/t4-templates-a-quick-start-guide-for-asp-net-mvc-developers.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx"&gt;Scott Hanselmans blog&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=JXjsvygmYnc:VAxnMdN7d3I:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/JXjsvygmYnc" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Minify%20Javascript%20files%20automatically%20with%20a%20T4%20template/6</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/WmsW_wNjnoE/5</link><title>Dot Less and Minifying Css</title><description>&lt;p&gt;A colleague introduced me to this wicked library for css files. If you are lazy like me, this tool is a great way to use variables in your css code so that you dont end up repeating yourself.
Taken directly from the site:
&lt;a href="http://www.dotlesscss.org/"&gt;http://www.dotlesscss.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;"&lt;em&gt;Write regular CSS with your .NET apps, &lt;br&gt;then add a few variables, mixins and nested rules.&lt;br&gt;less (pronounced dot-less) is a .NET port of the funky ruby LESS libary&lt;/em&gt;"&lt;/p&gt;
&lt;p&gt;Here is an example of some code that could be used in your css files: &lt;/p&gt;&lt;pre&gt;@brand_color: #4D926F;
 
#header {
  color: @brand_color;
}
 
h2 {
  color: @brand_color;
}
&lt;/pre&gt;
&lt;p&gt;You could also us nested rules:&lt;/p&gt;&lt;pre&gt;#header {
  color: red;
  a { 
       font-weight: bold; 
       text-decoration: none; 
    } 
}
&lt;/pre&gt;
&lt;p&gt;Dot less also has other great features built in such as mixins and operations. The operations let you perform mathematical operations such as add, subtract, multiply etc. This is very exciting stuff for css files! I've had a great time playing around with this.&lt;/p&gt;
&lt;p&gt;Implementing this in your solution is an easy process. Simply add a reference to the dotless.Core.dll. Then link like any style sheet in your page / Master page.&lt;br&gt;&lt;br&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;link&lt;/span&gt;&lt;span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;span style="COLOR: red"&gt;href&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="../css/screen.less"&lt;/span&gt;&lt;span style="COLOR: red"&gt;rel&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="stylesheet"&lt;/span&gt; &lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="text/css"&lt;/span&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR: red"&gt;media&lt;/span&gt;&lt;span style="COLOR: blue"&gt;="screen"&lt;/span&gt; &lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Update your web.config httphandlers.&lt;br&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: #a31515; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;add&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;type&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"&gt;"&lt;span style="COLOR: blue"&gt;dotless.Core.LessCssHttpHandler,dotless.Core&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;validate&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;false&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;path&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;*.LESS&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;verb&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;*&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;/&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Here are some more details from one of the creators of the tool:&lt;br&gt;&lt;a href="http://enginechris.wordpress.com/2009/11/23/my-thoughts-on-using-dotless-and-the-less-syntax/"&gt;http://enginechris.wordpress.com/2009/11/23/my-thoughts-on-using-dotless-and-the-less-syntax/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I also came across this awesome post by Phil Haack:&lt;br&gt;&lt;a href="http://haacked.com/archive/2009/12/02/t4-template-for-less-css.aspx"&gt;http://haacked.com/archive/2009/12/02/t4-template-for-less-css.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;He has created a T4 template to minify the created .less files into .css again. If you are lazy like me, this is a great way to do this automatically. Just drop the template into your relevant folder and it will pick up the .less files and minify them for you as .css files. It uses the YUI Compressor for .NET to compress the files.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=WmsW_wNjnoE:efNZ6e5WxL8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/WmsW_wNjnoE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Dot%20Less%20and%20Minifying%20Css/5</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/Eu8rMv6UlNw/4</link><title>Custom error pages in MVC</title><description>&lt;p&gt;I was recently looking for an efficient method of redirecting users to an error page when an exception is thrown in an MVC application. A useful way of doing this is with the&amp;nbsp;HandleErrorAttribute. In order to handle exceptions thrown by your action methods, you need to mark your method with this attribute. The HandleErrorAttribute also allows you to use a custom page for this error.&lt;/p&gt;

&lt;p align="center"&gt;&lt;img style="WIDTH: 384px; HEIGHT: 187px" border="0" hspace="0" alt="Error" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/ErrorHandler/error.jpg" width="409" height="238"&gt;&lt;/p&gt;

&lt;p&gt;First you need to update your web.config file to allow your application to handle custom errors.&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;system.web&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;customErrors&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;mode&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;On&lt;/font&gt;&lt;/font&gt;&lt;font color="#000000" size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &amp;gt;&lt;br&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;system.web&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;p&gt;Then, your action method needs to be marked with the atttribute.&lt;/p&gt;&lt;pre&gt;[HandleError]
public class HomeController : Controller
{
    [HandleError]
    public ActionResult ThrowException()
    {
        throw new ApplicationException();
    }
}
&lt;/pre&gt;
&lt;p&gt;By calling the ThrowException action, this would then redirect the user to the default error page. In our case though, we want to use a custom error page and redirect the user there instead.So, let's create our new custom view page. &lt;/p&gt;&lt;font size="2"&gt;
&lt;/font&gt;&lt;p&gt;&lt;img border="0" hspace="0" alt="" align="baseline" src="http://c512911.r11.cf3.rackcdn.com/ErrorHandler/view.jpg"&gt;&lt;/p&gt;

&lt;p&gt;Next, we simply need to update the HandleErrorAttribute on the action method.&lt;/p&gt;&lt;pre&gt;[HandleError]
public class HomeController : Controller
{
    [HandleError(View = "CustomErrorView")]
    public ActionResult ThrowException()
    {
      throw new ApplicationException();
    }
}
&lt;/pre&gt;
&lt;p&gt;I found that I needed to update my web.config to also reflect the new custom error page. &lt;br&gt;&lt;br&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;system.web&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;customErrors&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;mode&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;On&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;defaultRedirect&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;CustomErrorView&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &amp;gt;&lt;br&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;system.web&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;p&gt;You can place your custom error page in the same directory as your view, or you can place it in the Shared view folder, either way this should work.&lt;/p&gt;

&lt;p&gt;Unfortunately the HandleErrorAttribute wont work with 404 errors and 500 page errors. Ah, but what happens if I need to display a custom page? No problem, we just need to update our web.config and create an action method to handle the view.&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;customErrors&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;mode&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;On&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;defaultRedirect&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;CustomErrorView&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;error&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;statusCode&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;404&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;redirect&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"Error&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;/Error404&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;error&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;statusCode&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;500&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;redirect&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"Error&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;/Error500&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;customErrors&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;The controller:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;pre&gt;public class ErrorController : Controller&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;        // Return the 404 not found page &lt;br&gt;       public ActionResult Error404()&lt;br&gt;      {&lt;br&gt;           return View();&lt;br&gt;      }&lt;br&gt;&lt;br&gt;       // Return the 500 not found page &lt;br&gt;       public ActionResult Error500()&lt;br&gt;      {&lt;br&gt;           return View();&lt;br&gt;      }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;

&lt;p&gt;This could also be done with a static page if needed: &lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;customErrors&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;mode&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;On&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;error&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;statusCode&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;404&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;redirect&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Static404.html&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;"&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt; /&amp;gt;&lt;br&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;customErrors&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;There are a number of other ways of handling errors in MVC, but personally I have found this to work the best for me. You will want to add your own error logging on top of this, and this can be easily done in the controllers.&lt;/p&gt;

&lt;p&gt;You can download a copy of the project &lt;a href="http://www.deanhume.com/content/postimages/errorhandler/error.zip"&gt; here&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=Eu8rMv6UlNw:Fdk9mwvkUYs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/Eu8rMv6UlNw" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Custom%20error%20pages%20in%20MVC/4</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/s_MEUwRAobE/3</link><title>MVC routing - 404 errors when directing away from home page</title><description>&lt;p&gt;So, once I got the site up and running and I thought I was home and 
away.&lt;br&gt;My home page worked perfectly, but as soon as I clicked away from the 
home page I got a 404 error page. Now I assumed that the only reason I was 
getting this was because of the site being on a hosted site, and that the 
hosting site used IIS 6.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/MVCRouting/image_thumb_6.png"&gt;&lt;/p&gt;
&lt;p&gt;I googled around a little and found out that it had to do with the IIS 
settings on the hosted site. It worked perfectly locally until I deployed the 
site. A few of the search sites suggested changing the extension in the routing 
to .mvc, amongst other things.&lt;br&gt;Nothing seemed to work, except the 
following.&lt;/p&gt;
&lt;p&gt;For me, the only thing that seemed to fix it was a changed to change the 
wildcard mapping for aspnet_isapi.dll in the IIS settings. Fortunately for me, 
my hosting company was kind enough to change the settings on my site for me. I'm 
not sure if your hosting company will do this for you, but this was an instant 
fix&lt;/p&gt;
&lt;p&gt;This can be done by opening IIS manager, right clicking on your app, click on 
properties, then on configuration at the bottom. Click Insert and paste in 
&lt;br&gt;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll - (You might 
want to click on the .aspx extension and click edit and copy the path of the 
aspnet_isapi.dll from there).&lt;/p&gt;
&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/MVCRouting/iis51-site-configuration-thumb.png"&gt;&lt;/p&gt;
&lt;p&gt;Another important thing to remember is to uncheck the "verify that file 
exists" checbox.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/MVCRouting/09-wildcard-extension-mapping_3.png"&gt;&lt;/p&gt;
&lt;p&gt;Once this was done everything seemed to run smoothly again. Awesome!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=s_MEUwRAobE:gbZiLmjnBlU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/s_MEUwRAobE" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/MVC%20routing%20-%20404%20errors%20when%20directing%20away%20from%20home%20page/3</feedburner:origLink></item><item><link>http://feedproxy.google.com/~r/DeanHumesBlog/~3/Hz-cKBAJwno/2</link><title>Bin deploying MVC</title><description>&lt;p&gt;Welcome to my site! It has been developed using 
MVC 2 beta (Which I intend to update as soon as the full release comes out), 
Subsonic 3.0 and a SQL 2005 DB. Ive written everything from scratch and Ive 
still got a lot to learn about the cool features that are available in the new 
MVC 2.&lt;/p&gt; &lt;p&gt;&lt;img src="http://c512911.r11.cf3.rackcdn.com/BinDeploying/deploy.jpg"&gt;&lt;/p&gt;
&lt;p&gt;So, I thought Id just detail some of the issues I encountered whilst setting 
up the site. On my local environment developing and setting up an MVC 2 app was 
a breeze. I was initially a bit worried about deploying my site to a hosting 
company and having it still work with the MVC 2 on it. My hosting company does 
provide an MVC 1 service which is great, but when I initially uploaded my 
site to the hosting provider I got an error asking for MVC version 2 
dlls.
&lt;/p&gt;

&lt;p&gt;After some searching around I found this great article : &lt;a href="http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx"&gt;http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Although this was orginally written within MVC 1 in mind, it worked perfectly 
for me with MVC 2. All the changes involved were including the following files 
with my deployment:&lt;/p&gt;
&lt;p&gt;System.Web.Mvc&lt;br&gt;System.Web.Routing&lt;br&gt;System.Web.Abstractions&lt;/p&gt;
&lt;p&gt;
In order to fix this problem, right click in your Solution Explorer and then expand the references. Choose the required Dll's and set "copy local" to true.
&lt;img src="http://c512911.r11.cf3.rackcdn.com/BinDeploying/copy-local-true_3_3.png" alt="MVC Dll's System.Web.Abstractions" /&gt;
&lt;/p&gt;

&lt;p&gt;Finally, you can publish the application and it should work as expected!
&lt;img src="http://c512911.r11.cf3.rackcdn.com/BinDeploying/publish-project_3_3.png" alt="Visual Studio Publish" /&gt;
&lt;/p&gt;



&lt;p&gt;So, even if your hosting company doesnt have MVC installed it isnt a 
problem.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/DeanHumesBlog?a=Hz-cKBAJwno:RpCX9goERhg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/DeanHumesBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/DeanHumesBlog/~4/Hz-cKBAJwno" height="1" width="1"/&gt;</description><feedburner:origLink>http://www.deanhume.com/Home/BlogPost/Bin%20deploying%20MVC/2</feedburner:origLink></item></channel></rss>
