Blog from October, 2009

DeltaShell Subversion Repository In Motion

The following video was made based on DeltaShell Subversion repository log.

://www.youtube.com/watch_private?v=x7rwBBpkJ6Y&sharing_token=SXmlLOAxvPqXuTdNQFwLBg==
DelftTools UI assemblies overview

I put together a little picture describing the relations of 'UI related' assemblies in DelftTools. Is should describe clearly that the Assemblies in the blue are independend of DelftShell entities like Project,IGui etc.

DelftTools.Gui.Swf is the assembly combining delfttools and windows controls.

Postsharp 2. Readable code?

With the introduction of PostSharp 2 a lot of code will be more readable.
Look at the implementation for property changed:

[Serializable]
[IntroduceInterface(typeof(INotifyPropertyChanged), OverrideAction = InterfaceOverrideAction.Ignore)]
[MulticastAttributeUsage( MulticastTargets.Class, Inheritance = MulticastInheritance.Strict )]
public sealed class NotifyPropertyChangedAttribute : InstanceLevelAspect, INotifyPropertyChanged
{
    [ImportMember( "OnPropertyChanged", IsRequired = false )]
    public Action<string> BaseOnPropertyChanged;

    [IntroduceMember( Visibility = Visibility.Family, IsVirtual = true, OverrideAction = MemberOverrideAction.Ignore )]
    public void OnPropertyChanged( string propertyName )
    {
        if ( this.PropertyChanged != null )
        {
            this.PropertyChanged( this.Instance,
               new PropertyChangedEventArgs( propertyName ) );
        }
    }

    [IntroduceMember( OverrideAction = MemberOverrideAction.Ignore )]
    public event PropertyChangedEventHandler PropertyChanged;

    [OnLocationSetHandler, MulticastSelector( Targets = MulticastTargets.Property )]
    public void OnPropertySet( LocationInterceptionArgs args )
    {
        if ( args.Value == args.GetCurrentValue() ) return;

        if ( this.BaseOnPropertyChanged != null )
        {
            this.BaseOnPropertyChanged( args.Location.PropertyInfo.Name );
        }
        else
        {
            this.OnPropertyChanged( args.Location.PropertyInfo.Name );
        }
    }
}

In stead of using a complex compound aspect we can now introduce members and specify an action if the member is already there. The PropertyChanged event member will be added to the class if it is not already on the class. Nice code (smile) Unfortunately PostSharp 2 is far from ready and even the samples don't work completely (sad)

Another downside is that is not backwards compatible with 1.5 so existing aspects need to reviewed.

I added a test solution to https://repos.deltares.nl/repos/delft-tools/trunk/sandbox/PostSharp2
to play around with the new post sharp.

Gael introducing the attribute : http://www.postsharp.org/blog/introducing-postsharp-20-1-notifypropertychanged

Sqlite editor

I found SQLite administrator http://sqliteadmin.orbmu2k.de to be a little
better than the firefox plugin. Mainly for two reasons:

1: It does not lock the DB. So i can run a test recreating a db i have open in my administrator.
2: Enables me to create a file-extension association in explorer. When i double click on a dsproj file I now automatically get the db

Compiling and running on 64bit

On my 64bit windows 7 machine I encountered a problem loading delftshell.
It seems that Assembly.Load fails when loading a 32 bit assembly into
a 64 application?? Below is the exception I got:

BadImageFormatException:
Could not load file or assembly 'file;///E:\src\..etcbla\gdal_const_csharp.dll' or one of its dependencies.

From line 325 of DelftShell.Core.PluginManager.

Setting the platform target for my DelftShell.Loader project to x86
fixed the problem of loading delft shell.

Running a model in an external process did not work as well. (Same problem loading dlls).

Here's a related post.
http://www.julmar.com/blog/mark/PermaLink,guid,28d0a66c-1741-42a0-8ad0-1e2734c0e9f9.aspx

Foutje? Undo commit in subversion

1. Open log voor repository op folder waarvan je de commit will undo-en (met TortoiseSVN)
2. Selecteer de 'foute' commit
3. Selecteer 'revert changes from this revision'
4. Wacht
4. Commit je locale copie weer naar de server.

http://markphip.blogspot.com/2007/01/how-to-undo-commit-in-subversion.html

Security warning in Visual Studio when loading DelftShell.sln

Lately I got a warning message each time I opened the DelftShell solution file.

"The .. project has been customized and could present a security risk by executing custom build steps ...."
I had to choose wether I should load the project for browsing or normally.

Because it bothered me a lot I started to search for a way to get rid of this message. It seems that the reference to DelftShell.targets is seen as an unsafe import.

By adding a registry string value in the following registry location I could get rid of these messages:

HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\MSBuild\SafeImports

string key properties:
name: delftShellTargets
value: d:\src\delft-tools\src\build\DelftShell.targets (path to DelftShell.targets file)