Catch-all redirect in Apache
Assume you have a website running on an Apache server and the URL is http://mydomain.com/. What if you want to dominate the UK market too!? You'd probably buy mydomain.co.uk and point it to the same...
View ArticleSQL - Dynamic Order By clause
Have you ever wanted a stored procedure to order it's results dynamically? The ORDER BY clause is the place to start but normally relates to a series of columns that's hard-coded. If you want this...
View ArticleASP.NET MVC - UserControls and IPrincipal
This is my first post on ASP.NET MVC so I'm gonna keep it short and sweet (I'm sure they'll be plenty more to come :-D).On a MVC View Page, you can access the user that has been previously...
View ArticleTo serialize, or not to serialize - that is the question
When serializing objects, you sometimes want to exclude properties that don't meet a certain criteria. This validation could be a simple check for default/null values or a more complicated...
View ArticleHow do I create the ASPState database?
After installing the Microsoft .NET framework 2.0, launch a command window and run:aspnet_regsql.exe -ssadd -sstype p -S {Server} -U {Username} -P {Password}
View ArticleCSS "or" separator
<div style="background-color: white; margin-left: -10px; margin-top: 40px; padding: 5px; position: absolute;">or</div><div style="border-left: solid 1px #999; height: 8em; margin:auto;...
View Article0x80048820
I recently kept getting an error after trying to sign into Windows Live Messenger or sync Windows Live Mail. My laptop had been unplugged at the mains for over a week and the date/time settings were...
View ArticleHow do I clean up my log files?
Create a scheduled task that will execute the following command:C:\WINDOWS\system32\forfiles.exe /p C:\logs /s /m *.log /d -7 /c "CMD /C del @FILE"This example recursively deletes "*.log" files older...
View ArticleCustom controls in ASP.NET MVC
Finally, my article on custom controls in ASP.NET MVC has been published on CodeProject so check it out:http://www.codeproject.com/KB/custom-controls/MVCCustomControls.aspx
View ArticlejQuery watermark plugin
Here is a jQuery plugin for adding a watermark effect to elements (e.g. text box):(function($) { // The element that has focus (or null when nothing has focus). var inputFocus = null; // This keeps...
View ArticleEventType clr20r3
I was recently on call when I got alerted to a scheduled task that failed to run - the following error was added to the Event Viewer: EventType clr20r3, P1 MyApp.exe, P2 1.0.0.21357, P3 4935215a, P4...
View ArticlejQuery $(document).ready()
We all know that anything inside the $(document).ready() function will execute in between loading the DOM and content. Here is a syntax alternative for those who want to save a few...
View ArticleXbox Live Avatars
The Xbox 360 dashboard was given a facelift back in November 2008 and one of the new features is Avatars - like a "Mii", only better! I've customised my avatar which you can see right here on my blog....
View ArticleEquals, Equals Equals or Equals Equals Equals?
In JavaScript, you often see conditional statements with 3 equals signs (===). I always thought it was a typo but it turns out to have a significant advantage over the traditional 2 equals signs (==)....
View ArticleSQL Server compatability level
When you upgrade to SQL Server 2005, you may find that some SQL statements are no longer valid and produce errors. A typical example is when you have 2 tables under different databases with the same...
View ArticleiPhone ringtones
The following guide is for creating custom iPhone ringtones using iTunes. Some instructions might be specfic to Windows but the same principles apply to other operating systems.Create an AAC format...
View ArticleThe hyperlink trailing slash
When creating hyperlinks to a folder resource, always trail with a forward a slash.http://andrewgunn.blogspot.com/test (slower)Vshttp://andrewgunn.blogspot.com/test/ (faster)Any reqeusts for the URL...
View ArticleThe C# ?? (null coalescing) operator
The ?? operator checks whether the value on the left side of the expression is null, and if so it returns an alternate value on the right side of the expression. If the value on the left side of the...
View Article