Friday 30 January 2009

Custom error pages in IIS

When creating a custom error page, you need to remember to update the feature settings within IIS.
First, set your error page for the correct status code. e.g. 404
Set IIS either to execute a URL or respond with a 302 redirect.
Then on the right hand action bar, click Edit Feature settings and select the option to use the custom error pages. If this is not done, IIS will still use the default error page.

Searching for a wildcard character in SQL

There are occasions when you need to search for the wildcard character within SQL.

The wildcard characters are:

  • % : Any string of zero or more characters.

  • _ : Any single character.

  • [ ] : Any single character within the specified range ([a-f]) or set ([abcdef]).

  • [^] : Any single character not within the specified range ([^a-f]) or set ([^abcdef]).

To search for any of these characters you need to use the ESCAPE clause.

To search for a text value that contains 10-15% you can use:

SELECT c1
FROM mytbl2
WHERE c1 LIKE '%10-15!% off%' ESCAPE '!'

Wednesday 28 January 2009

ASP.NET MVC 1.0 Release Candidate Available

Microsoft have shipped the ASP.NET MVC 1.0 Release Candidate (RC). It's available to download from here. This is hopefully the last release before they ship the final release, which they are hoping to be next month.

The extensive release notes, all 26 pages detail the upgrade process from ASP.NET MVC Beta and includes all the details that have changed.

Wednesday 14 January 2009

Move window to another monitor

I have two monitors and often find the need to move the window to the other monitor. Dragging the window and then maximising is slow and I wished to find a shortcut to this. reSizer is an application that deals with window enhancements, one of these enhancements is the ability to move a window to another monitor using the shortcut key Win + Backspace.

Thursday 8 January 2009

Output literal text from XSLT

A colleague (Neil Pullinger) and my self have both come across the same problem. Getting the PICS tag to show correctly whilst using Sitecore. The example below is wrong, as the quotes have been escaped. <meta http-equiv="PICS-Label" content="(pics-1.1 &quot;http://www.icra.org/pics/vocabularyv03/&quot; I gen true for &quot;http://www.website.com&quot; r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 0))" /> The required output is: <meta http-equiv="PICS-Label" content='(pics-1.1 "http://www.icra.org/pics/vocabularyv03/" I gen true for "http://www.website.com" r (n 0 s 0 v 0 l 0 oa 0 ob 0 oc 0 od 0 oe 0 of 0 og 0 oh 0 c 0))' /> To achive the second option, we had to use
<xsl:text disable-output-escaping="yes">
    <![CDATA[<meta http-equiv="PICS-Label" content=']]>
</xsl:text>
<xsl:value-of select="$picsrating" />
<xsl:text disable-output-escaping="yes">
    <![CDATA[' />]]>
</xsl:text>

Friday 2 January 2009

Blank <title> tags

If you are using ASP.NET and placehoders to render your metadata. You may notice that it will generate an empty <title> tag. This occurs when using XHTML 1.0 Transitional. I often use placeholders to control the content with in the title tag.

To overcome this, you can add the following in the head tag.

<head>
...
<title visible="false" runat="server"></title>
...
</head>

This turns the <title> tag into a server control, and the visible attribute prevents the blank title from rendering to the page.

Thursday 1 January 2009

New Year = New Look

As it's the New Year I have decided to change the look of this blog. Also to note, my New Years resolution is to try and post here more often.

Happy New Year everyone.