September 2005 Entries

Language Quiz

What language is the following code snippet using? var person = new   {     Name = "Steve",     JobTitle = "National Assurance Orchestrator"   }; A) JavaScript B) C# 3.0C) COBOL.NET with WinFS extensions. D) None of the above For hints, see Steve Maine’s excellent post “On JSON” (JavaScript Object Notation), and Abhinaba’s informative rant “C# 3.0: I do not like Anonymous types”.

The Weeks Ahead

This week is Microsoft's MVP Summit in Seattle. I’m looking forward to seeing the city of Seattle, home of the National UFO Reporting Center. I hear Microsoft has a branch office or something nearby, too. I'm also looking forward to meeting many people I only know electronically, and cornering members of the MSBuild team. I want information, and not about aliens. In the middle of October, I’ll be speaking at VSLive! 2005, in Orlando, Florida. The topic will be debugging with Visual Studio 2005, and I’m in the midst of preparing a pretty cool demo, complete with bugs. It’s not often that...

Ted’s C# 3.0 Overview

Ted Neward has a great post analyzing new C# 3.0 features. Ted refers to the language enhancements as mostly “syntactic sugar”. In other words - the syntax additions don’t change the expressiveness of C#, but merely add conveniences and shortcuts. We write less code while the C# compiler generates more IL behind the scenes. Over the years I’ve been puzzled by the term ‘syntactic sugar’. People generally use the term in a derogatory sense, as in: “C++? Pffft. That’s just C with some syntactic sugar”. Isn’t every language just syntactic sugar when compared to, say, CPU opcodes?

Notes From the Atlas Hands On Lab

Rough and random thoughts while playing with the new Atlas bits. Lab 1Lab 1 creates a master page with <atlas:script> tags to ensure links to the Atlas framework .js files are sent to the client. I’d like to see this functionality in a base class so it isn’t copy and pasted everywhere, or simply injected auto-magically, perhaps when an attribute like <% @ Page AtlasEnabled=”true” %> appears. Nifty master page tricks: the master page uses a ContentPlaceHolder inside the %lt;head%gt; tag, which makes it easy for content pages to override the contents of head. The master page does not define a %lt;form> tag, but...

Concurrency

Concurrency is terribly difficult. Example: a primary cause of the massive North American blackout in 2003 was a software race condition. The application logged over three million production hours before the bug manifested itself. Nevertheless, concurrency, here we come. Herb Sutter points out why with his article: “The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software”. Mr. Sutter explains how future CPU improvements will no longer give applications a free performance boost - clock speed and execution optimizations are topping out. We need to increase the concurrency of our applications to take advantage of the next wave...

Developer Toolbar For IE

The beta version of the IE Developer Toolbar is now available. The toolbar allows you to inspect the DOM, view class names and IDs, clear the browser cache, validate the markup, and more. Other than a minor annoyance (the installation required a reboot), the toolbar looks great and works well. If you’ve ever used FireFox’s web developer extension you’ll know just how invaluable this tool can be. The IEDevToolbar.dll the setup package deploys doesn’t appear to use managed code, though. Bummer.

SiteMapProvider using SQL Server

If you are looking to build a custom ASP.NET 2.0 SiteMapProvider to read site navigation information from SQL Server, then look to Jeff Prosise’s “Wicked Code” column in the June 2005 issue of MSDN Magazine.

Who Needs Press Releases?

Mike Gunderloy’s Daily Grind is a great source of information. In today’s grind Mike points to the unveiling of Microsoft Expression, both the official press release and the “readable” version from Somasegar’s blog entry. Here is a one paragraph excerpt from the press release. Rudder stressed that the new tools portfolio, paired with the Windows Presentation Foundation, a powerful platform-level presentation and display engine, will help drive down the cost and effort associated with building richer, more compelling and exciting applications with unique differentiated capabilities. Yes, that’s one paragraph – one period, four commas, and the mind numbing phrase (“unique...

Fun With the Exception Assistant

If you’ve spent time with VS 2005, you’ve probably met the Exception Assistant. Reading the tips for a common exception is a bit like calling the cable company when your broadband connection is down. “Sir, is the cable connected to the modem? Are there any green lights blinky-blinking? Ok, sir. Sir, I’m going to need you to power down your computer, your modem, your cell phone, and your microwave oven…. " The “View detail” link is useful, as it lets you drill into all the properties of an exception. The tips appear to be extensible. You can drop an XML file into the...

When It Rains It Pours

I’ve been catching up on all the news from the PDC today (I’m not there). It’s a bit of a shame all of this news has to stay bottled up and released all on one day, but I suppose it does make for an exciting event. I’m stuck with real work for awhile, and won’t be able to jump into the excitement just yet. The following graph illustrates my backlog for technology research. Here are some highlights of stuff to revisit some day. Language integrated query, set, and transform operations (LINQ) are the kind of features you expect to see...

Page Inheritance in ASP.NET 2.0

Rick Strahl has a fantastic post: “Understanding Page Inheritance In ASP.NET 2.0”. Go read the post now. Here are some ideas I thought of while reading. The @ Reference, @ MasterType and @ PreviousPage directives are the only reliable mechanisms for referencing a type defined in another page (or user control, or master page) from inside a web form. In Rick’s case he wanted to create a new web form (UploadItemPictureEx) derived from UploadItemPicture, where UploadItemPicture is defined as a Page derived class in the CodeFile for a second web form. In the new compilation model UploadItemPicture isn’t visible from...

Finding Web Services

Every so often I go looking for a public web service to do a job and end up at a UDDI Registry, like the one run by Microsoft. UDDI (Universal Description, Discovery, and Integration) came with the promise of providing searchable metadata to make web services easy to find and use from client software. A UDDI registry is a place where business and individuals can publish their metadata and become “discoverable”. All the registries I find are terrible. The registries contain out of date information, have confusing interfaces and categorizations, but worst of all they are not comprehensive. I have...

Master Page Anti-pattern

Following a software design pattern is good. Falling into a software anti-pattern is bad. The “master” in “master page” can be misleading. The term suggests the master page is somehow in control of everything happening during the lifecycle of a request. What actually happens is that the master page injects itself into the Controls collection of a web form and becomes a child control, (see figure 7 of Fritz Onion’s article on the topic). The master becomes the child. Because the master page sounds like it commands all that happens under it’s domain, there is a tendency to lean towards...

Power Phases

This morning I was holding on to a precious idea and typing furiously into a remote desktop, when bleeeeeeep – the UPS units kick in and the network goes down. Power outage. Mood: displeased. After 15 minutes of rummaging, I found the phone book hiding between a book of salsa recipes and the classic “Joy Of Cooking” hardcover edition. The power was still off, so I started a manual search for the phone number of the power company. Mood: irritated. I found the number, but realized my landline didn’t work either. I picked up my cell phone and prepared to...

Themes for Custom Controls in ASP.NET

Q: How do you skin custom controls and user controls in ASP.NET 2.0? A: You can use an @ Register directive in the .skin file. Once the control is registered, skinning works just as you'd expect. For instance, the following control: namespace OdeToCode.WebControls {     public class MyCalendar :           System.Web.UI.WebControls.Calendar     {       // ...     } } Can be skinned like so: <%@ Register TagPrefix="OTC" namespace="OdeToCode.WebControls" %>   <OTC:MyCalendar runat="server" BackColor="White" BorderColor="#EFE6F7">   <SelectedDayStyle BackColor="#41519A" ForeColor="White" />   <SelectorStyle BackColor="#41519A" /> </OTC:MyCalendar> The above Register directive assumes your control is defined in App_Code, otherwise you'll need to add the Assembly attribute to specify the assembly. It’s also important to note that a skin defined...

Colorful ASP.NET Themes

The Colorful Web Site Starter Kit on .NET Treats and Tricks is a nice piece of work (via Cindy). On the site you’ll find a find 8 ASP.NET 2.0 Themes you can download and use. The themes not only look nice but have a great design. For instance, Erika used styles from a CSS file whenever possible. I’ve seen some grumbling that themes and skins in ASP.NET 2.0 are an evil plot to subvert web standards, when actually themes provide a great infrastructure to manage multiple sets of CSS files. Select a theme for a page and the runtime will...