Thursday, July 27, 2006

Patching code in an aspx.cs file, without rebuilding

You've just built, tested and gone live with a new build of your ASP.NET web site when you discover a bug in thispage.aspx.cs. Your next build/test/release isn't planned for a few weeks, but the bug needs to be fixed now, if not sooner. What to do?

If the bug was in thispage.aspx, you could simply fix it and apply the new page to the live site as a patch, knowing that it won't affect any other pages on the site. Since the bug is in the code-behind file, you can't do this without a full build and associated testing, etc.

Solution:

Copy the code from thispage.aspx.cs to thispage.aspx (put the code in a <script language=CS runat=server></script> tag), and make these changes to thispage.aspx:
  • Remove the namespace / class declaration
  • Remove any declarations of controls as variables
  • Change any "using" statements to <%@ Import ... %> statements
  • Remove "Codebehind" and "Inherits" attributes from <%@ Page %> tag
That's it (more or less). Test and deploy thispage.aspx as a patch to the live site.

Then for the next full release, fix the bug in thispage.aspx.cs and remove the above code from thispage.aspx.

Thursday, June 29, 2006

The forecast for www.met.ie is poor

Much has been written about how to write easily scannable text for the web, and yet www.met.ie (despite a site redesign) still insists on using long paragraphs such as:

The weather will be warm, humid and unsettled through the weekend and the early days of next week with spells of heavy, showery, thundery rain in many areas at times. There'll be some heavy showers on Friday night, mainly in the West and North. There'll be more showery rain in places on Saturday, but a fair amount of dry weather too with some sunny spells. Temperatures will range from about 19 to 23 degrees with light variable or Southerly breezes. Sunday, Monday and Tuesday will be very warm, humid days with mostly light Easterly breezes and temperatures reaching the mid 20s. Widespread heavy or thundery showers can be expected each day along with spells of warm sunshine.

Instead of something like...
The weather will be warm, humid and unsettled through the weekend and the early days of next week with spells of heavy, showery, thundery rain in many areas at times.

There'll be some heavy showers on Friday night, mainly in the West and North.

There'll be more showery rain in places on Saturday, but a fair amount of dry weather too with some sunny spells. Temperatures will range from about 19 to 23 degrees with light variable or Southerly breezes.

Sunday
, Monday and Tuesday will be very warm, humid days with mostly light Easterly breezes and temperatures reaching the mid 20s. Widespread heavy or thundery showers can be expected each day along with spells of warm sunshine.


Some resources on how to write for the web:

How Users Read on the Web
How to write for the Web