The ASPSmith's Blog

Some rants about ASP.NET by Steven Smith

  • 34 Hours To Departure for PDC 2003

    My flight leaves at 0535 Monday morning from Akron-Canton, getting me into Los Angeles at 0951.  I figure I'll probably make it to the hotel by 11am and the convention center by noon, which means I'll miss the keynotes.  :(

  • Outlook 2003 + Spam Bayes Rocks!

    I'm still on the Beta of Outlook 2003 - I'll upgrade to the release version at some point.  But I just installed SpamBayes and I have to say that so far I'm very happy with it.  It's not totally “trained” yet (it's only been about 8 hours, but I get about 100 spam in that time), but it's only categorized 2 things I wanted to have as possible spam (and they were automated emails), and nothing has been junked that shouldn't have been.  No spam has made it to my Inbox, either - it's all been put into Possible Spam.

  • Enums and Lookup Tables

    Everyone knows (or would know if they'd read Code Complete) that 'magic numbers' are a bad thing in your code.  Enumerated types, or Enums in .NET, are a great way to avoid such magic numbers.  For instance, let's say I have a content management system which has articles whose state can vary between Draft, Editing, and Production.  I could simply use 1, 2, and 3 for these states and remember what each stands for, but that's going to be really hard to look at six months later when I revisit the code (or if someone else has to read it).  In languages without enumerated types, named constants would be a step in the right direction, but truly enums are much more powerful because they allow me to limit the allowable values of parameters to only valid values.  For instance, I might have a method for updating the status of an article, called UpdateStatus(), which takes an integer articleId and an integer statusId.  There's nothing to prevent me from sending a -5 or a 300 to the statusId, which of course would not be valid status numbers, but are perfectly acceptable integers.  If instead I define the method so that it accepts an integer articleId and an ArticleStatus statusId, where ArticleStatus is an enumerated type, I'm assured that only valid values can be passed to that method (the compiler will enforce that).

  • Databinding Server Controls - Learned Something New

    I was running into an issue databinding an ImageButton's ImageUrl property to a string comprised partly of literal text and partly of a string I was pulling from my ConfigurationSettings.AppSettings collection.  I was using the standard <%# ... %> syntax for the databinding, but the result kept showing my databinding syntax in the button's URL, rather than the actual value.  It seems that while you can do the databinding to the control property, it's all or nothing.  So if you want the string to be:
    <asp:ImageButton ... ImageUrl=”/folder/<%# MyConfigVariable %>/Add.gif” ... />

  • "unexpected error creating debug information"

    I keep running into this issue in my multi-project VS.NET solutions.  For some reason, something is locking the dll(s) in the /obj/ folder of library components.  The fix that I have at the moment is as follows: