March 2007 Entries

Too Much Encapsulation

A couple times this year I've wanted to plug some electronics into a hotel TV. For instance, when I'm on the road and want to watch a movie from my Creative Vision M. I also unexpectedly came into possession of an XBOX 360 during a recent trip to Seattle (thank you, Party with Palermo and PreEmptive). Side note: My XBOX Live Gamertag thingy is: The last couple hotel TVs I've looked at offer no media inputs on the front. No problem, I'll think to myself. If there are no inputs on the front, there must be inputs on the back....

What's Wrong With This Code? (#13)

 For lucky #13, I want to know what can go terribly wrong with the following code, and why. class HardWorker{            public void DoMultiThreadedWork(object someParameter)    {        lock (lockObject)        {            // ... lots of work ...        }    }    private string lockObject = "lockit";}  Hint: Think about memory optimizations in the CLR.

The Head Tag in ASP.NET 2.0

The Themes feature in ASP.NET 2.0 requires a server-side <head> tag. In other words, if you don't have runat="server" in the <head> tag, like the following: <head runat="server">    <!-- head stuff --> </head>  … then trying to use css files from a theme will create a runtime exception with a clear error message: Exception Details: System.InvalidOperationException: Using themed css files requires a header control on the page. (e.g. <head runat="server" />). Not every component yields such a direct message, however. I've been updating pages in a 5 year old application by adding some AJAX features and using some flair from the Control Toolkit. It's been some...

ASP.NET and HTML - Past, Present, Future

Yesterday, I was giving an AJAX facelift to some old, old .aspx files. These files were created in the first version of Visual Studio.NET and have been running smoothly for years. Inside I found: <meta content="Microsoft Visual Studio 7.0" name="GENERATOR"><meta content="C#" name="CODE_LANGUAGE"><meta content="JavaScript" name="vs_defaultClientScript"><meta content="http://schemas.microsoft.com/intellisense/ie5"       name="vs_targetSchema">...<body MS_POSITIONING="GridLayout">  ASP.NET has come a long way since the days when MS_POSITIONING appeared. GridLayout meant that every control dropped on the form used absolute positioning by default. GridLayout was a thrill for new web developers who came from a VB6 background, but the feature didn't fly so well with anyone who took HTML seriously. Ironically, Microsoft's web tools are now closer to the...

Windows Workflow Foundation and Domain Specific Languages

Windows Workflow Foundation is a multi-faceted technology. Some people will look at WF and see a tool to manage long-running business processes, while others see a rules engine. Yet another perspective is to look at WF as a tool for building domain specific languages. Last week I had numerous conversations with talented individuals who reinforced this theme of WF as a DSL tool. For example- Kathleen Dollard builds code-generation tools for developers, and Sam Gentile builds applications for financial analysts. Both of them are giving their end users the ability to create tailored software using a domain specific language. The...

MetaBlog into a Local Directory

Microsoft Word 2007 produces relatively clean HTML when you use the Publish feature to create a blog post. Although the XHTML purist will still be unhappy with anything they don't write themselves, the HTML far surpasses anything we've seen from Word in previous versions. Unfortunately, this feature is only available for blog posting, as far as I can tell. The "Web Page" and "Web Page, Filtered" options in the "Save As" menu still produce the same .mso littered HTML that makes Word impossible to use as a serious HTML editor. I'd like to use the HTML output by the Publish...

Update for the Visual Studio Items Sorting Script

Alexander Groß has a sharp looking blog, and he posted an enhanced version of my sort-vsItems PowerShell script. The update is highly recommended, particularly if you have WinFX templates installed. See his post: "Sorting Visual Studio's 'Add New Item' Dialog".  Alexander also has an RDP/Terminal Service Port Configurator for Windows Mobile. I've been frustrated by the fact that the mobile remote desktop client doesn't understand the servername:port syntax, but this utility is a good workaround.