CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Grant Killian's Blog

No, this has nothing to do with beer -- but maybe it should?

April 2005 - Posts

  • Option Strict On Salvation

    Yeah, I should have put this in my earlier post but I didn't have time.  Maybe I'm crazy, but the whole Option Strict stuff with the TimeTracker starter kit is something I lose sleep over.  The solution is easy: just add a few ToString() and DateTime.Parse() functions where necessary . . . and then you have the whole ubiquitous IIF() function to wrestle with.   There's dozens of calls to the Option-Strict-On-hating Visual Basic IIF() function scattered all through the starter kit so fight that initial urge to do a search and replace approach.  And no, VB.Net doesn't have a ? operator either. 

    Instead, overload IIF() with the appropriate strongly typed parameters and you'll be all set.  This is an example:

    Public Class IIFHelper
     Public Shared Function IIF( Condition as Boolean, TrueResult as String, FalseResult as String ) as String
      If Condition Then
       return TrueResult
      Else
       return FalseResult
      End If
     End Function
    End Class

    Repeat as necessary and start using IIFHelper.IIF() instead of just IIF() -- I found only a handful of IIFHelper.IIF permutations necessary to get to Option Strict On salvation.

    Now I can rest easier. 

     

  • NHibernate

    Anyone having fun with NHibernateThis article from TheSeverSide gives a nice NHibernate overview, but I'm curious about how people are finding the config file management and the tool in general after a bit of real world use.

    I've used a home grown version that did the same thing; it used a combination of .Net Reflection and CodeSmith.  I wonder if NHibernate is the way to progress in the future . . .

  • No Option Strict For You

    I'm looking at sample apps for some newer .Net web developers to learn from . . . I figured the ASP.Net starter kits would be a good place to start.  One of the things we wanted to include was the importance of Option Strict On vs Option Strict Off and wouldn't you know it: the TimeTracker Starter Kit app doesn't use Option Strict On.  I guess I shouldn't consider a "starter kit" to be the same as a best-practice "reference application" but it would be better for everyone if these sorts of samples stuck to some fundamentals.  Oh well . . . I can use this as an exercise in why they aren't using Option Strict On and how we can correct it

    I won't even go into what happens when I run FxCop against the starter kit.

  • Making a Copy of ASP.Net Application -- Best Practices?

    Somewhere between this article on the .webinfo file and this post about the .csproj file (that incorrectly presumes it's a Visual SourceSafe problem -- I'm no big fan of VSS but it's not the issue in this case) I successfully made a local copy of a web app we've been working on.  Copy the directory . . . make it a virtual directory in IIS, modify the .webinfo file, rename as necessary (webinfo must be same name as the csproj file it seems).

    My question: what are the best practices around duplicating a web app on the same box (for running side-by-side as different instances with slightly different interfaces, etc?).  I KNOW that one can deploy the app to different virtual directories, but what I'm after is a form of branching the codebase into a totally new web application on a dev machine with the least amount of effort.  We'll use VS.Net to make some changes to the UI code for each customer (but reuse the same core assemblies for business logic etc); we're talking more than just style sheets, here, also.  Too bad "deploying" the app to the same machine (and checking the "include source code" option") doesn't configure IIS for you and the other manual work . . .

    Writing this post has reminded me of a few projects I've been on where all the UI stuff was configured from a database . . . the text of every label, x and y positioning on the screen, presence of dropdown lists and other user input widgets, graphics, etc.  This would solve my particular problem of changing the UI stuff for each customer but introduce a whole host of other architecture issues -- think about doing web layout from a set of related SQL Server tables and you'll get the idea.  

    Maybe this would be a handy utility to throw up on something like GotDotNet . . . if GDN didn't have so many issues.  I guess SourceForge is the main player in the shared project space -- but for something as minor as I'm suggesting it might be better off just posted as an EXE somewhere on CodeBetter.  I'll give it some thought.

More Posts