Friday, July 27, 2007

Friday, July 20, 2007

File Attribute in Web.Config

A previous post provided a simple example for decoupling various configuration sections from your web.config by using the configSource attribute to point to external files. This feature is available in asp.net 2+.

Another option is the File attribute. An example is provided in the following blog. I think this attribute has more going for it than the configSource attribute.

Default + Optional Override

The file attribute allows you to keep default settings in your web.config. If .NET finds the specified configuration specified by the file attribute, it overrides your defaults. This provides you with the option to decouple your configuration from web.config:
If asp.net finds a "user.config" in my application directory, it uses those settings.

Available in ASP.NET 1.1

Given the file attribute's availability in asp.net 1.1, I don't see the added value that the configSource attribute provides in asp.net 2.0. Comments?

File Must Reside within the Application's Physical Directory Structure

To further decouple the application from configuration, I tried specifying the file in a virtual location. This would allow me to stage configuration updates separately from application updates. Like the configSource attribute, it was no dice. Rats.

Wednesday, July 18, 2007

Product Recommendation: Beyond Compare

Your application works in your QA environment, but not in Production. The IIS configurations are identical. You've verified database connectivity and firewall rules. In fact you've ruled out everything but the code. Is it the same in each environment?

Use Beyond Compare to verify. It quickly surfaces file system differences in a nice GUI.

Side By Side Directory Comparison
The directory comparision displays a side-by-side listing of the "source" and "compare to" directories. Use the "<>" option to display only the differences:



Line by Line File Comparision
Differences will be highlighted via color codes. When you want to drill down into a specific file difference, simply double-click to view a line-by-line file comparison:


Options

Use the referee icon to enable/disable compare options. For instance, an extract from Visual Sourcesafe will yield a new date/time stamp, even if you know the file on the compare directory is identical. Unflagging the "Timestamp" folder comparison criteria will remove this comparison "noise" and allow you to spot more meaningful differences.

Tuesday, July 10, 2007

VBScript - Read From Registry

Here is a quick and dirty function for reading a registry value using the WScript.Shell object:

    function readFromRegistry (strRegistryKey, strDefault )
  • Dim WSHShell, value

  • On Error Resume Next

  • Set WSHShell = CreateObject("WScript.Shell")

  • value = WSHShell.RegRead( strRegistryKey )


  • if err.number <> 0 then

  • readFromRegistry= strDefault

  • else

  • readFromRegistry=value

  • end if


  • set WSHShell = nothing

  • end function

Usage:
    str = readfromRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\ESD\Install_Dir", "ha")
    wscript.echo "returned " & str

BlogSpot Title Entry Bug

For the past few days, I noticed it was difficult to create a new posting and give it a title. The Title text box appears to be disabled:


To get around this, place your cursor anywhere along the upper edge of this text box.


...back in business!