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

<channel>
	<title>Chris Fulstow &#187; Uncategorized</title>
	<atom:link href="http://chrisfulstow.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisfulstow.com</link>
	<description>ASP.NET Tech Lead and Web Developer</description>
	<lastBuildDate>Sat, 05 Jun 2010 01:32:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Snack size C#: null coalescing operator</title>
		<link>http://chrisfulstow.com/snack-size-c-null-coalescing-operator/</link>
		<comments>http://chrisfulstow.com/snack-size-c-null-coalescing-operator/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 00:08:04 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/?p=289</guid>
		<description><![CDATA[You need to assign the value of an expression to a variable, unless that expression evaluates to null, in which case default to something else.  And if that something else is also null, then fall back to another value, and so on.
For example, a web page that uses a theme setting to control look-and-feel.  If <a href="http://chrisfulstow.com/snack-size-c-null-coalescing-operator/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>You need to assign the value of an expression to a variable, unless that expression evaluates to null, in which case default to something else.  And if that something else is also null, then fall back to another value, and so on.</p>
<p>For example, a web page that uses a theme setting to control look-and-feel.  If the user has selected their own theme then use that; otherwise use the site&#8217;s default theme; or, if that&#8217;s not defined, use the global theme; or finally if no global theme is defined then fall back to a system default.</p>
<h3>The long, readable version</h3>
<p>Using good, old fashioned, conditional logic.</p>
<pre class="brush: csharp;">
string theme;
if (userTheme != null)
{
    theme = userTheme;
}
else if (siteTheme != null)
{
    theme = siteTheme;
}
else if (globalTheme != null)
{
    theme = globalTheme;
}
else
{
    theme = defaultTheme;
}
</pre>
<h3>The shorter, slightly befuddling version</h3>
<p>By nesting the ternary conditional operator in a most disagreeable way.</p>
<pre class="brush: csharp;">
string theme =
    userTheme != null ? userTheme
    : siteTheme != null ? siteTheme
    : globalTheme != null ? globalTheme
    : defaultTheme;
</pre>
<h3>The deluxe C# 3.0 version</h3>
<p>With the overkill of an implicitly-typed array, an IEnumerable extension method, and a lambda predicate.</p>
<pre class="brush: csharp;">
string theme = new [] {
    userTheme, siteTheme, globalTheme, defaultTheme
}.First(t =&gt; t != null);
</pre>
<h3>The elegant coalescence version</h3>
<p>With C# 2.0&#8217;s <a href="http://msdn.microsoft.com/en-us/library/ms173224.aspx">null-coalescing operator</a>, doing what it does best.</p>
<pre class="brush: csharp;">
string theme = userTheme ?? siteTheme ?? globalTheme ?? defaultTheme;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/snack-size-c-null-coalescing-operator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Free Microsoft certification beta exams coming soon</title>
		<link>http://chrisfulstow.com/free-microsoft-certification-beta-exams-coming-soon/</link>
		<comments>http://chrisfulstow.com/free-microsoft-certification-beta-exams-coming-soon/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 06:23:34 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/?p=286</guid>
		<description><![CDATA[New beta Microsoft certification exams available free between March 31, 2010 and April 20, 2010.

70-515 TS: Web Applications Development with Microsoft® .NET Framework 4
70-516 TS: Accessing Data with Microsoft® .NET Framework 4
70-513 TS: Windows Communication Foundation Development with Microsoft® .NET Framework 4
70-519 Pro: Designing and Developing Web Applications using Microsoft® .NET Framework 4

More info on <a href="http://chrisfulstow.com/free-microsoft-certification-beta-exams-coming-soon/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>New beta Microsoft certification exams available free between March 31, 2010 and April 20, 2010.</p>
<ul>
<li>70-515 TS: Web Applications Development with Microsoft® .NET Framework 4</li>
<li>70-516 TS: Accessing Data with Microsoft® .NET Framework 4</li>
<li>70-513 TS: Windows Communication Foundation Development with Microsoft® .NET Framework 4</li>
<li>70-519 Pro: Designing and Developing Web Applications using Microsoft® .NET Framework 4</li>
</ul>
<p>More info on Gerry O&#8217;Brien&#8217;s blog here: <a href="http://blogs.msdn.com/gerryo/archive/2010/02/10/free-certification-exams.aspx">Free Certification Exams</a></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;"><em>70-511 TS: Windows Applications Development with Microsoft® .NET Framework 4<br />
70-513 TS: Windows Communication Foundation Development with Microsoft® .NET Framework 4<br />
70-515 TS: Web Applications Development with Microsoft® .NET Framework 4<br />
70-516 TS: Accessing Data with Microsoft® .NET Framework 4<br />
70-519 Pro: Designing and Developing Web Applications using Microsoft® .NET Framework 4</em></div>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/free-microsoft-certification-beta-exams-coming-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TableHeaderScope.Column and HTML standards compliance</title>
		<link>http://chrisfulstow.com/tableheaderscope-column-and-html-standards-compliance/</link>
		<comments>http://chrisfulstow.com/tableheaderscope-column-and-html-standards-compliance/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 01:28:28 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/?p=270</guid>
		<description><![CDATA[Neil spotted this quirky behaviour in the TableHeaderCell control. Suppose you&#8217;ve got a Table web control that renders a &#60;table&#62; tag with a &#60;th scope=&#8221;col&#8221;&#62;, using code something like this:

Table table = new Table()
{
    Rows =
    {
        new TableRow()
    <a href="http://chrisfulstow.com/tableheaderscope-column-and-html-standards-compliance/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Neil spotted this <a href="http://www.neilpullinger.co.uk/2008/05/tableheaderscope-enum-does-not-generate.html">quirky behaviour in the TableHeaderCell</a> control. Suppose you&#8217;ve got a <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.table.aspx">Table web control</a> that renders a &lt;table&gt; tag with a &lt;th scope=&#8221;col&#8221;&gt;, using code something like this:</p>
<pre class="brush: csharp;">
Table table = new Table()
{
    Rows =
    {
        new TableRow()
        {
            Cells =
            {
                new TableHeaderCell()
                    { Scope = TableHeaderScope.Column, Text = &quot;MyColumn&quot; }
            }
        }
    }
};
</pre>
<p>Then the rendered HTML won&#8217;t be W3C compliant because a <em>scope</em> value of &#8220;column&#8221; isn&#8217;t valid:</p>
<pre class="brush: xml;">
&lt;table border=&quot;0&quot;&gt;
    &lt;tr&gt;
        &lt;th scope=&quot;column&quot;&gt;&lt;/th&gt;
    &lt;/tr&gt;
&lt;/table&gt;
</pre>
<p>According to the W3C <a href="http://www.w3.org/TR/html401/struct/tables.html#h-11.2.6">HTML</a> and <a href="http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/abstract_modules.html#sec_5.6.">XHTML</a> specs, the acceptable values for <em>scope</em> are [row|col|rowgroup|colgroup]. This is confirmed by the <a href="http://validator.w3.org/">W3C Markup Validation Service</a>, which reports the error:</p>
<p><img class="alignnone size-full wp-image-269" title="W3 TH error" src="http://chrisfulstow.com/wp-content/uploads/2010/02/w3-th-error.png" alt="W3 TH error" width="603" height="242" /></p>
<p>Stepping into the source code for the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.tableheadercell.aspx">TableHeaderCell</a> control with <a href="http://www.aisto.com/roeder/dotnet/">Reflector</a> or the <a href="http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx">.NET Reference Source</a>, you can see the root of the problem:</p>
<pre class="brush: csharp;">
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
    TableHeaderScope scope = Scope;

    if (scope != TableHeaderScope.NotSet)
    {
        writer.AddAttribute(HtmlTextWriterAttribute.Scope,
            scope.ToString().ToLowerInvariant());
    }
}
</pre>
<p>When the control sets the scope attribute&#8217;s value, it uses a lowercase string representation of the TableHeaderScope.Column enumeration, i.e. &#8220;column&#8221;. An enum value of TableHeaderScope.Col would&#8217;ve been ok, but TableHeaderScope.Column is invalid.</p>
<h2>Workarounds</h2>
<p>Neil has a good workaround by adding the scope attribute manually instead of using the TableHeaderCell.Scope property:</p>
<pre class="brush: csharp;">
TableHeaderCell th = new TableHeaderCell();
th.Attributes[&quot;scope&quot;] = &quot;col&quot;;
</pre>
<p>I thought I&#8217;d have a go at extending this fix into a simple <a href="http://msdn.microsoft.com/en-us/magazine/cc163543.aspx">control adatper</a> that makes sure TableHeaderCell always renders itself correctly. It works by checking whether the Scope property is set to TableHeaderScope.Column, and if so manually adds the attribute scope=&#8221;col&#8221; instead. Here&#8217;s the code:</p>
<pre class="brush: csharp;">
    public class TableHeaderCellAdapter : WebControlAdapter
    {
        protected override void RenderBeginTag(HtmlTextWriter writer)
        {
            TableHeaderCell th = (TableHeaderCell) this.Control;

            if (th.Scope == TableHeaderScope.Column)
            {
                th.Scope = TableHeaderScope.NotSet;
                th.Attributes[&quot;scope&quot;] = &quot;col&quot;;
            }

            base.RenderBeginTag(writer);
        }
    }
</pre>
<p>To associate the control adapter class with the TableHeaderCell control, add a browser definition file to the App_Browsers folder:</p>
<pre class="brush: xml;">
    &lt;!-- file: ~/App_Browsers/ControlAdapters.browser --&gt;
    &lt;browsers&gt;
        &lt;browser refID=&quot;Default&quot;&gt;
            &lt;controlAdapters&gt;
                &lt;adapter
                  controlType=&quot;System.Web.UI.WebControls.TableHeaderCell&quot;
                  adapterType=&quot;TableHeaderCellAdapter&quot; /&gt;
            &lt;/controlAdapters&gt;
        &lt;/browser&gt;
    &lt;/browsers&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/tableheaderscope-column-and-html-standards-compliance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring IIS7 for ASP.NET on Windows Vista</title>
		<link>http://chrisfulstow.com/configuring-iis7-for-asp-net-on-windows-vista/</link>
		<comments>http://chrisfulstow.com/configuring-iis7-for-asp-net-on-windows-vista/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 01:13:11 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/?p=266</guid>
		<description><![CDATA[As part of Microsoft&#8217;s ongoing Trustworthy Computing initiative, Vista takes the secure by default principle more seriously than previous versions of Windows. Consequently, many features aren&#8217;t installed by default, one of which is IIS 7. So, to install IIS go to:
Control Panel &#8211; Programs &#8211; Turn Windows features on or off
Then find the Intenet Information <a href="http://chrisfulstow.com/configuring-iis7-for-asp-net-on-windows-vista/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>As part of Microsoft&#8217;s ongoing <a href="http://www.microsoft.com/mscorp/twc/">Trustworthy Computing</a> initiative, Vista takes the <a href="http://en.wikipedia.org/wiki/Secure_by_default">secure by default</a> principle more seriously than previous versions of Windows. Consequently, many features aren&#8217;t installed by default, one of which is IIS 7. So, to install IIS go to:</p>
<p><strong>Control Panel &#8211; Programs &#8211; Turn Windows features on or off</strong></p>
<p>Then find the <em>Intenet Information Services</em> section and add everything you need, including <em>ASP.NET</em>.</p>
<p><a href="http://chrisfulstow.com/wp-content/uploads/2010/02/aspnet-win-features.png"><img class="alignnone size-full wp-image-267" title="ASP.NET Windows Features" src="http://chrisfulstow.com/wp-content/uploads/2010/02/aspnet-win-features.png" alt="ASP.NET Windows Features" width="429" height="455" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/configuring-iis7-for-asp-net-on-windows-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing ASP.NET Membership, Roles and Profiles support in SQL Server</title>
		<link>http://chrisfulstow.com/installing-asp-net-membership-roles-and-profiles-support-in-sql-server/</link>
		<comments>http://chrisfulstow.com/installing-asp-net-membership-roles-and-profiles-support-in-sql-server/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 23:32:19 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/?p=260</guid>
		<description><![CDATA[Here are few quick tips if you&#8217;re using the ASP.NET Application Services with SQL Server, like Membership, Roles, Profiles, Personalization or Web Events.  These built-in &#8220;building-block&#8221; services have SQL provider implementations in .NET that let you use a SQL Server 2000 or 2005 database as their data store. These are the framework classes that implement <a href="http://chrisfulstow.com/installing-asp-net-membership-roles-and-profiles-support-in-sql-server/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Here are few quick tips if you&#8217;re using the ASP.NET Application Services with SQL Server, like Membership, Roles, Profiles, Personalization or Web Events.  These built-in &#8220;building-block&#8221; services have SQL <a href="http://msdn2.microsoft.com/en-us/library/ms972319.aspx">provider</a> implementations in .NET that let you use a SQL Server 2000 or 2005 database as their data store. These are the framework classes that implement the SQL Server providers:</p>
<ul>
<li><a href="http://msdn2.microsoft.com/en- us/library/89hwy0w9(VS.80).aspx">SqlMembershipProvider</a> &#8211; managing user credentials and authentication</li>
<li><a href="http://msdn2.microsoft.com/en- us/library/daxt91e3(VS.80).aspx">SqlRoleProvider</a> &#8211; handling role-based authorisation</li>
<li><a href="http://msdn2.microsoft.com/en- us/library/8226cz6c(VS.80).aspx">SqlProfileProvider</a> &#8211; storing and retrieving information about individual users</li>
<li><a href="http://msdn2.microsoft.com/en-us/library/ttfyw56h (VS.80).aspx">SqlPersonalizationProvider</a> &#8211; saving state of web parts</li>
<li><a href="http://msdn2.microsoft.com/en-us/library/axa250f0 (VS.80).aspx">SqlWebEventProvider</a> &#8211; capturing and logging web event data</li>
</ul>
<h2>ASP.NET SQL Server Registration Tool</h2>
<p>Adding support for these providers to your database is easy, just run the <a href="http://msdn2.microsoft.com/en-us/library/ms229862(VS.80).aspx">ASP.NET SQL Server Registration tool</a> from the command-line (aspnet_regsql.exe) to launch the ASP.NET SQL Server Setup Wizard.  This will guide you through the process with a simple GUI:</p>
<pre>cd C:\Windows\Microsoft.NET\Framework\v2.0.50727 aspnet_regsql.exe</pre>
<p>By default, the wizard installs all five <a href="http://www.stockindex500.org">services </a>: Membership, Roles, Profiles, Personalization and Web Events. However, if you need support for only some, say just Membership and Roles, then aspnet_regsql can be run from the command-line with specific options, for example:</p>
<pre> aspnet_regsql -S MySqlServer -E -A mr -d MyAspDatabase</pre>
<p>This installs the Membership and Roles services (-A <strong>mr</strong>) on server <em>MySqlServer</em> in database <em>MyAspDatabase</em> using current Windows credentials for authentication.  To see a full list of command-line options and switches, run the registration tool with the help flag:</p>
<pre> aspnet_regsql.exe /?</pre>
<p>There&#8217;s also an option to generate just SQL scripts without executing them, and another to remove services from the database that aren&#8217;t used or needed anymore. (You can also manage SQL cache dependencies and session state using this tool.)</p>
<p>For more info about ASP.NET SQL providers:</p>
<ul>
<li><a href="http://www.microsoft.com/downloads/details.aspx? FamilyID=b6b5401a-19ea-4262-ba2b-db26f35d09e0&amp;displaylang=en">MSDN &#8211; ASP.NET</a><a href="http://www.microsoft.com/downloads/details.aspx? FamilyID=b6b5401a-19ea-4262-ba2b-db26f35d09e0&amp;displaylang=en"> Provider Model (PDF)</a></li>
<li><a href="http://www.asp.net/learn/videos/video-148.aspx">Video &#8211; How Do</a><a href="http://www.asp.net/learn/videos/video-148.aspx"> I: Set Up the SQL Membership Provider</a></li>
<li><a href="http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx">Configuring</a><a href="http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx"> ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005</a></li>
<li><a href="http://aspnet.4guysfromrolla.com/articles/120705- 1.aspx">Examining ASP.NET 2.0&#8217;s Membership, Roles, and Profile</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/installing-asp-net-membership-roles-and-profiles-support-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Horse sense: Agile versus Waterfall</title>
		<link>http://chrisfulstow.com/horse-sense-agile-versus-waterfall/</link>
		<comments>http://chrisfulstow.com/horse-sense-agile-versus-waterfall/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 02:01:31 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/?p=242</guid>
		<description><![CDATA[Check out Stuart Cam&#8217;s excellent comparison of agile versus waterfall development models, illustrated as drawing a horse:

That freakish Frankenstein waterfall horse is going to give me nightmares.
]]></description>
			<content:encoded><![CDATA[<p>Check out <a href="http://blog.codebrain.co.uk/">Stuart Cam&#8217;s</a> excellent comparison of <a href="http://blog.codebrain.co.uk/post.aspx?id=72a6440a-474c-438a-8ebe-1daf89ae2eb2">agile versus waterfall development models</a>, illustrated as drawing a horse:</p>
<p><a href="http://blog.codebrain.co.uk/post.aspx?id=72a6440a-474c-438a-8ebe-1daf89ae2eb2"><img class="alignnone size-full wp-image-243" title="Horse sketch development models" src="http://chrisfulstow.com/wp-content/uploads/2010/02/horse-dev-models.png" alt="Horse sketch development models" width="530" height="214" /></a></p>
<p>That freakish Frankenstein waterfall horse is going to give me nightmares.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/horse-sense-agile-versus-waterfall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New VS 2010 and .NET 4.0 training on msdev</title>
		<link>http://chrisfulstow.com/new-vs-2010-and-net-4-0-training-on-msdev/</link>
		<comments>http://chrisfulstow.com/new-vs-2010-and-net-4-0-training-on-msdev/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 23:50:52 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/?p=235</guid>
		<description><![CDATA[Microsoft&#8217;s just added eight hours of .NET 4.0 and Visual Studio 2010 sessions to its training site msdev.com with New Features in .NET Framework 4 and Visual Studio 2010, Beta 2.
Subjects covered are:

Parallelism
ADO.NET Data Services
F#
Office Programmability
ASP.NET AJAX
ASP.NET MVC
ASP.NET WebForms
Managed Languages

And there&#8217;s even more ASP.NET 4.0 training in the ASP.NET 4.0 Quick Hit Videos series.  A <a href="http://chrisfulstow.com/new-vs-2010-and-net-4-0-training-on-msdev/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Microsoft&#8217;s just added eight hours of .NET 4.0 and Visual Studio 2010 sessions to its training site msdev.com with <a href="http://www.msdev.com/Directory/SeriesDescription.aspx?CourseId=144">New Features in .NET Framework 4 and Visual Studio 2010, Beta 2</a>.</p>
<p>Subjects covered are:</p>
<ul>
<li>Parallelism</li>
<li>ADO.NET Data Services</li>
<li>F#</li>
<li>Office Programmability</li>
<li>ASP.NET AJAX</li>
<li>ASP.NET MVC</li>
<li>ASP.NET WebForms</li>
<li>Managed Languages</li>
</ul>
<p>And there&#8217;s even more ASP.NET 4.0 training in the <a href="http://www.asp.net/learn/aspnet-4-quick-hit-videos/">ASP.NET 4.0 Quick Hit Videos</a> series.  A great introduction to loads of new features in bite-size pieces:</p>
<ul>
<li>Chart Control</li>
<li>Dynamic Metadata</li>
<li>Permanent Redirect</li>
<li>Imperative WebForms Routing</li>
<li>Declarative WebForms Routing</li>
<li>Outbound WebForms Routing</li>
<li>Auto Start</li>
<li>Clean Web.Config Files</li>
<li>Predictable Client IDs</li>
<li>Selective View State</li>
<li>The HtmlEncoder Utility Method</li>
<li>New Rendering Option for Check Box Lists and Radio Button Lists</li>
<li>Persistent GridView Row Selection</li>
<li>Table Free Templated Controls</li>
<li>Easy State Compression</li>
<li>Tableless Menu Control</li>
<li>Imperative JavaScript Syntax for Microsoft Client Side Controls</li>
<li>The ScriptLoader</li>
<li>jQuery Syntax for Microsoft Ajax</li>
<li>AJAX Data Templates</li>
<li>Hidden Field Divs</li>
<li>Disabled Control Styling</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/new-vs-2010-and-net-4-0-training-on-msdev/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy Localization using Factory Methods in .NET</title>
		<link>http://chrisfulstow.com/easy-localization-using-factory-methods-in-net/</link>
		<comments>http://chrisfulstow.com/easy-localization-using-factory-methods-in-net/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 03:10:31 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://3poundmass.wordpress.com/2007/10/04/easy-localization-using-factory-methods-in-net/</guid>
		<description><![CDATA[ASP.NET 2.0 has some great localization features that make it easy to build multilingual web applications.  The problem comes when you need different business logic for different countries, maybe to validate a local address or calculate shipping costs.  You somehow need to get the application to behave differently based on a country code <a href="http://chrisfulstow.com/easy-localization-using-factory-methods-in-net/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>ASP.NET 2.0 has some great <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/ASP2local.asp">localization features</a> that make it easy to build multilingual web applications.  The problem comes when you need different business logic for different countries, maybe to validate a local address or calculate shipping costs.  You somehow need to get the application to behave differently based on a country code or the thread&#8217;s <a href="http://msdn2.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture(VS.71).aspx">current culture</a> setting.</p>
<p>For simple variations you can use separate configuration settings for each country.  For example, a regular expression in web.config to validate a local telephone number.  But if the logic is more complex then you might need a different plan.</p>
<p>An obvious approach is to use conditional switch/select-case statements, like this:</p>
<pre class="brush: csharp;">
switch (countryCode)
{
   case &quot;FR&quot;:
   /* Logic for France */
   case &quot;US&quot;:
   /* Logic for USA */
}
</pre>
<p>But for large applications this can quickly get unwieldy and difficult to manage.  Adding a new country means finding every switch statement and adding a new case.</p>
<p>Instead, a good solution is the <a href="http://en.wikipedia.org/wiki/Factory_method_pattern">Factory Method</a> design pattern.  It makes your application much easier to maintain, and adding new countries is easy.   Here&#8217;s a quick example that extends the idea of validating local postcode formats.</p>
<p><strong>Class Diagram</strong></p>
<p>These are the classes used, described below in more detail.</p>
<p><img style="border: 1px solid black;" src="http://3poundmass.files.wordpress.com/2007/08/classdiagram1.png" alt="Abstract method" /></p>
<p><strong>Step 1</strong></p>
<p>Create an <a href="http://msdn2.microsoft.com/en-us/library/sf985hc5(VS.80).aspx">abstract class</a> for performing local validation called <em>LocalValidatorBase</em>.  This is a base class which can&#8217;t be instantiated.   Add a method signature <em>IsValidPostcode</em> that takes a string and returns a boolean. Classes for various countries can now derive from <em>LocalValidatorBase</em> and override <em>IsValidPoscode</em> with custom validation logic.</p>
<p>(The <em>LocalValidatorBase</em> class can contain logic to share between all the subclasses, but if this isn&#8217;t necessary then you can create an <a href="http://msdn2.microsoft.com/en-us/library/87d83y5b(VS.80).aspx">interface</a> instead of an abstract class called something like <em>ILocalValidator</em>.)</p>
<p><strong>Step 2</strong></p>
<p>Derive two local validation classes from <em>LocalValidationBase</em> called <em>LocalValidatorAU</em> and <em>LocalValidatorDE</em>, one for Australia and one for Germany.  In each, override <em>IsValidPoscode</em> to perform country-specific logic for validating a postcode, maybe by checking the string length or matching against a <a href="http://support.microsoft.com/kb/308252">regular expression</a>.  The details aren&#8217;t important here.</p>
<p><strong>Step 3</strong></p>
<p>Create a factory class to return the correct validator object for the current country setting.  Add a static/shared factory method called <em>GetLocalValidator</em> that returns a <em>LocalValidatorBase</em> class.  The magic of <a href="http://msdn2.microsoft.com/en-us/library/ms173152(VS.80).aspx">polymorphism</a> means this method can return any class derived from <em>LocalValidatorBase</em>.  Use a switch statement, or some other conditional logic, to return a new instance of <em>LocalValidatorDE</em> or <em>LocalValidatorAU</em> depending on a country code parameter or the thread&#8217;s <a href="http://msdn2.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx">current culture</a> name.</p>
<p><strong>Step 4</strong></p>
<p>That&#8217;s all there is to it.  You can now call the factory method to get the correct validator object for the current country.</p>
<pre class="brush: vb;">
' call the factory method to get a concrete validator
Dim validator As LocalValidatorBase = _
  LocalValidatorFactory.GetLocalValidator()

Dim isValid As Boolean = validator.IsValidPostcode(&quot;12345&quot;)
</pre>
<p>The validation success depends on the rules in the object returned by <em>GetLocalValidator</em>, which will be different depending on the current country.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/easy-localization-using-factory-methods-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firebug</title>
		<link>http://chrisfulstow.com/firebug/</link>
		<comments>http://chrisfulstow.com/firebug/#comments</comments>
		<pubDate>Fri, 15 Dec 2006 02:01:00 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/firebug/</guid>
		<description><![CDATA[Firebug, a developer plug-in for Firefox, just made front-end development a lot easier:

Inspect and edit live HTML and CSS
Visualise CSS box-model
Monitor network metrics
Debug and profile JavaScript
DOM explorer

]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.getfirebug.com/">Firebug</a>, a developer plug-in for Firefox, just made front-end development a lot easier:</p>
<ul>
<li>Inspect and edit live HTML and CSS</li>
<li>Visualise CSS box-model</li>
<li>Monitor network metrics</li>
<li>Debug and profile JavaScript</li>
<li>DOM explorer</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/firebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MCTS study resources</title>
		<link>http://chrisfulstow.com/mcts-study-resources/</link>
		<comments>http://chrisfulstow.com/mcts-study-resources/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 11:19:00 +0000</pubDate>
		<dc:creator>Chris Fulstow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chrisfulstow.com/mcts-study-resources/</guid>
		<description><![CDATA[Here are a few online resources for studying towards MCTS: .NET Framework 2.0 Web Applications:
Exam 70–528: .NET 2.0 Web-Based Client Development

Microsoft Preparation Guide
Web-based Client Development &#8211; Free Skills Assessment
MeasureUp practice test (150 questions)
Wikibook MCTS textbook

Exam 70–536: .NET 2.0 Application Development Foundation

Microsoft Preparation Guide
MeasureUp practice test (150 questions)
MCTS 70-536 Exam Prep (book)
Exam syllabus with MSDN links
C# <a href="http://chrisfulstow.com/mcts-study-resources/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Here are a few online resources for studying towards <a href="http://www.microsoft.com/learning/mcp/mcts/webapps/default.mspx">MCTS: .NET Framework 2.0 Web Applications</a>:</p>
<p><strong>Exam 70–528: .NET 2.0 Web-Based Client Development</strong></p>
<ul>
<li><a href="http://www.microsoft.com/learning/exams/70-528.asp">Microsoft Preparation Guide</a></li>
<li><a href="http://www.microsoft.com/learning/assessment/ind/visualstudio/default.mspx#EWD">Web-based Client Development &#8211; Free Skills Assessment</a></li>
<li><a href="http://www.measureup.com/catalog/product.aspx?vid=5&#038;cid=MCTS&amp;tid=10&#038;pid=1675">MeasureUp practice test (150 questions)</a></li>
<li><a href="http://en.wikibooks.org/wiki/Exam_70-528:_Web-Based_Client_Development">Wikibook MCTS textbook</a></li>
</ul>
<p><strong>Exam 70–536: .NET 2.0 Application Development Foundation</strong></p>
<ul>
<li><a href="http://www.microsoft.com/learning/exams/70-536.asp">Microsoft Preparation Guide</a></li>
<li><a href="http://www.measureup.com/catalog/product.aspx?vid=5&amp;cid=MCTS&#038;tid=10&amp;pid=1692">MeasureUp practice test (150 questions)</a></li>
<li><a href="http://www.amazon.com/MCTS-70-536-Exam-Prep-Foundation/dp/078973558X/">MCTS 70-536 Exam Prep</a> (book)</li>
<li><a href="http://www.publicjoe.f9.co.uk/csharp1/70-536.html">Exam syllabus with MSDN links</a></li>
<li><a href="http://en.csharp-online.net/index.php?title=Microsoft_Exam_70-536_Study_Guide">C# Online.NET Study Guide</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisfulstow.com/mcts-study-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
