February 2006 Entries

Caveat With ASP.NET Precompilation and web.config Settings

When ASP.NET 2.0 compiles a web site, it reads the site’s web.config to pick up a few settings that affect the generated code. For instance, ASP.NET reads the <profile> section to generate the code for a Profile class with strongly typed properties. What may not be intuitive at first is what happens with these web.config settings when the ASP.NET precompilation tool creates a “non-updateable” web site (a full precompilation). For instance, we can set a default theme and master page for the a site in web.config: <pages       theme="Theme1"       masterPageFile="~/MasterPage1.master"></pages> When performing a full precompilation, the ASP.NET compiler bakes the theme and master page...

Today’s Reading List

I had two grueling flights to get to Redmond today. I feel like I left home about 1 week ago, although the trip only took 9 hours. Along the way, I plowed through: The March issue of MSDN Magazine. Jeffrey Richter’s Optex article was a good read, and “Legal Doesn’t Think the Way You Do” was excellent. I think a regular column giving the perspectives of the non-developer roles we interact with would be enlightening. One Night @ The Call Center. I don’t think this book is for sale in the U.S.A, and probably never will be. I got the book...

As Time Goes By

I looked at the following code and thought it should replace a file’s existing extension with “.xml”. string newName = null;newName = Path.GetFileNameWithoutExtension(                    fileName + ".xml"                ); It might be easy to spot in isolation, but when “foo.log” didn’t transform into “foo.xml” on disk, I went looking for the hard stuff first – swallowed exceptions, bad conditional logic, etc. I didn’t see the misplaced paren until later. string newName = null;newName = Path.GetFileNameWithoutExtension(fileName)                    + ".xml"; Another waste of time was a production app that looked like it was running under a user’s credentials instead of the NETWORK SERVICE account. A quick glance at the badly...

Inside AutoEventWireup

The following information applies to ASP.NET 2.0 Basics The default value for AutoEventWireup is true for a C# web form, and false for a VB.NET web form. The IDE adds the default values to the @ Page directive for a new web form. The difference in defaults is partly because VB.NET has a mechanism for defining an event handler and subscribing to an event in one graceful motion (the Handles keyword). Protected Sub Page_Load(ByVal sender As Object, _                        ByVal e As System.EventArgs) _                        Handles Me.Load    ' ...End Sub An easy way to generate the above code is to use the drop down controls that sit...

dnrTV and The Amazing DXCore

The latest episode of dnrTV with Marc Miller and Karl Franklin is fascinating. Karl asked his blog readers to submit ideas for a tool that Marc would build using the DXCore framework. I suggested building a tool to rearrange the code inside a class based on accessibility modifiers and some other criteria, as I’ve often rearranged strange code by hand to fit a style I’m accustomed to. Marc finished the feature in less than an hour. DXCore kidnaps the Visual Studio extensibility model and hides it in the trunk of a late model Buick. DXCore replaces the extensiblity API with...

The Next MS Office Version

This might be old news to some, but reports say Microsoft is thinking of making a free, ad-supported version of Office. I’d like to beta test the software to see what it can do. I’m wondering how smart the ads can be. There is smart, as in "keyword smart", and then there is really smart...  

Declarative Versus Imperative Coding

andyclap commented on my recent “Life With XAML” article: “Did the brave OO language research guys give (the better part of) their lives in vain; their graves to be desecrated by the vile 1970s SGML nincompoops? From this sample, the only function of XAML seems to be to put the foul-tasting XML syntactic sugar around a very ordinary presentation paradigm.” Colorful language, andyclap, I enjoyed reading the entire comment. I wish my article had gotten across the point that object orientation isn’t dead with declarative markup. Many of the articles I’ve read about WPF (a.k.a. Avalon) overstress the loving embrace...

The Partner Program Is Out Of Control

The Microsoft Partner program needs to simplify and streamline itself. Becoming a partner used to be a simple process with simple rules. Now there are  “bonus points” and other marketing tactics that make the program feel like a frequent flyer program. Partnerships are about marketing, but one day I won’t be surprised if someone calls to tell me I only need 2 more ‘partner points’ to get preferred ‘gold parking’ at the local Microsoft field office. I just want software licenses. I don’t have time to read the constant stream of emails, and I haven’t had the time the last two...

Cargo Cults

Perhaps you’ve heard the term ‘cargo cult programming’. Eric Lippert defined the term as follows. There are lots of cargo cult programmers -- programmers who understand what the code does, but not how it does it. Therefore, they cannot make meaningful changes to the program. They tend to proceed by making random changes, testing, and changing again until they manage to come up with something that works. The term derives from Richard Feynman’s “cargo cult science”. Feynman coined the term in a 1974 commencement address at Caltech. The speech transcript is a good read. In the South Seas there is a cargo cult...

Namespaces and ASP.NET 2.0

I've seen grumbling lately over the lack of namespaces in ASP.NET 2.0 projects. With Visual Studio 2003, if I add a page with the name of WebFormA to a folder with the name of FolderA, inside a project (named ProjectA), then the IDE starts off with a code-behind file that looks like the following. namespace ProjectA.FolderA{   /// <summary>   /// Summary description for WebFormA.   /// </summary>   public class WebFormA : System.Web.UI.Page The same steps with web project model in Visual Studio 2005 produces the following. public partial class FolderA_WebFormA : System.Web.UI.Page{ Some people believe having a class declared outside of a namespace is an unthinkable tragedy. My question...

Care and Feeding Of Community Server

Over the weekend, OdeToCode bumped up against it’s SQL Server disk space quota. Some operations, like adding comments, were throwing exceptions because the primary filegroup was full. Instead of paying for more disk space, I looked to see if there was some extra baggage I could get rid of. Step 1 of the adventure was to verify the database size. The sp_helpdb stored procedure verified that the database was using almost all of the 100MB allocated by the ISP. Step 2 was to see investigate the space reserved by each table in the database. The sp_spaceused stored procedure can list...

Life With XAML

It’s the Game of Life, and it’s written for WPF. Read the article. Download the code.