<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.mjjames.co.uk/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DUcHRn4ycCp7ImA9Wx5RE0k.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073</id><updated>2010-08-20T23:30:37.098Z</updated><title>MJJames - Web Developer</title><subtitle type="html">A Web Developers View on Grasping New Technologies</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.mjjames.co.uk/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>131</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.mjjames.co.uk/Mjjames-WebDeveloper" /><feedburner:info uri="mjjames-webdeveloper" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by/2.0/" /><entry gd:etag="W/&quot;C0UBRnkyfCp7ImA9WxFSEUQ.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-8034342417358425977</id><published>2010-04-13T20:04:00.009Z</published><updated>2010-04-13T20:40:57.794Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-13T20:40:57.794Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Script" /><category scheme="http://www.blogger.com/atom/ns#" term="HTMLHelper" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>MVC DateTime Suffix HTMLHelper</title><content type="html">&lt;p&gt;Recently I have been working on an MVC Project, and tonight I got to the point where I wanted to output a date in a specific format, for example Tuesday 13th April 2010. Sadly DateTime formatting still doesn't allow you to specify output a suffix, you can do Tuesday 13 April 2010 but not what I wanted.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I decided that I could achieve what I wanted by writing a quick HTMLHelper, this would then allow me to specify a datetime format string with a magic / special character which I could then replace for the appropriate suffix.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Writing the helper was very quick and easy, if you want to learn about HTMLHelpers and how to write your own I recommend looking at &lt;a href="http://stephenwalther.com/blog/archive/2009/03/03/chapter-6-understanding-html-helpers.aspx"&gt;Stephen Walther's Post on HTMLHelpers&lt;/a&gt; .&lt;/p&gt; &lt;p&gt;The code for my datetimehelper is below: &lt;/p&gt;
&lt;pre&gt;&lt;code class="csharp"&gt;
using System;
using System.Web.Mvc;

namespace mjjames.MVCHelpers
{
 public static class DateTimeExtensions
 {
  public static string DateTimeFormat(this HtmlHelper helper, string dateTimeFormat, DateTime dateTime){
            var dateTimeOutput = dateTime.ToString(dateTimeFormat);
            if (dateTimeFormat.Contains("~"))
            {
                dateTimeOutput = dateTimeOutput.Replace("~", GenerateDaySuffix(dateTime.Day));
            }
      return dateTimeOutput;
  }

        /// &amp;lt;summary&amp;gt;
        /// Generates a Day Suffix from the Day Number
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name="day"&amp;gt;Day Number&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;Suffix String&amp;lt;/returns&amp;gt;
     private static string GenerateDaySuffix(int day)
     {
         var suffix = "";
            //find out if the day matches a suffix which isn't th
         switch(day)
         {
             case 1:
                case 21:
                case 31:
                 suffix = "st";
                    break;
                case 2:
                case 22:
                 suffix = "nd";
                 break;
                case 3:
                case 23:
                 suffix = "rd";
                    break;
                default:
                 suffix = "th";
                 break;
         }
         return suffix;
     }
 }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then to use it first include the namespace in your view:
&lt;pre&gt;
&lt;code class="csharp"&gt;
&amp;lt;%@ Import Namespace="mjjames.MVCHelpers" %&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;And then to use it call Html.DateTimeFormat passing the format string and the DateTime value. To use the day suffix include the ~ character. Note you can use it with.&lt;/p&gt;
&lt;pre&gt;&lt;code class="csharp"&gt;
&amp;lt;%= Html.DateTimeFormat("dddd d~ h", Model.StartDate) %&amp;gt;
&amp;lt;%= Html.DateTimeFormat("dddd d h", Model.EndDate) %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There we go, nice and easy, if you want to use this feel free I hope it helps&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-8034342417358425977?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/ocUin1HlNKI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/8034342417358425977/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=8034342417358425977" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/8034342417358425977?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/8034342417358425977?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/ocUin1HlNKI/mvc-datetime-suffix-htmlhelper.html" title="MVC DateTime Suffix HTMLHelper" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2010/04/mvc-datetime-suffix-htmlhelper.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkIFQ3o7fyp7ImA9WxFTFUs.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-1074574620587322616</id><published>2010-04-06T15:01:00.005Z</published><updated>2010-04-06T15:41:52.407Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-06T15:41:52.407Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="DotRAS" /><category scheme="http://www.blogger.com/atom/ns#" term=".NET" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Using DOTRas - An Overview and some things I've learnt</title><content type="html">&lt;p&gt;Yesterday I decided to starting knocking together a quick application to help me backup my server to some local storage. The idea being that at any point I have a local copy of my server setup a maximum of a day old. The point of this application and how I've gone about writing it, what libraries I'm using etc will be part of a future blog post.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I decided early on that I however I wanted to transfer files I wanted to do this over a VPN to the server. I had several reasons for this, being able to expose my files over a network share, more secure etc. My Application will be running on an old laptop, so I first thought about just always having it connected to a VPN using windows, and run the application as normal. However I then thought what if the VPN disconnects and I don't notice, how long would it take until I noticed etc. So I decided to make the application create a VPN Connection at start up and then disconnect from it upon completion. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I figured that there would be a good library that would help with this and it turns out there is. &lt;a href="http://dotras.codeplex.com/"&gt;DotRAS&lt;/a&gt; provides remote access service (RAS) components for .NET languages , it's tag line is "WindowsRAS made easy" and I have to say so far it has lived up to that.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;A quick example of how to open the computers RAS PhoneBook : &lt;pre&gt;&lt;code class="csharp"&gt;
using(var phoneBook = new RasPhoneBook())
{
     phoneBook.Open();
}
&lt;/code&gt;&lt;/pre&gt;
You could then find an existing entry within the phonebook to make a connection too and open a connection:
&lt;pre&gt;&lt;code class="csharp"&gt;
var entry = phoneBook.Entries.FirstOrDefault(e =&gt; e.Name.Equals("mikes test entry");
if(entry != null){
    entry.Open();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now there's obviously alot you can do with it, create and manage connections programatically etc, use phone dialers but so far I'm just tinkering with VPN's. &lt;/p&gt;
&lt;br /&gt;
&lt;h2&gt;Tips and Tricks&lt;/h2&gt;
&lt;p&gt;Now to what I wanted to post about, tips and tricks. Sadly whilst working with DOTRas I found a few gotcha's that I wanted to post about. I will also update this list as I find more. It's worth noting that all of these apply to DotRAS 1.1 and I'm using the Win2k8 build, some of these I know also apply to the XPSP2 build. And my development machine is Windows 7 x64.&lt;/p&gt;
&lt;h3&gt;Invalid Default PhoneBook Location&lt;/h3&gt;
&lt;p&gt;The default phonebook location, which is called when you just do phonebook.Open(), is set to use RasPhoneBookType.AllUsers, now this maps to : C:\ProgramData\Microsoft\Network\Connections\Pbk\rasphone.pbk which for me doesn't exist. The folders exist up to connections, I have no Pbk folder. &lt;/p&gt; &lt;br /&gt; &lt;p&gt;I could obviously check for this and then create the phonebook entry but really you should always use RasPhoneBookType.User which uses the phonebook located within the current users AppData. &lt;/p&gt;
&lt;h3&gt;The entry is not associated with a phone book&lt;/h3&gt;
&lt;p&gt;Actually quite an obvious issue but worth commenting on, If you create a new phonebook entry &lt;/p&gt;
&lt;pre&gt;&lt;code class="csharp"&gt;
var entry = RasEntry.CreateVpnEntry(_connectionName, IPAddress.Loopback.ToString(), RasVpnStrategy.Default,                                 RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then try to set the user's credentials without first adding the entry to the phonebook:&lt;/p&gt;
&lt;pre&gt;&lt;code class="csharp"&gt;
entry.UpdateCredentials(new NetworkCredential(authenticationDetails.UserName, authenticationDetails.Password));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Everything goes horribly wrong, instead add the entry to the phonebook and then set the credentials.&lt;/p&gt;
&lt;pre&gt;&lt;code class="csharp"&gt;
phoneBook.Entries.Add(entry);
entry.UpdateCredentials(new NetworkCredential(authenticationDetails.UserName, authenticationDetails.Password));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Keep an eye on this post, I'll update it as I continue to use DotRAS and then on a later date post about my application in full.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-1074574620587322616?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/7A38cnnckOg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/1074574620587322616/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=1074574620587322616" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/1074574620587322616?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/1074574620587322616?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/7A38cnnckOg/using-dotras-overview-and-some-things.html" title="Using DOTRas - An Overview and some things I've learnt" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2010/04/using-dotras-overview-and-some-things.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIDRXc-fCp7ImA9WxBWF0g.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-3813211720758201724</id><published>2010-02-09T22:08:00.006Z</published><updated>2010-02-09T22:29:34.954Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-09T22:29:34.954Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SVN" /><category scheme="http://www.blogger.com/atom/ns#" term="SubVersion" /><title>Unable to merge or create branches with SVN</title><content type="html">&lt;p&gt;I've been using SubVersion for a while, several years infact, I use VisualSVN on my server and TortoiseSVN on my machines.&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;Until recently I had never experienced any problems or glitches with it. However at some point within the last two months one of my main repositories started playing up. It's the only repository I have ever branched. The problem occurred when after working on a branch for several months I decided it was time to merge it back into the head. However when I tried to use the merge function and take the branch into the head I was given the following error message: &lt;blockquote&gt;[branch] is not a child of repository root URL [trunk]&lt;/blockquote&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I tried several attempts at trying to do this, rechecking out the branch and trunk in case they were corrupt but to no avail. I then decided to try creating a new branch to see if the repository was totally broken and I indeed got an error.&lt;/p&gt;
&lt;blockquote&gt;Repository moved permanently to [svn server address] please relocate;&lt;/blockquote&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So it looked liked the reopsitory was broken. On a bit of a whim I noticed that my file path looked something similar to f:\development\shared\a repository name\trunk and similarly the branch was f:\development\shared\a repository name\1.6 The SVN url however was http://[svn-url]/svn/arepositoryname , I was wondering if somehow the directory path was confusing SVN, was it always expecting the directories to be checked out in the same folder structure as the server.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So I tried creating a new directory called arepositoryname and then checked out the trunk and version 1.6 underneath it. I then tried to merge the 1.6 repository back into the trunk and create a new branch and it all worked fine!&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So it indeed seemed that TortoiseSVN was getting confused by my folder structure not replicating the servers, simply fixing this, maybe it was just removing the spaces need to possibly try that further, resolved my issue.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Just to add clarification if you stumble across this trying to solve your issue that I was running VisualSVN 2.1 and Tortoise 1.6 on a Windows 7 x64 machine. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Some crazy behaviour but I least I figured it out after &lt;strong&gt;several&lt;/strong&gt; hours ... hope this helps.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-3813211720758201724?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/KFvoTccPMBM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/3813211720758201724/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=3813211720758201724" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/3813211720758201724?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/3813211720758201724?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/KFvoTccPMBM/unable-to-merge-or-create-branches-with.html" title="Unable to merge or create branches with SVN" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>3</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2010/02/unable-to-merge-or-create-branches-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8ASHwzfSp7ImA9WxBXEUU.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-5187658933142955883</id><published>2010-01-22T18:50:00.004Z</published><updated>2010-01-22T19:17:29.285Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-22T19:17:29.285Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vista" /><category scheme="http://www.blogger.com/atom/ns#" term="streams" /><category scheme="http://www.blogger.com/atom/ns#" term="drivers" /><category scheme="http://www.blogger.com/atom/ns#" term="unblock" /><title>Drivers Causing "This file came from another computer and might be blocked to help protect this computer" On Startup</title><content type="html">&lt;p&gt;This weekend I had to reinstall a driver for a laptop touch pad. I went to the Sony site and got the driver, it came in a zip file and looked pretty standard. A load of driver files and an install file.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;It install all OK and the touchpad started to have its scroll options, however then I rebooted and found each time the laptop started up Windows Vista kept asking to confirm I wanted to run the programs, "This file came from another computer and might be blocked to help protect this computer". Straight away I thought it had to be the file was blocked from running as it came from a download. I went to the files unblocked them all, clicked apply and rebooted again only to find it happen again.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Just to ensure I hadn't forgotten to click apply I tried this again only to find the same thing. After Googling for the issue I found the issue was that the installer had simply copied the drivers and files. This meant that the NTFS information was also copied, this information contained the flag "downloaded from internet" along with others.&lt;/p&gt;
&lt;br/&gt;
&lt;p&gt;The solution was to strip these files of this information, luckily you can obtain a free tool to do this. &lt;a href="http://www.microsoft.com/technet/sysinternals/utilities/Streams.mspx"&gt;"Streams"&lt;/a&gt; from Sysinternals,  I simply downloaded this,http://www.microsoft.com/technet/sysinternals/utilities/Streams.mspx, ran it on the directory, command prompt only, and rebooted to find all was well.&lt;/p&gt;
&lt;p&gt;Certainly one to remember as I have came across this before and removed the program.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-5187658933142955883?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/V4mzV86XiU4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/5187658933142955883/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=5187658933142955883" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/5187658933142955883?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/5187658933142955883?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/V4mzV86XiU4/drivers-causing-this-file-came-from.html" title="Drivers Causing &quot;This file came from another computer and might be blocked to help protect this computer&quot; On Startup" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2010/01/drivers-causing-this-file-came-from.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EGQ3c6eSp7ImA9WxNXFE4.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-977378760522357097</id><published>2009-10-01T22:07:00.002Z</published><updated>2009-10-01T22:20:22.911Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-01T22:20:22.911Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="reflection" /><title>Why we have to be more careful about what we read and more importantly what we write</title><content type="html">&lt;p&gt;In this day and age it is very uncommon to not use the internet to research or solve problems. Our reliance on printed reference books and even reference sites has dwindled massively.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
As developers, especially budding developers, we often just Google our problems, in fact I think most of our senior dev's often say to us "have you Googled it?" When asked about something.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
Now googling things of course has changed our industry, we can often solve problems or get good starting points within seconds. &lt;br /&gt; This on its own is not a bad thing, we google we get the results and we crack on. The problem however is when you pick the first item or a random article and use what someone else has written as FACT.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
The problem with our "Google" culture, this applys to more than programming, is that we often don't filter what we read. We suffer from fps, first page symdrom. If its on the first page of our results it has to be correct.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
Sadly though all too often the actual blogs or forum posts we end up reading are from FACT. Today I was investigating an issue with a JS tab solution I had wrote and sadly found a ton of some very poor "tutorials". These articles / blogs although well presented and often written with the best intentions often lead people to learn / pick up bad habits. I won't name the article that prompted me to write this but to say the solution was so far wrong is an understatement.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
New developers will always trust what they read, I think it stems from how our education systems work. I believe we need to refine our "google" culture tendencies and in particular our FPS.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
How do we change this? Firstly we need to encourage people to not just read the first article / blog they reach from a search. Instead to open several tabs of articles on the subject matter and then read each one, and then and only then look at the common concepts / answers they provide. We need to consider multiple sources before something is FACT.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
Also I believe blog and article writers also have an obligation to research / check out what others think or do regarding a subject before they post onto the internet. This also applies to big sites like the BBC, in fact the bigger you are the more this applies.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
Its great to share solutions to problems and to write about things we like, things we have done, things we think are cool but we must ensure that what we write is technically sound, otherwise we continue to breed a culture and community of half baked products and websites.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
This is where I believe sites like stack overflow and all their derivatives will help.  As these sites continue to grow and questions with highly voted answers appear in our search engines, hopefully quality will begin to cut through the noise.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
Our "google" culture no doubt makes things easier and quicker and I'm a believer in "have you Googled for it?" , but I do think us as writers and us as searchers need to be more analytical of what we read in order to produce things of higher quality and to grow in our profession.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-977378760522357097?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/yD6_YuMJ78A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/977378760522357097/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=977378760522357097" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/977378760522357097?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/977378760522357097?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/yD6_YuMJ78A/why-we-have-to-be-more-careful-about.html" title="Why we have to be more careful about what we read and more importantly what we write" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/10/why-we-have-to-be-more-careful-about.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YNQX86eSp7ImA9WxNSE00.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-6695345369731368728</id><published>2009-08-26T15:37:00.001Z</published><updated>2009-08-26T15:39:50.111Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-26T15:39:50.111Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="masterclass" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="TDD" /><title>TDD Masterclass in the UK</title><content type="html">&lt;p&gt;Roy Osherove is giving an hands-on TDD Masterclass in the UK, September 21-25. Roy is author of "The Art of Unit Testing" (http://www.artofunittesting.com/), a leading tdd &amp; unit testing book; he maintains a blog at http://iserializable.com (which amoung other things has critiqued tests written by Microsoft for asp.net MVC - check out the testreviews category) and has recently been on the Scott Hanselman podcast (http://bit.ly/psgYO) where he educated Scott on best practices in Unit Testing techniques. For a further insight into Roy's style, be sure to also check out Roy's talk at the recent Norwegian Developer's Conference (http://bit.ly/NuJVa). &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Full Details here: http://bbits.co.uk/tddmasterclass&lt;/p&gt;
&lt;p&gt;
bbits are holding a raffle for a free ticket for the event. To be eligible to win the ticket (worth £2395!) you MUST paste this text, including all links, into your blog and email Ian@bbits.co.uk with the url to the blog entry.  The draw will be made on September 1st and the winner informed by email and on bbits.co.uk/blog&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-6695345369731368728?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/ckfAO7NbYus" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/6695345369731368728/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=6695345369731368728" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/6695345369731368728?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/6695345369731368728?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/ckfAO7NbYus/tdd-masterclass-in-uk.html" title="TDD Masterclass in the UK" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/08/tdd-masterclass-in-uk.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQAR3k8cCp7ImA9WxJVEEg.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-8385366524024301478</id><published>2009-06-26T19:16:00.007Z</published><updated>2009-06-26T22:12:26.778Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-26T22:12:26.778Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vimeo" /><category scheme="http://www.blogger.com/atom/ns#" term="flickr" /><category scheme="http://www.blogger.com/atom/ns#" term="Plugin" /><category scheme="http://www.blogger.com/atom/ns#" term="FCKEditor" /><category scheme="http://www.blogger.com/atom/ns#" term="youtube" /><title>FlickVimTube - An FCKEditor Plugin</title><content type="html">&lt;p&gt;First things first, ignore the random title for this post, it does have a meaning and it's the best I could up with ;)&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The other evening I was hitting some downtime and rather than carry on playing FarCry 2 I decided I'd write a quick &lt;a href="http://fckeditor.net"&gt;FCKEditor&lt;/a&gt; plugin which I've been meaning to write for a while. By default the editor comes with functionality to insert flash files into your content which works well however I wanted to have a way to only insert online videos from Flickr,  Vimeo or YouTube. To insert these I was having to manually go into source view, paste in the embed code etc. A chore and a heartache.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So enough was enough and I banged together a quick plugin that would take a YouTube Embed URL and then insert the appropiate embed HTML for it. This was actually quite simple. I worked out there was four main steps, 1. Extract the video ID from the URL 2. Create suitable embed markup and insert into the editor 3. Create a preview video so you can ensure it works before clicking ok. 4. Be able to view and update the video after inserting.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Extracting the video ID I'm sure could be done using some clever regex expression however for simplicity and speed I opted to simply slice the YouTube url at ?v= bit and then use the remainder as the ID. As the official embed url is in the format http://www.youtube.com/watch?v={id} I have decided for my first version of this plugin I can nievly split, however I should really parse it properly.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
To insert the embed object I made use of some build in FCKEditor methods to create the object and then assign the attributes to it. &lt;/p&gt;
&lt;pre&gt;&lt;code class="javascript"&gt;
e = FCK.EditorDocument.createElement('EMBED');
SetAttribute(e, 'src', embedUrl);

SetAttribute(e, 'type', 'application/x-shockwave-flash');
SetAttribute(e, 'pluginspage', 'http://www.macromedia.com/go/getflashplayer');

SetAttribute(e, "width", GetE('txtWidth').value == '' ? 360 : GetE('txtWidth').value);
SetAttribute(e, "height", GetE('txtHeight').value == '' ? 150 : GetE('txtHeight').value);
SetAttribute(e, "allowscriptaccess", "always");
SetAttribute(e, "allowfullscreen", "true");
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
After getting the basics working I decided to add support for Vimeo and Flickr. This was a case of just working out which service it was and then parsing out the id's and then setting the correct embed URL on the embed object.
&lt;/p&gt;
&lt;p&gt;FCKEditor plugin's are dead easy to configure, in your fckeditor settings file simply register the plugin using FCKEditor.Plugins.Add and ensure your custom toolbar settings include the button, 'OnlineVideo' &lt;/p&gt;
&lt;pre&gt;&lt;code class="javascript"&gt;
FCKConfig.ToolbarSets["mjjames"] = [
    ['Cut','Copy','PasteText','-','SpellCheck',
    '-','Image','OnlineVideo','Table','Rule','Smiley','SpecialChar','-',
 'Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat','-','Link','Unlink','Anchor','-','Source'],
 ['Style','FontFormat','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull',
 '-','Bold','Italic','Superscript','OrderedList','UnorderedList','-','Outdent','Indent'] 
];

FCKConfig.Plugins.Add('OnlineVideo', 'en');
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The plugin file includes language settings for english, however adding additional languages can be added by simply providing translations for the labels and then changing your plugin registration to include the new file name. If you want to add French for example create a file called fr.js in the plugins languages and then the plugin registration becomes:&lt;/p&gt;
&lt;pre&gt;&lt;code class="javascript"&gt;
FCKConfig.Plugins.Add('OnlineVideo', 'fr');
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The following language settings are available: &lt;br /&gt;
OnlineVideoTip, DlgOnlineVideoTitle, DlgNoVideo, DlgInvalidVideoUrl, DlgOnlineVideoURL, DlgOnlineVideoWidth, DlgOnlineVideoHeight, DlgOnlineVideoQuality, DlgOnlineVideoLow, DlgOnlineVideoHigh. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The plugin can be downloaded as a &lt;a href="http://development.mjjames.co.uk/scripts/JS/FCKEditorOnlineVideoPlugin.zip"&gt;zip file&lt;/a&gt; and is licensed under &lt;a href="http://creativecommons.org/licenses/by-sa/3.0/"&gt;Creative Commons Attribution-Share Alike 3.0 License &lt;/a&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;In the future I intend to extend this further, maybe to allow users to find and search for videos using the various API's provided by the video sources but that will be at a later date.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-8385366524024301478?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/CNpI_2ZHk_8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/8385366524024301478/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=8385366524024301478" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/8385366524024301478?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/8385366524024301478?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/CNpI_2ZHk_8/flickvimtube-fckeditor-plugin.html" title="FlickVimTube - An FCKEditor Plugin" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>3</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/06/flickvimtube-fckeditor-plugin.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcGQnkyfip7ImA9WxJRF0s.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-7984913403365894523</id><published>2009-05-19T19:58:00.004Z</published><updated>2009-05-19T20:47:03.796Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-19T20:47:03.796Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Image Resizing" /><category scheme="http://www.blogger.com/atom/ns#" term="Bandwidth" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks" /><title>Wasting Bandwidth One Image at a Time....</title><content type="html">&lt;p&gt;Content Management Systems are great, they allow the average Joe to have a great level of control over their website. Gone are the days of clients asking for static pages to be amended, we live in the database powered give the power of editing and updating content to the client&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Our clients get to use Rich Text Editors like FCKEditor. They look and feel just like Microsoft Word, they can play with text, upload images, resize them simply by dragging them and are very often really happy.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;However this often comes at a cost. Most RTE's by default simply resize images by sticking on the HTML img attributes height and width. As many people are aware this doesn't actually resize the image, it just simply tells the browser take this massive image and render it smaller. The end user still has to download the huge image, I have seen on some sites 2000px x 1200px images being downloaded and then only shown at 250px x 120px!, which can take a while to load dependant their internet connection and ultimately we the developers have to pay the bandwidth cost for those images.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Tonight I decided to come up with something I could put on my church websites to combat this. It's more to aid the overall user experience rather than bandwidth cost but it all helps ;)&lt;/p&gt;
&lt;h2&gt;The Solution&lt;/h2&gt;
&lt;p&gt;The solution is actually really simple.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Take the CMS content from the database &lt;/li&gt;
&lt;li&gt;Before rendering it to the page, parse it into a HTML Parser&lt;/li&gt;
&lt;li&gt;Using the parser find all the image tags&lt;/li&gt;
&lt;li&gt;Using the height,width and src attributes to generate a new URL to an image resizer app&lt;/li&gt;
&lt;li&gt;Replace the images src attribute with the new URL &lt;/li&gt;
&lt;li&gt;Render the content to the page&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Parsing HTML in ASP.Net really is easy nowadays. Previously it was a pain, regex would never work properly or you could risk parsing your page as XML but luckily there are now tons of 3rd party libraries.  I chose &lt;a href="http://www.codeplex.com/htmlagilitypack"&gt;HTML AGility Pack&lt;/a&gt; as alot of people seemed to recommend it on &lt;a href="http://stackoverflow.com"&gt;stackoverflow&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For my solution I simply did the following:&lt;/p&gt;
&lt;pre&gt;&lt;code class="c#"&gt;
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(page.body);
HtmlNodeCollection imgs = doc.DocumentNode.SelectNodes("//img");
if (imgs != null)
{
    foreach (HtmlNode img in imgs)
    {
        if (img.Attributes["height"] != null &amp;&amp; img.Attributes["width"] != null)
        {
            HtmlAttribute src = img.Attributes["src"];
            string imgurl = src.Value;
            src.Value = String.Format("/loadImage.aspx?image={0}&amp;action={1}&amp;width={2}&amp;height={3}", imgurl, "resizecrop",img.Attributes["width"].Value, img.Attributes["height"].Value);
        }
    }
}
mainContent.Text = doc.DocumentNode.InnerHtml;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So what's going on here? Well first I create a new HtmlDocument, provided by the HTMLAgilityPack. I then load my html from my db model, page.body, then I use a nice simple XPATH syntax to pull out any img tags within the content and stick them into a HTMLNode collection. Next after ensuring I have some nodes, I spin through each of them and check to see if they have a height and width attribute. If they do then I use these and the original image url to write a new url, in my case I have a page that does this, ideally though this should be a httpmodule or something to be nice and tidy. Then with the img tags updated I render the HtmlDocument back out to the page.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;That's it, a few line's of code. Now I was concerned I may have slowed down my page, as parsing and spinning through tag's could be CPU intensive however I found on my machine and quickly playing with it, I noticed no real difference. In production I'd output cache the page for a period of time anyway.  I noticed 100KB difference on one of my site's home pages and they weren't massive images, so I think it's well worth it.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;There you have it, at the end of the day CMS's provide users with alot of power / flexibility but we have to ensure as developers that we provide systems that cater for users abusing the system, be this uploading massive images or otherwise. In the case of images simply having something that resizes the images on render keeps the frontend responsive whilst allowing the client to provide high resolution images if needed, in this case it wasn't alot of effort and the improvement alone was worth it.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-7984913403365894523?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/kJs33tpr8vY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/7984913403365894523/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=7984913403365894523" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/7984913403365894523?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/7984913403365894523?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/kJs33tpr8vY/wasting-bandwidth-one-image-at-time.html" title="Wasting Bandwidth One Image at a Time...." /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/05/wasting-bandwidth-one-image-at-time.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MARnY6fSp7ImA9WxJSEE4.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-7464182670203149271</id><published>2009-04-29T15:01:00.002Z</published><updated>2009-04-29T21:10:47.815Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-29T21:10:47.815Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="HTTP Headers" /><category scheme="http://www.blogger.com/atom/ns#" term="internet explorer" /><category scheme="http://www.blogger.com/atom/ns#" term="Content-Disposition" /><category scheme="http://www.blogger.com/atom/ns#" term="VBScript" /><category scheme="http://www.blogger.com/atom/ns#" term="chrome" /><category scheme="http://www.blogger.com/atom/ns#" term="google chrome" /><category scheme="http://www.blogger.com/atom/ns#" term="Firefox" /><title>Content Disposition in different browsers</title><content type="html">&lt;p&gt;Today I had to resolve an issue where in different browsers the filed dynamically generated download worked very differently / at all&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The setup, we had an xml file with a custom extension, say .mj, which was being served up by ASP. The HTTP Header had a content disposition header and a response type set.&lt;/p&gt;
&lt;pre&gt;&lt;code class="vbscript"&gt;
Response.AddHeader "Content-Disposition", "attachment; filename=""our file.mj"""
Response.ContentType = "text/xml"
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This worked fine in Internet Explorer, the file was downloaded as "our file.mj". However FireFox and Chrome acted very differently, in FireFox the file was downloaded as just "our", and Chrome as "our file.xml".&lt;/p&gt;
&lt;p&gt;In FireFox it appears that the issue is caused by having a space in the file name, this &lt;a href="http://www.webmaster-talk.com/asp-forum/35962-content-disposition-does-nto-work-firefox.html"&gt;forum post by funkdaddu&lt;/a&gt; helped me on this, so by removing the space FireFox could now download the file as "ourfile.mj".&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Chrome however did not want to play ball. It was still insisting on changing the file extension to ".xml". I guessed it was because we were telling it we serving up text/xml mime/type under a different file extension, I decided to change the response type to "Application/Save" just to see if this would make a difference, and amazingly it did. Amazing!&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So there we have it, changing the file name to have no spaces and ensuring that the content type is set to "Application/Save" seems to make all browsers behave at least some what consistently with the Content Disposition header. Its worth noting that Scott Hanselman has a great blog post &lt;a href="http://www.hanselman.com/blog/TheContentDispositionSagaControllingTheSuggestedFileNameInTheBrowsersSaveAsDialog.aspx"&gt; The Content Disposition Saga&lt;/a&gt; which talks alot about how the different of IE handles it. Also GreenBytes has a ton &lt;a href="http://greenbytes.de/tech/tc2231/"&gt;Test Cases for HTTP Content-Disposition header&lt;/a&gt; which I certainly found helpful.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-7464182670203149271?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/0Yfm7VXyAlE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/7464182670203149271/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=7464182670203149271" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/7464182670203149271?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/7464182670203149271?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/0Yfm7VXyAlE/content-disposition-in-different.html" title="Content Disposition in different browsers" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/04/content-disposition-in-different.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQMRXYzfip7ImA9WxJTFU0.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-4619397270534402443</id><published>2009-04-23T15:59:00.010Z</published><updated>2009-04-23T16:33:04.886Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-23T16:33:04.886Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SiteMaps" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="Lamda Expressions" /><category scheme="http://www.blogger.com/atom/ns#" term="LINQ" /><title>Looking for a URL using Linq and SiteMaps</title><content type="html">&lt;p&gt;I've been off sick from work with Man Flu but this afternoon I was getting bored of staying in bed for the second day so I got out my laptop just to have a play in between blowing my nose.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I wanted to write a quick way of looking up the full url path for a page within a sitemap. The only bit of information I know is the key of the page. Now I knew that I could possibly make use of the IndexOf method. This expects a SiteMapNode of the value you are looking for and returns the index of the node, you then need to get the node out of your collection of nodes, example below.&lt;/p&gt;
&lt;pre&gt;
&lt;code class="c#"&gt;
SiteMapNodeCollection nodes = SiteMap.RootNode.GetAllNodes();
int nodeIndex = nodes.IndexOf(new SiteMapNode(SiteMap.Provider, pagekey));
return nodes[nodeIndex].Url ?? String.Empty;
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Now that method does work, however it felt dead clunky, I was sure I could write a more .Net 3.5 shiny one line way of doing this using Linq. In fact it was dead easy. First I still needed to get all the nodes, SiteMap.RootNode.GetAllNodes(), but I then cast these to SiteMapNode, I could then use FirstOrDefault with a nice lambda expression that matches the key property. Code below. &lt;/p&gt;
&lt;pre&gt;
&lt;code class="c#"&gt;
SiteMapNode node = SiteMap.RootNode.GetAllNodes().Cast&lt;SiteMapNode&gt;().FirstOrDefault(n =&gt; n.Key.Equals(pagekey));
return node != null ? node.Url : String.Empty;
//note: the &amp;lt;/sitemapnode&amp;gt; is not part of the code, the code highlighter JS is randomly adding it.
&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;Simple, my only concern is that the bigger the sitemap becomes the more memory / slower this becomes, especially if called multiple times per page. It may make sense to cache the sitemapnodecollection for the duration of the page however that's beyond the scope of this brief article.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;What hopefully you can see though is that a little bit of Linq and Lambda expressions can take chunks of code that seem long winded and turn them into nice neat one liners, which I think is usually more readable.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-4619397270534402443?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/jZm5WMkfWzQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/4619397270534402443/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=4619397270534402443" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/4619397270534402443?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/4619397270534402443?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/jZm5WMkfWzQ/looking-for-url-using-linq-and-sitemaps.html" title="Looking for a URL using Linq and SiteMaps" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/04/looking-for-url-using-linq-and-sitemaps.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkYMRnk9eyp7ImA9WxJTFEw.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-8482039109862020040</id><published>2009-04-22T13:25:00.004Z</published><updated>2009-04-22T14:23:07.763Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-22T14:23:07.763Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVC" /><category scheme="http://www.blogger.com/atom/ns#" term="Packt" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET MVC" /><category scheme="http://www.blogger.com/atom/ns#" term="Book Review" /><title>Book Review: ASP.Net MVC 1.0 Quickly</title><content type="html">&lt;p&gt;So this month I again have the privaledge of writing another book review. This time in an area I have particular interest. ASP.Net MVC has recently been released and there are no end of books coming out of the market, one of these being &lt;a href="http://blog.maartenballiauw.be/"&gt;Maarten Balliauw&lt;/a&gt;'s &lt;a href="http://www.packtpub.com/asp-net-model-view-controller-1-0-quickly/book/mid/300309msa6ak"&gt;ASP.NET MVC 1.0 Quickly.&lt;/a&gt;&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;When the book arrived I first noted how it used the traditional orange Packt colour scheme with an interesting picture of a pair of glasses on the beach. This I preferred over the look of the &lt;a href="http://urls.mjjames.co.uk/bookreview1"&gt;last book I reviewed&lt;/a&gt;, however I am yet to work out the significance of the picture if there even is one?&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;The book starts by saying that the book will take you through "the essential tasks" and "does not cover every single feature in detail". This is my opinion is not a bad thing. It is not a full reference book like ... but more of a rapid guide to get developers to start using MVC and know the basics preety much everything, you can then get the in depth knowledge as you go along.&lt;/p&gt; &lt;br /&gt;
&lt;p&gt;The book covers the following topics, not necessarily in order:
&lt;ul&gt;
&lt;li&gt;What MVC Is&lt;/li&gt;
&lt;li&gt;Brief comparison between ASP.NET web forms and ASP.NET MVC&lt;/li&gt;
&lt;li&gt;What a Controller, View and Model is and how you go about creating them in VS&lt;/li&gt;
&lt;li&gt;What the process of a page is and how you handle interactions&lt;/li&gt;
&lt;li&gt;What is routing and what you can do with it&lt;/li&gt;
&lt;li&gt;Customizing the framework&lt;/li&gt;
&lt;li&gt;Using Web Forms features in MVC&lt;/li&gt;
&lt;li&gt;JQuery and AJAX in MVC&lt;/li&gt;
&lt;li&gt;Testing and Mocking&lt;/li&gt;
&lt;li&gt;Deployment&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;p&gt;It then has three appendices which I recommend NOT skipping, It has a full application with source code, information on the MockHandlers available and finally tons of links on where to get more information on topics. The links help to fill in the gaps that the book has left due to its "quickly" approach and for me at least have been the most thumbed pages of the book.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The format of the book is very clear, lots of examples in C#, screenshots where appropiate and well worded. In particular I like areas where Maarten Balliauw takes the time to explain all the options for an attribute. For example in Chapter 4 he outlines Action Method Attributes, rather than just give a brief description of what they are, Marten takes the time to outline briefly all the possible attributes with a simple piece of source code if appropiate. Again this highlights how the book is just trying to make you aware of what exists so when you come to write something you think about what you could use and then go away and find out more if needed. &lt;/p&gt; &lt;br /&gt;
&lt;p&gt;I have to admit I really like the book as an intro into MVC and to get people aware of it, it highlights alot and get's you thinking about design methodologies. It's one I recommend others to read.&lt;/p&gt;
&lt;h3&gt;Scores&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Presentation&lt;/strong&gt; 8/10 - Overall this book feels well put together and everything is clearly laid out&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code Examples&lt;/strong&gt; 9/10 - Quite a high score for this, the book it littered with short code snippets and examples but what really does it for me is the example application included in the appendices. Simply working through this highlights everything you have read so far and highlights more. Well worth looking at&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Quality of Content&lt;/strong&gt; 8/10 - Again repeating what I have said earlier but I feel the content has been well put together and arranged in a manner that is clear and conjusive to learning &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Overall&lt;/strong&gt; 8/10 - If you are looking at just finding out about this ASP.NET MVC is all about and just want an outline to get you started this book is for you. It's not claiming to be a reference but a starting block to use to get you started, the links in the back give you some where else to go afterwards. Well worth a read.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-8482039109862020040?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/s9OlPmHsNYA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/8482039109862020040/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=8482039109862020040" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/8482039109862020040?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/8482039109862020040?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/s9OlPmHsNYA/book-review-aspnet-mvc-10-quickly.html" title="Book Review: ASP.Net MVC 1.0 Quickly" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/04/book-review-aspnet-mvc-10-quickly.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQGRn8zcSp7ImA9WxVbEkg.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-2304360371535140643</id><published>2009-03-28T14:41:00.005Z</published><updated>2009-03-28T14:58:47.189Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-28T14:58:47.189Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Google SiteMap Generator" /><category scheme="http://www.blogger.com/atom/ns#" term="IIS" /><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks" /><category scheme="http://www.blogger.com/atom/ns#" term="Google" /><title>Google SiteMap Generator + Input validation failed Error</title><content type="html">&lt;p&gt;Since Google release their &lt;a href="http://code.google.com/p/googlesitemapgenerator/"&gt;Google Site Map Generator&lt;/a&gt; I have been using it on my web server for the sites that I manage. Setting it up and getting it running was fine and I haven't had a problem, that was until this week. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;This week I noticed that as I was only letting the generator update the sitemap from actual URL hits quite often a few of my sites aren't hit for a day at a time which was resulting in empty sitemaps. This then causes Google WebMaster Tools to whinge at you which isn't a good thing. So I decided to update my settings to include parsing my IIS Log Files in the hope it would use previous days ones and not generate blank files.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;This is where I hit a road block. When ever I changed a setting and clicked save the generator would be really useful and tell me that "Input Validation Failed" and to basically sort myself out. I was confused to say the least as everything was fine, no field was highlighted as being erroneous so I ended up giving up and leaving it.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Today I came back to it and tried again but the same error occurred. So I started to poke around and decided to manually update the sitesetttings xml file, usually located: C:\Program Files (x86)\Google\Google Sitemap Generator\sitesettings.xml. And this is when I noticed the issue that was affecting me.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Each site within your IIS setup has a node in the sitesettings xml file, here it has information about it's host name, whether it's setup for sitemaps etc. But it also contains the location of the IIS log files regardless of whether you are parsing them or not. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Now a few weeks ago I decided to move all my sites log files from the default location of C:\WINDOWS\system32\LogFiles\{site} to a more convenient location, for this example lets say E:\LogFiles\{site}, now this was all well and good for IIS etc but upon creation of sites the Google SiteMap Generator is logging these locations. So when I had moved the log files the generator was still looking at the old location, a bit of guessing / how I would do it lead me to believe that upon saying parse log files for sitemaps the generator checks to see if it can read the log files, but as they have moved it cant find them and errors. &lt;/p&gt;
&lt;br  /&gt;
&lt;p&gt;Now all I did to fix this was manually do a find and replace on the log file locations within sitesettings.xml saved the file and restarted the generator to find it was finally happy and working OK. Hopefully Google in the next release of this generator will remove this issue / make it clearer what is wrong. Ideally upon startup or even when you choose to use log file parsing it should look at IIS to see if the path to the log files is the same as it has, if not update it before it validates. This would save heartache for a few people at least.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So I'm now happy again with the generator, the problem wasn't that hard to fix and upon spotting it made alot of sense, it just shows what a little bit of investigating can do.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-2304360371535140643?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/75SCPiseNH0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/2304360371535140643/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=2304360371535140643" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2304360371535140643?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2304360371535140643?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/75SCPiseNH0/google-sitemap-generator-input.html" title="Google SiteMap Generator + Input validation failed Error" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/03/google-sitemap-generator-input.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMAQ3g-eSp7ImA9WxVUFUU.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-4411462165568124196</id><published>2009-03-20T19:55:00.008Z</published><updated>2009-03-20T20:20:42.651Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-20T20:20:42.651Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Threading" /><category scheme="http://www.blogger.com/atom/ns#" term="Packt" /><category scheme="http://www.blogger.com/atom/ns#" term="Books" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Book Review" /><category scheme="http://www.blogger.com/atom/ns#" term="Multi Threading" /><title>Book Review: C# 2008 and 2005 Threaded Programming</title><content type="html">&lt;p&gt;So last month &lt;a href="http://www.PacktPub.com"&gt;Packt Publishing&lt;/a&gt; contacted me regarding sending me a promotional copy of &lt;a href="http://www.packtpub.com/beginners-guide-for-C-sharp-2008-and-2005-threaded-programming/book"&gt;C# 2008 and 2005 Threaded Programming&lt;/a&gt; to review. This is the first time I have been asked to do a book review and decided to take them up on the offer.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
Now I have been using ASP.Net for around three years now but I've never had to or decided to look into writing multi-threaded apps so the fact that this book was aimed at beginners meant that I was an ideal target audience for this book.
&lt;a href="http://www.PacktPub.com"&gt;Packt&lt;/a&gt; shortly sent me the book and upon first looking at it thought it looked a bit ugly! I know you can't tell a book by its cover but this cover did put me off, the green and picture didn't do it for me but alas I carried on anyway.&lt;/p&gt;
&lt;br/&gt;
&lt;p&gt;
The book is organised into several chapters and is example driven. What I mean by this is that it doesn't give you bags of theory and then an example, it takes the approach of you following along the code examples and then it has gaps explaining bits and pieces. More on this later. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
The chapters within the book are organised in a way that as you progress each chapter delves into multi threading more. First of all it explains what multi threading is, then it looks as basic thread techniques, background workers, debugging multi threaded apps, thread pools all the way up to exploring the new future of multi threaded apps and new framework extensions to help with this. On the whole the chapter organisation made a lot of sense to me and allowed you to use what you had learnt before and build upon it. The one thing that struck me was that I expected ThreadPools to be talked about way before chapter 9 but that’s a minor thing.&lt;/p&gt;
&lt;br/&gt;
&lt;p&gt;
One of the things I especially liked about this book is that at the end of each chapter you are given a quick pop quiz on the chapters content, this for me at least provided a quick way of ensuring I had understood the chapter and if I hadn't to go back and re read it, so this was good.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
As I mentioned earlier the book is based on learning using examples and less about theory. Personally I'm not a huge fan of this technique; the writer Gastón C. Hillar does try to provide examples that are practical however I find that by simply following these you don't really learn what is going on; you learn how threading roughly works and that it’s there but when you need to use it in a real life application or you need to work out why something isn't working as expected you are left without the knowledge to solve these issues. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I do realise that this book is for beginners and is meant to get developers to look into and start writing multi-threaded apps and not be a complete resource, but personally I would prefer a touch more theory. In particular locking is over looked, what setting a WinForms app to [MTAThread] really means (you can't use dialogues for example). This was probably left out to try and keep things simple for beginners but not discussing locking or exceptions could mean bad practices are picked up and carried into production code.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;It is worth mentioning that his book solely focuses on WinForm apps, it doesn't look into WPF or WebForms, and this is both a blessing and a curse in my eyes. With that said  WinForms is simple to learn and the examples really do cover everything you need to get them working so if you have never used WinForms don't be put off reading this book, by the end of it you will not only know more about multi-threading but also how to write simple WinForm apps. &lt;br /&gt; Also the book says that you can use Visual Studio 2008 Standard edition to debug multi threaded apps, I found out that sadly this isn't the case. In order to have the threads debug window you need the Pro edition or above version of Visual Studio.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt; 
Overall I find the book alright, personally the presentation of the book, colour schemes, internal typography could do with an improvement, the headings look like they are in Impact which is wrong on so many levels, and the examples can seem slightly farfetched but the book does cover a lot. As someone new to multi-threading by the end of it I felt confident enough in what I had learnt to write a simple multi threaded WinForm app for work to perform some tests. &lt;/p&gt;
&lt;br /&gt;
&lt;h3&gt;Scores&lt;/h3&gt;
&lt;p&gt;
&lt;span style="font-weight:bold;"&gt;Presentation&lt;/span&gt; - 6 / 10 - Although it’s clear to read the bulk of the content, the cover and headings for me let it down. &lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;Code Examples&lt;/span&gt; – 7/10 – The code examples are clearly written and cover all the detail you need I feel that they aren’t as real life as they could be which hinders taking what they are meant to show you and apply it to real life scenarios. &lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;Quality of Content&lt;/span&gt; – 7/10 – Overall I felt the quality content was quite good, potentially a bit over the top in places about being a “multi threaded guru” but overall OK. One down fall was to say that Visual Studio Standard edition can be used to debug multi threaded apps when it can’t. &lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;Overall&lt;/span&gt; - 6.5 / 10
In light of everything I'm not going to suggest this is a book that everyone should read / own unlike over books like the pragmatic programmer etc. However if you are looking at learning about multi-threading and want something to ease you into it then this is for you, it will cover the basics of everything you need to know and what to expect in the future.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-4411462165568124196?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/BALnFnylBqY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/4411462165568124196/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=4411462165568124196" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/4411462165568124196?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/4411462165568124196?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/BALnFnylBqY/book-review-c-2008-and-2005-threaded.html" title="Book Review: C# 2008 and 2005 Threaded Programming" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/03/book-review-c-2008-and-2005-threaded.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEEFQ345cCp7ImA9WxVUFU0.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-5103424350374349206</id><published>2009-03-19T23:35:00.004Z</published><updated>2009-03-19T23:50:12.028Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-19T23:50:12.028Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="MVC" /><category scheme="http://www.blogger.com/atom/ns#" term="Build Error" /><category scheme="http://www.blogger.com/atom/ns#" term="Data Type" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks" /><title>MVC Snippets: must be a reference type in order to use it as parameter 'TModel' in the generic type or method 'System.Web.Mvc.ViewUserControl'</title><content type="html">&lt;p&gt;Recently I have been playing with &lt;a href="http://asp.net/mvc"&gt;ASP.NET MVC&lt;/a&gt;, in particular I have been building myself a new website. I thought it might be good to post any peculiar things / lessons I learn during this build. Tonight I stumbled across one of these lessons. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
When you strongly type a view or partial view the type must be a reference type. Otherwise this means you get a HttpCompilation Error: "your data type" must be a reference type in order to use it as parameter 'TModel' in the generic type or method 'System.Web.Mvc.ViewUserControl&lt;TModel&gt;'. Initially I couldn't figure out what this meant as I was passing my type through, it existed etc. However it was then I realised I had declared my type as a struct not a class.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
If you are unsure of the difference between a class and a struct I recommend looking it up, the gist of it is that a class is a reference type and a struct isn't. As a struct isn't a reference type you can save memory due to it not having to allocate additional memory for referencing each object, this is great for short structures, but not for models in ASP.Net MVC
&lt;/p&gt;
&lt;p&gt;After changing my type to a class all was sorted and my view could compile again. A lesson learned, one of many I am sure ;) &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-5103424350374349206?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/WyHV9AXQXCE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/5103424350374349206/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=5103424350374349206" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/5103424350374349206?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/5103424350374349206?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/WyHV9AXQXCE/mvc-snippets-must-be-reference-type-in.html" title="MVC Snippets: must be a reference type in order to use it as parameter 'TModel' in the generic type or method 'System.Web.Mvc.ViewUserControl&lt;TModel&gt;'" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/03/mvc-snippets-must-be-reference-type-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0ENSXsyfip7ImA9WxVUFE0.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-1170086849265925931</id><published>2009-03-18T19:38:00.003Z</published><updated>2009-03-18T19:48:18.596Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-18T19:48:18.596Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="openhackdaylondon" /><category scheme="http://www.blogger.com/atom/ns#" term="Yahoo" /><category scheme="http://www.blogger.com/atom/ns#" term="Hack Day" /><title>Open Hack Day 2009</title><content type="html">&lt;p&gt;Well today registration for &lt;a href="http://www.wait-till-i.com/2009/03/18/open-hack-day-london-9th-and-10th-of-may-signup-now-open/"&gt;Yahoo! Open Hack Day 2009&lt;/a&gt; opened, and with much excitement I signed up hoping for a place. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The previous Hack Day was really great fun even though my "hack team" failed to finish our project. This year I'm hoping to do something a lot simpler but as enjoyable.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Here's open I get a place ;)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-1170086849265925931?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/5hJGXsBScaQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/1170086849265925931/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=1170086849265925931" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/1170086849265925931?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/1170086849265925931?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/5hJGXsBScaQ/open-hack-day-2009.html" title="Open Hack Day 2009" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/03/open-hack-day-2009.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8BQXc7cCp7ImA9WxVXGUw.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-2987263224122932236</id><published>2009-02-15T19:51:00.004Z</published><updated>2009-02-17T23:54:10.908Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-17T23:54:10.908Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks" /><category scheme="http://www.blogger.com/atom/ns#" term="DataTypes" /><category scheme="http://www.blogger.com/atom/ns#" term="XML" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Parsing an XML Boolean</title><content type="html">&lt;p&gt;Today I came across a situation where I was taking a value from an XML file which is a boolean. Now being me I knew that someone would either use 1 or true to indicate this boolean value, I for example always use 1 and 0 but I know people that prefer the "proper" way of saying true or false, especially if you don't have an XSD handy.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The XML itself is fine however once I had loaded this XML file into my .Net application I needed to parse the value as a boolean. This is where I hit a roadblock. Bool.Parse will only parse "true" or "false" string values not "1" or "0". &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;A quick explore through various sources led me to find &lt;a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlconvert.aspx"&gt;XmlConvert&lt;/a&gt;.ToBoolean(), which is part of System.XML. XmlConvert allows you to convert from XML Data Types to .Net Data Types and in the case of Boolean can convert 1 to true.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;This saved me loads of time so I thought I'd post it up here for others to find and hopefully enjoy.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-2987263224122932236?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/rp8sxxoTeEA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/2987263224122932236/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=2987263224122932236" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2987263224122932236?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2987263224122932236?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/rp8sxxoTeEA/parsing-xml-boolean.html" title="Parsing an XML Boolean" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/02/parsing-xml-boolean.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4FRH05eCp7ImA9WxVQEEs.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-840540208237844335</id><published>2009-01-24T11:33:00.009Z</published><updated>2009-01-27T13:28:35.320Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-27T13:28:35.320Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Battery" /><category scheme="http://www.blogger.com/atom/ns#" term="Hardware Interupts" /><category scheme="http://www.blogger.com/atom/ns#" term="Interupts" /><category scheme="http://www.blogger.com/atom/ns#" term="WIndows 7" /><title>Where's all my battery gone? / Windows 7 Hardware Interupts</title><content type="html">&lt;p&gt;So I got the Windows 7 Beta as soon as it came out and installed it on my laptop to give it proper "real world" testing, not a VM or a machine I use rarely. I chose to do this as it means I can give Microsoft proper feedback and if it all goes wrong I can simply reinstall Vista clean and restore data from the previous night&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I have to say I really like windows 7, the UI changes do work for me, I like some of the new features and on the whole I'm happy with it. But this post isn't going to be about my last two weeks of running Windows 7, I'm already writing that post and need to finish it when I'm happy I've gave a real world usage. This post is about how since I've installed Windows 7 my battery life sucks.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Now this isn't a rant, instead I want to highlight how I found out that something was wrong with my install.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So when I started using Windows 7 I noticed that my system kept slowing down, I soon fired up Task Manager and found that AVG antivirus, I use the free edition for Home Users, was eating a large chunk of my CPU, it seems it was always running around 30% if not more. I checked the Windows 7 Blog and found they had a list of compatible anti virus solutions, AVG was one however it didnt indicate if the free version was so I decided to remove AVG and try the Kapersky beta instead. &lt;/p&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_S05-HU5Oqxw/SXr_tL5ce-I/AAAAAAAAAus/OkiwmqOzN6I/s1600-h/taskmanager-core0.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 287px; height: 320px;" src="http://1.bp.blogspot.com/_S05-HU5Oqxw/SXr_tL5ce-I/AAAAAAAAAus/OkiwmqOzN6I/s320/taskmanager-core0.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5294825463680367586" /&gt;&lt;/a&gt;
&lt;p&gt;After doing this the system did feel more responsive so I was happy with this and thought this was then end of it. However this week, in particular the last 3 days I noticed that my battery was running out in 60 mins or less, normally I get at least 1.5 hours, 2 if in "power saver" mode. Initially I pondered if the power profiles were running properly, I checked these and all seemed fine, "balanced" mode whilst running on battery would set the minimum cpu usage to 5%, all seemed well.&lt;/p&gt;
&lt;br /&gt;

&lt;p&gt;This morning I decided to look into this battery issue further, I started Task Manager and nothing seemed to be using the CPU but when I looked at the performance task I saw something very peculiar, see the image to the right, Core 0 was running at all times at 90%! This must be the cause of the battery being depleted so quickly, if the core is always active the power saving features can't kick in, thus burning good old power cells.&lt;/p&gt;
&lt;br style="clear: both;" /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_S05-HU5Oqxw/SXsClvU4D9I/AAAAAAAAAu0/x5sBsdc1frs/s1600-h/processMonitor.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 266px;" src="http://4.bp.blogspot.com/_S05-HU5Oqxw/SXsClvU4D9I/AAAAAAAAAu0/x5sBsdc1frs/s320/processMonitor.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5294828634286591954" /&gt;&lt;/a&gt;
&lt;p&gt;Unfortunately task manager wasn't showing what was using the CPU, not even showing processes from all users helped. So I went and got the only application you need to investigate memory leaks or CPU usage, &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx" rel="external"&gt;process explorer&lt;/a&gt;. Upon firing this up I saw straight away the culprit, Interupts which is part of the System Idle Process and handles all Hardware Interupts was constantly eating ~40% CPU!&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Now here's the problem, this is a system process, which has no threads, it's core, there's no easy way (that I'm aware of), to find what is causing the Interupts to constantly burn CPU, I looked at shutting everything down that could be causing the issue, my thoughts were the animated Synaptics TrackPad icon, as this responds to your input, the On Screen Display program that indicates when you turn Caps Lock on/off etc, but still nothing changed.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt; This sadly looks like a Windows 7 issue and one that may force me to reinstall my laptop back to Vista, has anyone else found had this issue or know what causes it? If so leave a comment, in the mean time I'm going to report the issue to the Windows 7 guys and I'll update this post if I hear anything back.&lt;/p&gt;
&lt;br/&gt;
&lt;h2&gt;Update: &lt;/h2&gt;
&lt;p&gt;Well it looks like this is now solved, Intel have released a new Chipset Driver :
Intel Corporation driver update for Mobile Intel(R) 965 Express Chipset Family (Prerelease WDDM 1.1 Driver), this is an optional update for Windows 7, hence how I managed to miss it the first time I checked, so there it is if you find Hardware Interupts are cooking your CPU check for an updated Chipset driver, helped me out anyway. &lt;/p&gt;
&lt;h2&gt;Further Update - 27/01/2009&lt;/h2&gt;
&lt;p&gt;Much to my dismay this issue is still present, the driver update seemed to make things better however if my laptop goes to sleep and then I resume the issue reoccurs, hopefully Intel may release an updated driver to fix this issue....&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-840540208237844335?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/gSr45fhtJ-s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/840540208237844335/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=840540208237844335" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/840540208237844335?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/840540208237844335?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/gSr45fhtJ-s/wheres-all-my-battery-gone-windows-7.html" title="Where's all my battery gone? / Windows 7 Hardware Interupts" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_S05-HU5Oqxw/SXr_tL5ce-I/AAAAAAAAAus/OkiwmqOzN6I/s72-c/taskmanager-core0.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/01/wheres-all-my-battery-gone-windows-7.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQFRXc_eip7ImA9WxVRFUk.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-6461430691029011683</id><published>2009-01-21T13:46:00.003Z</published><updated>2009-01-21T13:58:34.942Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-21T13:58:34.942Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="VS2008" /><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio" /><title>Visual Studio Welcome Screen</title><content type="html">&lt;p&gt;Today a colleague noticed that whilst he was debugging his web application random requests were being made to Microsoft, these requests were also returning a HTTP/1.1 301 Moved Permanently header, and apart from being annoying was causing him a few issues.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;From experience I soon realised that these requests were being made by the Visual Studio Welcome Screen. By default even if you don't use the welcome screen, Visual Studio keeps the Start Page News Channel RSS Feed up to date, the default in every 60 minutes. If you aren't using the welcome screen then its probably worth disabling the RSS feeds auto download content functionality, not only will this stop you seeing random requests, if you even notice them, but if you are working on a mobile and pay per KB save you some bandwidth.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;To disable the auto content update simply: goto Tools &gt; Options, click the Show All Settings checkbox, then under the Environment leaf find Startup. Once here simply untick the "download content every" check box. You can also configure it to update less frequently, alter the news channel location, for example you may prefer to use the &lt;a href="http://dotnetshoutout.com/" rel="external"&gt;DotNetShoutOut&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/Dotnetshoutout-Published" rel="external" title="DotNetShoutOut RSS Feed"&gt;RSS Feed&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-6461430691029011683?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/G0kzBGoKpxQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/6461430691029011683/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=6461430691029011683" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/6461430691029011683?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/6461430691029011683?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/G0kzBGoKpxQ/visual-studio-welcome-screen.html" title="Visual Studio Welcome Screen" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/01/visual-studio-welcome-screen.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8ERnc9fip7ImA9WxVRE0o.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-2707522879969500629</id><published>2009-01-19T14:07:00.004Z</published><updated>2009-01-19T14:20:07.966Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-19T14:20:07.966Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Windows Scripting Component" /><category scheme="http://www.blogger.com/atom/ns#" term="WSC" /><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio" /><title>Syntax Highlighting and Intellisense for WSC Files in Visual Studio 2008</title><content type="html">&lt;p&gt;Recently I've been working on a system that makes use of custom WSC components. These components contain the usual XML Wrappings and then a large CDATA area containing the VBScript code. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;What's really been bugging me is that Visual Studio was treating all the code within the CData XML Area as XML and I really want the VBScript to be all nice and highlighted and for VBScript intellisense to kick in, it really does save time. Now luckily making this happen was remarkably easy.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;First within Visual Studio go to tools and options, click Show All Settings. Then open the Text Editor leaf and click on File Extension. Next add a new option for wsc files and specify that you wish it to use the Web Form Editor as it's editor. Click Add and then OK. You should now find when you next open a wsc file the XML has syntax highlighting as well as the VBScript, and intellisense works! &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I hope this helps you, it certainly did me!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-2707522879969500629?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/GU6tfp0AI30" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/2707522879969500629/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=2707522879969500629" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2707522879969500629?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2707522879969500629?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/GU6tfp0AI30/syntax-highlighting-and-intellisense.html" title="Syntax Highlighting and Intellisense for WSC Files in Visual Studio 2008" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2009/01/syntax-highlighting-and-intellisense.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8MRXY_fCp7ImA9WxRUE0g.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-8669023848091473863</id><published>2008-11-22T11:00:00.003Z</published><updated>2008-11-22T11:21:24.844Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-22T11:21:24.844Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vista" /><category scheme="http://www.blogger.com/atom/ns#" term="Tips and Tricks" /><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate" /><title>Windows Vista + Loosing the Ability to Hibernate</title><content type="html">&lt;p&gt;I'm one of the few people I know that use the Hibernate feature on my laptop. I find its helpful when shutting down for the evening but want to resume exactly where I left off the next day. Sleep even S3 doesn't work for me as I often find my battery depletes as on this laptop it is shockingly poor.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The other day I was performing some basic maintainence and decided to run disk cleanup to see if it was any better than XP's counterpart, it ran well and asked me would I like to remove my hibernate file. This is where my troubles began, I expected the file to be recreated upon my next hibernate, however what did happen was hibernate ceased to exist on my start menu.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;After much hunting through the Control Panel I was unable to find a definitive option to renable the hibernate file, power options was all setup to hibernate however I was still unable to hibernate. I then found a simple command line setting you need to run to renable it, or even turn it off if that is your desire.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;First open a command prompt window in administrative mode, its annoying when you forget to do this, then simply run the following: powercfg -H ON. The -H switch indicates hibernate and then its a simple on  off. And that's it Hibernate restored and my laptop is back to it's normal self, good stuff.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-8669023848091473863?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/rzt_GUMCda0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/8669023848091473863/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=8669023848091473863" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/8669023848091473863?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/8669023848091473863?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/rzt_GUMCda0/windows-vista-loosing-ability-to.html" title="Windows Vista + Loosing the Ability to Hibernate" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2008/11/windows-vista-loosing-ability-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYDQH4yfSp7ImA9WxRUEEk.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-1789396624578367360</id><published>2008-11-18T20:10:00.007Z</published><updated>2008-11-18T21:02:51.095Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-18T21:02:51.095Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SIte Maintainence" /><category scheme="http://www.blogger.com/atom/ns#" term="HTTPModule" /><category scheme="http://www.blogger.com/atom/ns#" term="IIS" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET" /><category scheme="http://www.blogger.com/atom/ns#" term="IP Restriction" /><title>Site Maintainance and IP Restriction</title><content type="html">&lt;p&gt;There are times during many site's life that you must perform some maintainence on the database / code, and allowing people to have access to the site whilst doing this must be restricted. Often most updates / upgrades can occur on the fly without any down time but there are occasions when you need to do this. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Usually I logon to my web server and IP Restrict the site to my IP Address and let IIS provide a default message to users that try to access the site during this period. Now although this works I often find it cumbersom, I have to have access to the web server, I need to find out my IP address, as I don't have a static one at home, and the entire process can be quite long. It's even worse if its for a site that I don't host and can't IP Restrict through IIS.&lt;/p&gt;

&lt;h2&gt;Another Way&lt;/h2&gt;
&lt;p&gt;Tonight I decided to explore a better way of doing this, and as such I've came up with a simple HTTPModule that you can stick into your ASP.Net Web Application which will handle IP Restrictions for you.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;In order to maximise the use / potential of this module I've enabled it to do two things, first to allow conigurable IP Restrictions but secondly to specify whether the restriction is for a temporary basis, I.E the sites under maintainence, or whether this is a perminant block.&lt;/p&gt;

&lt;h2&gt;The Code&lt;/h2&gt;
&lt;p&gt;The code for this module is actually pretty simple. First of I created a class called IPRestrict and implemented the basic IHttpModule interface&lt;/p&gt;

&lt;pre&gt;&lt;code class="c#"&gt;
namespace mjjames.HttpModules
{
 public class IPRestrict : IHttpModule
 {


  public void Init(HttpApplication context)
  {
                }

  public void Dispose()
  {
  }
 }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With the basic interface I added a event handler to the init method that on BeginRequest, when a request starts to be processed, call Application_BeginRequest. Application_BeginRequest takes the user's IP Address from the Request object and passes this to ValidIP. ValidIP by default returns that the IP is valid, the site isn't using IP Restriction, however if the site's web.config has an app setting called "IPRestrict" then the provided ip address is searched for in the app setting.&lt;/p&gt;

&lt;pre&gt;&lt;code class="c#"&gt;
private bool ValidIP(string ipaddress)
  {
   bool bValidIP = true; 
   if(!String.IsNullOrEmpty(ConfigurationManager.AppSettings["IPRestrict"])){
    bValidIP = ConfigurationManager.AppSettings["IPRestrict"].Contains(ipaddress);
   }

   return bValidIP;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The reason i decided to perform a contains function on the app setting for the ip address was so that I could ignore the IP Address delimiter within the app setting. This way whether you seperate valid IPs with a comma, a space, a comma space etc it doesn't matter, as long as the IP is within the app setting it is returned as valid&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;As far as the IP Check goes that's it, however in order to make the module more usable and user friendly Application_Request can use an additional two app settings from the Web.Config. "MaintainenceMode" is boolean setting which indicates the IP Restriction is in use due to maintainence, if the setting is not provided then the module assumes this is not the case by default. Maintainence Mode changes the HTTP Response Status Code for the request, by default IP Restriction means the end user recieves a 403 status code, forbidden, however whilst in Maintainence Mode a 503 status code is delivered to indicate the service / site is temporarily unavailable.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The second app setting used in Application_Request is "CustomIPRestrictMessage". This setting as the name implies is used to provide a custom IP restriction message to the user instead of te default.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;The module is really simple to use, simply add the &lt;a href="http://development.mjjames.co.uk/scripts/aspnet/downloads/mjjames.httpmodules.zip" title="Download IPRestrict HTTP Module"&gt;mjjames.HttpModules dll&lt;/a&gt; to your project as a reference and update your web.config to include the app settings. Along with the app setting the HttpModule needs adding to the HTTPModules section of the web.config, find an example of how to do this below&lt;/p&gt;

&lt;pre&gt;&lt;code class="xml"&gt;
&lt;add name="IPRestrict" type="mjjames.HttpModules.IPRestrict, mjjames.HttpModules"/&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's it hopefully you'll find the module easy to use. Currently it doesn't do IP Ranges as I didnt require this, I may look at adding this in the future.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Now whilst testing this I thought about how I could provide more than a custom message upon recieving the IP Restriction response, maybe a branded page dependant on the site it's used in. This is actually very easy and all you need to do is create a custom html page branded appropiately within your site and then change the CustomErrors section of your web.config.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Within here simply add a new error node, give it either the 503 or 403 status code dependant on whether you are using maintainence mode or not, and provide the html file to redirect to.&lt;/p&gt;
&lt;pre&gt;&lt;code class="xml"&gt;
&lt;error statusCode="503"  redirect="MaintainenceMode.htm"/&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This makes the module for me at least very useful. If you want to give the module a go why not &lt;a href="http://development.mjjames.co.uk/scripts/aspnet/downloads/mjjames.httpmodules.zip" title="Download IPRestrict HTTP Module"&gt; download the dll&lt;/a&gt; and let me know how you get on. If there's interest I'll also look at bundling a version with the full source. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-1789396624578367360?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/dnU4aJ4Zhes" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/1789396624578367360/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=1789396624578367360" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/1789396624578367360?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/1789396624578367360?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/dnU4aJ4Zhes/site-maintainance-and-ip-restriction.html" title="Site Maintainance and IP Restriction" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2008/11/site-maintainance-and-ip-restriction.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAARH89eCp7ImA9WxRUEUo.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-2602605619371936482</id><published>2008-09-22T20:16:00.006Z</published><updated>2008-11-20T09:35:45.160Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-20T09:35:45.160Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Script" /><category scheme="http://www.blogger.com/atom/ns#" term="MVC" /><category scheme="http://www.blogger.com/atom/ns#" term="WMI" /><category scheme="http://www.blogger.com/atom/ns#" term="Util" /><title>Rename a Computer Using WMI Scripting</title><content type="html">&lt;p&gt;This Wednesday I'm doing an MVC Hack Night at my work with &lt;a href="http://derek-says.blogspot.com/"&gt;Derek Fowler&lt;/a&gt;. This evening will hopefully give us a chance to show other employees what &lt;a href="http://www.asp.net/mvc/"&gt;ASP.NET MVC&lt;/a&gt; is and to give them some simple tutorials to work on.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;As ASP.NET MVC is only preview 5 we didn't want to install the extensions onto the work machines, so we decided to create a time based XP Virtual Machine that everyone could copy and use for the evening. Not only did this mean we could install the extensions without fear of breaking our development machines but it also meant we could ensure that Sql Express and Visual Studio Express was setup and working with the tutorial code properly.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;There was one giltch with the plan and that was that the Virtual Machines would all be using the same Computer Name, this would result in the computers not logging onto the network and all sort of errors could occur.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;My solution to this was to write a dead simple WMI Script in VB that would run at logon, this script would check to see if the Computer Name was the default, in this case MVC, and if it was to rename it to MVC-{Random Number}. It would then reboot the computer and then find the name changed and hopefully find it can logon to the network fine.&lt;/p&gt;
&lt;br /&gt; 
&lt;p&gt;The source code is below, I've chosen to generate a number between 1 &amp; 1000. This should hopefully not generate any machines with the same name, as there's only 10 of us. &lt;br /&gt; The script really is quite simple, I first get the Computer WMI object and check it's name to see if it equals MVC, if it isn't I change it, echo out its been changed and then use the WMI Script object to run Shutdown.exe /r (reboot the computer). Now I could use the Operating System WMI Object to issue a shutdown but I didnt think of this until after I had wrote the script.&lt;/p&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code class="vb"&gt;
lowerbound = 0 ' lowest value
upperbound = 1000 ' highest value
Randomize
randomvalue = CInt(Int((upperbound - lowerbound + 1) * Rnd() + lowerbound)) 'generate random number

Name = "MVC-" &amp; randomvalue ' our new computer name
Password = "abc123" 'my admin password
Username = "admin" 'my admin username

Set objWMIService = GetObject("Winmgmts:root\cimv2")

' Call always gets only one Win32_ComputerSystem object.
For Each objComputer in _
    objWMIService.InstancesOf("Win32_ComputerSystem")
 If objComputer.Name = "MVC" Then ' check to see if comp is using default name  
         Return = objComputer.rename(Name,Password,Username) ' rename comp
         If Return &lt;&gt; 0 Then 'check for error
             WScript.Echo "Rename failed. Error = " &amp; Err.Number
        Else
             WScript.Echo "Rename succeeded." &amp; _
                 " Rebooting for new name to go into effect"
   set objWSHShell = WScript.CreateObject("WScript.Shell")
   objWSHShell.Run "shutdown.exe /r" ' reboot comp for changes to take effect

         End If
 Else
  WScript.Echo "Rename Not Needed"
 End If

Next
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to use this script / adapt it for your needs feel free, it certainly made my life easier!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-2602605619371936482?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/cEePOh_07cI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/2602605619371936482/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=2602605619371936482" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2602605619371936482?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2602605619371936482?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/cEePOh_07cI/rename-computer-using-wmi-scripting.html" title="Rename a Computer Using WMI Scripting" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2008/09/rename-computer-using-wmi-scripting.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQBSX47cSp7ImA9WxRSFUg.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-1935333322114529012</id><published>2008-09-16T07:59:00.005Z</published><updated>2008-09-16T08:22:38.009Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-16T08:22:38.009Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="wembley" /><category scheme="http://www.blogger.com/atom/ns#" term="google developer day" /><category scheme="http://www.blogger.com/atom/ns#" term="Google" /><title>Welcome to Google Developer Day 2008</title><content type="html">&lt;p&gt;OK, I'm here, I have my shiny Google pass and a coffee I'm ready ;) &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;It all looks preety good so far, we strangly have a small wrapped up box which is for a session later.. I want to open it now but much like Christmas I'm thinking it may spoil it, apart from that upon arrival we are being showered in free coffee and pastries, if only I could eat the pastries I wouldn't be hungry, very good none the least.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Wembley Stadium is gorgeuos, it may have been over time and budget but it is beautiful, a nice venue to hold such an event in. I'll try to put some pictures online of the stadium later. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I have taken a few quick shots so far and will upload them to Flickr shortly, sadly I forgot my SLR and then Chris Alcock's small camera so alas it's LG "Viewty" quality only, I'll post later with more thoughts and ramblings about the day, given last night's performance though I'm thinking I need to scout out power sources soon! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;br /&gt; Google's WiFi has fallen over already and there's only 50 people here, I've switched to my 3G connection, it may be more reliable, although it will suck my battery quicker! Doh!&lt;/p&gt;

&lt;h3&gt;Pictures so Far&lt;/h3&gt;
&lt;iframe src="http://www.flickr.com/photos/mjjames/sets/72157607317784426/show/" width="600" height="450"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-1935333322114529012?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/9SD3Ny9uOhM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/1935333322114529012/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=1935333322114529012" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/1935333322114529012?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/1935333322114529012?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/9SD3Ny9uOhM/welcome-to-google-developer-day-2008.html" title="Welcome to Google Developer Day 2008" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2008/09/welcome-to-google-developer-day-2008.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMNRng-eip7ImA9WxRSFEw.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-2515492473991604653</id><published>2008-09-14T18:39:00.005Z</published><updated>2008-09-14T18:54:57.652Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-14T18:54:57.652Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="google developer day" /><category scheme="http://www.blogger.com/atom/ns#" term="Google" /><category scheme="http://www.blogger.com/atom/ns#" term="youtube" /><category scheme="http://www.blogger.com/atom/ns#" term="London" /><title>Google Developer Day 2008 London</title><content type="html">&lt;p&gt;Tuesday is the &lt;a href="http://code.google.com/intl/en_uk/events/developerday/2008/home.html"&gt;UK's Google Developer Day&lt;/a&gt;, this year its taking place at &lt;a href="http://www.wembleystadium.com/default.aspx"&gt;Wembley Stadium&lt;/a&gt; and I'm lucky enough to be attending&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;I have to say I'm quite looking forward to it, a chance to get see Google Speakers and to catch up with other developers that utilise the Google API's will be awesome. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So far I have used the Google Calendar API and started to write a .Net wrapper for the YouTube API, so learning about others will be good. The sessions I have pencilled in to attend so far are: State of AJAX: Dion Almaer, YouTube API: Build YOUR YouTube: Jean Laurent Wotton, Mashing up Google Data APIs: Ryan Boyd and probably but not fully sure V8 - the Chrome engine Kevin Millikin. &lt;/p&gt;
&lt;p&gt;As you can see it's going to be a jam packed day, but the sessions look top and I look forward to sharing and learning.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;Due to travelling I'm heading down Monday night, and coming back on Tuesday Evening. If you are in London on Monday night, and fancy catching a pre dev day pint or even food, drop me a DM on twitter (mjjames)&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;After the day I plan on doing a summary writeup on here and hopefully sharing some cool info&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-2515492473991604653?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/02_aLUays6U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/2515492473991604653/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=2515492473991604653" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2515492473991604653?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/2515492473991604653?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/02_aLUays6U/google-developer-day-2008-london.html" title="Google Developer Day 2008 London" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2008/09/google-developer-day-2008-london.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8BQX06eyp7ImA9WxRTE0Q.&quot;"><id>tag:blogger.com,1999:blog-2153751547788086073.post-3026739901703810330</id><published>2008-09-02T21:01:00.005Z</published><updated>2008-09-02T22:00:50.313Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-02T22:00:50.313Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="chrome" /><category scheme="http://www.blogger.com/atom/ns#" term="Google" /><category scheme="http://www.blogger.com/atom/ns#" term="google chrome" /><title>Going Chrome</title><content type="html">&lt;p&gt;So today Google Launched &lt;a href="http://google.com/chrome"&gt;Google Chrome&lt;/a&gt;, and like any good geek I got on it straight away.&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt; Installation was quick and painless, and it fired up blistering quick. It was then the magic started. Now I won't focus on how nice the interface is to use, the new home page, etc I want to concentrate on the features I have used tonight whilst using it and whilst coding.&lt;/p&gt;
&lt;br /&gt;
&lt;h2&gt;HTML &amp; CSS Features&lt;/h2&gt;
&lt;p&gt;The first thing I did whilst playing was to view some page source, this as you would expect is on the context menu, nothing overly special here, however I did like the nice syntax highlighting, +1 to Google. However it doens't do any sort of nice reformat document, this would have been a really nice feature but we can't have it all. &lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_S05-HU5Oqxw/SL2ry3IQyaI/AAAAAAAAAgk/zIGg4WHTDsA/s1600-h/chrome_source.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_S05-HU5Oqxw/SL2ry3IQyaI/AAAAAAAAAgk/zIGg4WHTDsA/s320/chrome_source.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5241534431609538978" /&gt;&lt;/a&gt;

&lt;p&gt;Whilst looking for View Source I discovered that Chrome has a DOM Inspector built in, I got to it by "inspecting an element". This is far more than the DOM Inspector that you can get for FireFox, it gives you a nice DOM view, style information (computed, inherited, etc), Metrics, which shows the Box Model being applied to the element, and finally a properties tab giving you anything being applied to an element. &lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
Next there's a funky search box, this allows you to search the DOM for anything, how many times have you needed to find the image with a class and you aren't sure where it renders? Now you could use inspect element, but if you are already in the inspector simply type "img" into the search box to find it lists all of the image tags within the document, now if it was really ace you could type image + class="photo" but this is not the case yet... &lt;/p&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_S05-HU5Oqxw/SL21YoRDK6I/AAAAAAAAAgs/fKNjAbIvImo/s1600-h/chrome_inspector.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_S05-HU5Oqxw/SL21YoRDK6I/AAAAAAAAAgs/fKNjAbIvImo/s320/chrome_inspector.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5241544976059542434" /&gt;&lt;/a&gt;
&lt;h2&gt;Resources and Debugging&lt;/h2&gt;
&lt;p&gt;
All of that was only under the Elements section, there's another section... Resources
This is similar to the net view tab in FireBug, it shows all of the "resources" requested by the page and shows them on a nice graph, showing how long they took to load and where in the process or you can compare the file sizes. &lt;br /&gt; By clicking on the file the graph turns into a preview of the file, be it the image, JavaScript file etc.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
I was slightly disapointed when I opened a JavaScript file to preview, I was expecting to be able to set breakpoints and watch's but alas no :( However there is a JavaScript Console, this is located at the bottom of the screen, the 2nd button from the left, this pops up the console. &lt;/p&gt;
&lt;br /&gt; 
&lt;p&gt;Now this is really good, it has intelisense ;) So if you start typing document.getElementByID for example all you need to do is: do [tab].get[tab] and choose by ID. If you cant remember the name, for example getElementsByName you can just keep pressing [tab] &lt;br /&gt;&lt;br /&gt; Now at the moment it only seems to do DOM but I'm hoping it may eventually pick up references and then you can do funky jQuery or something within the console... 
&lt;/p&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_S05-HU5Oqxw/SL21ZBfAu3I/AAAAAAAAAg0/hGCAlD_QKSE/s1600-h/chrome_resources.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_S05-HU5Oqxw/SL21ZBfAu3I/AAAAAAAAAg0/hGCAlD_QKSE/s320/chrome_resources.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5241544982828989298" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;p&gt;
Now there is soo much more I could talk about, however the final feature I used tonight was the JavaScript debugger, this is under Developer &gt; Debug Javascript or you can use the keyboard shortcut.
&lt;/p&gt;
&lt;p&gt;
Now I expected more than this, but maybe It does do more than I currently know, if you type help within the console you can see what you can do. You can attach breakpoints using the console, print variables, see what scripts are loaded, etc.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
When attached to a tab the debugger will catch any errors and you can print out any variables that you need to inspect before typing continue to continue.
&lt;br /&gt; &lt;br /&gt;
For me I still prefer firebug for JS debugging but I'm sure this will evolve further over time.
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;So that's it for tonight, I am loving Chrome, it's fast, it's slick but... there are still some bugs and glitches to iron out. For example I have seen quite a few pages where font-size is being inherited wrong within li's, so if I had 90% font size by the 5th li the text was unreadable :( There have been some other weird text issues but nothing that major. &lt;br /&gt; I'm not going to make Chrome my default browser yet... but I'm not far off ;)
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2153751547788086073-3026739901703810330?l=blog.mjjames.co.uk' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Mjjames-WebDeveloper/~4/zOuWSceUHBQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.mjjames.co.uk/feeds/3026739901703810330/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=2153751547788086073&amp;postID=3026739901703810330" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/3026739901703810330?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2153751547788086073/posts/default/3026739901703810330?v=2" /><link rel="alternate" type="text/html" href="http://feeds.mjjames.co.uk/~r/Mjjames-WebDeveloper/~3/zOuWSceUHBQ/going-chrome.html" title="Going Chrome" /><author><name>Michael James</name><uri>http://www.blogger.com/profile/06895910562063854287</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="05342269259785710624" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_S05-HU5Oqxw/SL2ry3IQyaI/AAAAAAAAAgk/zIGg4WHTDsA/s72-c/chrome_source.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://blog.mjjames.co.uk/2008/09/going-chrome.html</feedburner:origLink></entry></feed>
