Previous month:
November 2005
Next month:
January 2006

December 2005

Application Configuration with Libraries

Visual Studio 2005 has a great support to define application- and user-specific configuration with a "Settings" file. Creating a Settings file item, a class is created that derives from the class ApplicationSettingsBase to read application-configuration information from app.config. The values can be read using the strongly-typed class, e.g. Properties.Settings.Default.SomeSetting.

If the application configuration file does not exist, or the configuration information is not found in the file, the default values are hard-coded in the settings-class with the attribute [DefaultSettingValue]. If the values should not be hard-coded, it is possible to disable this feature by setting the property GenerateDefaultValueInCode to false.

Special attention must be taken if the configuration values should be used within a library. With a library it is possible to create a settings file item for strongly typed access to configurations. Of course, libraries don't have their own configuration files. The configuration settings used by the settings class in the library can easily be added to the configuration file of the application.

Special care must be taken if the same configuration values are shared between multiple projects. The tool-generated settings class uses configuration values that include the root namespace of the project. This behavior can be changed by applying the attribute [SettingsGroupName("MyGroup")]. Using this attribute, the group name is used with the configuration file instead of the namespace of the project:

    <setting name="Setting1" serializeAs="String">
      <value>Some value</value>

This makes it possible to share the same configuration between multiple projects although the projects can have different root namespaces.


Klingon Culture on Windows Vista

Shawn Steele created a custom culture for Klingon with an LDML file for Windows Vista!

Shawn's post Why and How I Chose Klingon for an Example gives more insight of Klingon. Shawn doesn't wear Klingon masks. I did. ;-) In 2004 I've created a custom Klingon culture that is used to read resources. Shawn has an additional feature: he offers Klingon month names with the custom culture! Similar to Shawn I've also searched for translation of month names and failed. While Shawn did a great job doing his own Klingon translation I decided to demonstrate a different calendar: the Mars calendar (see the second screenshot). The Mars calendar has different days in a year and number of months. It seems that no documentation on earth exists about this information from Klingon.