August 2007


If you suck at UI design like I do, you’ll want to check out the Open Source Web Design site. There are nearly 2100 designs to choose from, all free. If you actually like UI design you can submit your own creations too. Viva open source!

I learned something pretty cool about .NET attributes today. While I have known about Obsolete() for some time, I just learned about Conditional(). Consider this code:

void ProductionMethod()
{
   WriteSomeImportantData();
   WriteDebugInfo();
}
[System.Diagnostics.Conditional("DEBUG")]
void WriteDebugInfo()
{
   // Display helpful debugging info
}

Traditionally, the call to WriteDebugInfo() would be enclosed within a preprocessing directive (#IF…#ELSE…#ENDIF) to eliminate the method call when the application is compiled in release mode. The Conditional() attribute replaces that rather ugly style with a single line of code as shown above. The compiler will automatically remove all calls to the decorated method unless the condition is true. This means you can make all the calls you want to WriteDebugInfo() without affecting code readability or production performance!

You may be thinking that this isn’t much of an improvement, in which case you’re wrong. By moving the decision into an attribute, you get all the existing attribute functionality supported by the framework. Want to know how many debug methods exist in your project? Would you prefer to manually search for and count all the instances, or write a few lines of code to reflect over the entire assembly? That’s just the beginning of it.

Until today I’ve used a Greasemonkey script when I’ve wanted to download and save videos from sites like YouTube.

Not anymore.  Enter vDownloader, a freeware app that’s obscenely simple to use and works perfectly (so far).  There is no setup package – just unzip the download and start ripping! A cool feature I discovered accidentally: leave the program open and copy a video URL to your clipboard. vDownloader automagically downloads the file as generic data, prompts you for the destination file type, and then encodes the data according to your choice.  Sweet!

I wrote about this once before but reading this post
prompted me to mention it again. If you think you know how to validate email addresses, please follow the link and knowledgeify yourself.  For those without the time to read it, here’s your executive summary: stop restricting the content that appears on the left side of the @ sign.  Special characters like ! $ + * | and \ are all allowable!

I just stumbled across an open source web development project called PageMethods. This clever yet simple to use library eliminates the need to hardcode, parse, and generate URLs and QueryStrings in a web application.  Instead, PageMethods replaces them with strongly typed objects that allow compile time checking and all the other intuitive benefits of a managed code language.  (This falls under the “why didn’t I think of that” category!)

Resharper is one of those “must have” tools for .NET developers.  It’s code analysis, unit testing, and productivity enhancements all rolled up in one.  It even supports VB.NET now.