Wednesday, July 21. 2010
Hall of shame: Control Center
Windows traut sich mal wieder nicht selbst über den Weg...
Windows once again distrusts itself...
Thursday, November 26. 2009
SharedSize Grid with Silverlight
Since there is no SharedSizeGroup property for the Silverlight Grid I decided to code that myself. It is really helpful if you design a page with multiple Grids on it.
To give you an overview of the usage here is a Silverlight 3.0 XAML file
<UserControl x:Class="SLTestApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ext="clr-namespace:System.Windows.Controls.Extensions;assembly=System.Windows.Controls.Extensions"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot" Background="White" ext:SharedSize.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid x:Name="firstfirstGrid" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Green" BorderThickness="2">
<TextBlock x:Name="txtFirstFirst" >
<Run>aa</Run>
<LineBreak />
<Run>aa</Run>
</TextBlock>
</Border>
</Grid>
<Grid x:Name="firstsecondGrid" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Blue" BorderThickness="2">
<TextBlock Text="aaaaaaaaaaaaaaaa" />
</Border>
</Grid>
</Grid>
</UserControl>
The current version only works in XAML and does not support adding a Grid or a SharedSize property in code and during runtime. If you need the code, let me know.
Download the release DLL
To give you an overview of the usage here is a Silverlight 3.0 XAML file
<UserControl x:Class="SLTestApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ext="clr-namespace:System.Windows.Controls.Extensions;assembly=System.Windows.Controls.Extensions"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot" Background="White" ext:SharedSize.IsSharedSizeScope="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid x:Name="firstfirstGrid" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Green" BorderThickness="2">
<TextBlock x:Name="txtFirstFirst" >
<Run>aa</Run>
<LineBreak />
<Run>aa</Run>
</TextBlock>
</Border>
</Grid>
<Grid x:Name="firstsecondGrid" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" ext:SharedSize.SharedSizeGroup="A"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="Blue" BorderThickness="2">
<TextBlock Text="aaaaaaaaaaaaaaaa" />
</Border>
</Grid>
</Grid>
</UserControl>
The current version only works in XAML and does not support adding a Grid or a SharedSize property in code and during runtime. If you need the code, let me know.
Download the release DLL
Saturday, November 21. 2009
Writing DTAUS files with C# (DTA-Dateien mit C# erzeugen)
In germany there is a file format for transfering bank transaction requests called DTAUS. I recently had the need to create such a file programatically, so I searched if anyone else already managed this task.
What I found was a blog entry of Timotheus Pokorra who wrote a litte C# class that managed this task for direct debits.
He generously allows anyone to use this class and provides his source code as download.
For my task, I extended his code to work with C# data objects instead of Xml data structures and added some optimizations and extensions.
The result is a set of three classes to create bank transfer or direct debit requests and allow them to be exported into to DTAUS fiel format with complete code documentation.
Of course, I will not hesitate to give back my extensions to the great work to Timotheus and the remaining web community.
Nevertheless, I do not want this class to be sold by others, so the license is Creative Commons NC-BY-SA. If you want to simply use my code in another (even sold) product, please contact me, if your product is more than "a library for DTAUS file management", I should gracefully permit you the right to use it.
(Download after german translation)
If you need a binary version of the file, just post me a line using the comments function of the blog.
Vor kurzem Stand ich vor der Aufgabe, in einem von mir geschriebenen Programm DTA-Dateien schreiben zu können, die in Deutschland verwendet werden, um Bankeinzug oder Überweisungsaufträge an Banken zu übermitteln. Nach einigem Suchen fand ich im Blog von Timotheus Pokorra eine Codedatei, die genau diese Aufgabe in C# erledigt. Der Code war für Xml-Strukturen als Eingabe entwickelt und darf frei verwendet werden.
Ich habe diese Klasse ein wenig erweitert, optimiert, Fehler ausgebügelt und zwei Datenobjekte erstellt, mit denen die Daten für den DTA-Auftrag in C#-Strukturen gespeichert werden können.
Gerne stelle ich meine Erweiterungen auch wieder frei zur Verfügung, solange die Anwendung nichtkommerziell ist (Creative Commons NC-BY-SA). Wer sie in kommerziellen Produkten einsetzen will, nimmt bitte Kontakt mit mir auf, ich bin gerne bereit, auch dafür die Freigabe zu erteilen, solange es nicht um eine Bibliothek zur DTA-Verwaltung geht...
Wer eine kompilierte Version benötigt, darf sich gerne über die Kommentarfunktion bei mir melden.
You can find the Library here: DTAUSWriter.cs
Download der DTA-Datei-Bibliothek: DTAUSWriter.cs

DTAUS Writer classes for C# von Timotheus Pokorra & Florian Harbich steht unter einer Creative Commons Namensnennung-Keine kommerzielle Nutzung-Weitergabe unter gleichen Bedingungen 3.0 Deutschland Lizenz.
Beruht auf einem Inhalt unter tpokorra.blogspot.com.
What I found was a blog entry of Timotheus Pokorra who wrote a litte C# class that managed this task for direct debits.
He generously allows anyone to use this class and provides his source code as download.
For my task, I extended his code to work with C# data objects instead of Xml data structures and added some optimizations and extensions.
The result is a set of three classes to create bank transfer or direct debit requests and allow them to be exported into to DTAUS fiel format with complete code documentation.
Of course, I will not hesitate to give back my extensions to the great work to Timotheus and the remaining web community.
Nevertheless, I do not want this class to be sold by others, so the license is Creative Commons NC-BY-SA. If you want to simply use my code in another (even sold) product, please contact me, if your product is more than "a library for DTAUS file management", I should gracefully permit you the right to use it.
(Download after german translation)
If you need a binary version of the file, just post me a line using the comments function of the blog.
Vor kurzem Stand ich vor der Aufgabe, in einem von mir geschriebenen Programm DTA-Dateien schreiben zu können, die in Deutschland verwendet werden, um Bankeinzug oder Überweisungsaufträge an Banken zu übermitteln. Nach einigem Suchen fand ich im Blog von Timotheus Pokorra eine Codedatei, die genau diese Aufgabe in C# erledigt. Der Code war für Xml-Strukturen als Eingabe entwickelt und darf frei verwendet werden.
Ich habe diese Klasse ein wenig erweitert, optimiert, Fehler ausgebügelt und zwei Datenobjekte erstellt, mit denen die Daten für den DTA-Auftrag in C#-Strukturen gespeichert werden können.
Gerne stelle ich meine Erweiterungen auch wieder frei zur Verfügung, solange die Anwendung nichtkommerziell ist (Creative Commons NC-BY-SA). Wer sie in kommerziellen Produkten einsetzen will, nimmt bitte Kontakt mit mir auf, ich bin gerne bereit, auch dafür die Freigabe zu erteilen, solange es nicht um eine Bibliothek zur DTA-Verwaltung geht...
Wer eine kompilierte Version benötigt, darf sich gerne über die Kommentarfunktion bei mir melden.
You can find the Library here: DTAUSWriter.cs
Download der DTA-Datei-Bibliothek: DTAUSWriter.cs

DTAUS Writer classes for C# von Timotheus Pokorra & Florian Harbich steht unter einer Creative Commons Namensnennung-Keine kommerzielle Nutzung-Weitergabe unter gleichen Bedingungen 3.0 Deutschland Lizenz.
Beruht auf einem Inhalt unter tpokorra.blogspot.com.
Sunday, August 23. 2009
Silverlight-Wishlist (Part I)
Up to now I've collected rather a bit of expericence in Microsoft Silverlight since its release to web.
Working with new technology always introduces some problems and shows what is still missing in "the new baby".
This article starts a little series to collect different things we found to be missing or at least "suboptimal" in silverlight. The entry will be updated or a new entry added when we find other noteworthy points.
I will start the series with some DataGrid and TreeView hickhacks (after the click). Continue reading "Silverlight-Wishlist (Part I)"
Working with new technology always introduces some problems and shows what is still missing in "the new baby".
This article starts a little series to collect different things we found to be missing or at least "suboptimal" in silverlight. The entry will be updated or a new entry added when we find other noteworthy points.
I will start the series with some DataGrid and TreeView hickhacks (after the click). Continue reading "Silverlight-Wishlist (Part I)"
Wednesday, May 27. 2009
Bring Light to your Silverlight
Ever wanted to know why the heck your brand new silverlight application crashes just once more...
Then check out the Silverlight Spy .
And, after I found out most of it myself in hard work, I finally found this great article about Silverlight Authentication patterns to be used with your silverlight app talking to your web service:
http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-3.aspx
I hope I made you cut the corner...
Then check out the Silverlight Spy .
And, after I found out most of it myself in hard work, I finally found this great article about Silverlight Authentication patterns to be used with your silverlight app talking to your web service:
http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-3.aspx
I hope I made you cut the corner...
Thursday, March 26. 2009
WCF Peer-To-Peer (PNRP) under Windows Server 2008
Some days ago on my job I was in charge of extending a legacy .net application to be able to run synchronously on serveral windows server 2008 (standard edition) hosts.
This had to be implemented because of changes to the underlaying host topology (in fact, an standalone webserver was turned into a server farm).
I decided to create a new interface DLL as an adapter to the existing app and use the Microsoft WCF (or "dot-c-f", as they like to call it) API to the PNRP service.
The use of a peer-to-peer architecture made the changes lightweight.
The development of the WCF Interface under windows vista (my development box) went quite well and worked almost immediately.
But the problems came up when I deployed the whole thing to my to win2008 hosts. No peer-to-peer communication was possible, and – even worse – the peers didn't even change their state to "connected" (meaning in microsoft speach that they aren't "alone"), although a connection via TCP and IPv6 was possible between both of the hosts.
This lead my search torwards searching for an infrastructure problem. After googling several results saying that PNRP wasn't possible under win2008 - which I couldn't imagine myself - the solution was finally pretty simple: you just have to install and enable three needed windows services:
1. peer name resolution server (install via server management center as new feature)
2. peer discovery server (same point as above)
3. (not mentioned by MSDN!) the SSDP Service has to be enabled and startet. It is not startet automatically with the PNRP service as there is no service dependency! (Simply change the service start option to Automatically.)
Be sure that all three services are running (and are startet upon system startup) and all your hosts will automagically go into the "connected" state on the LinkLocal-Peer-To-Peer-Cloud.
If you don't know what the SSDP Service is good for: don't mind, I don't either. When you're looking at Wikipedia you will find that SSDP stands for "Simple Service Discovery Protocol" and it is usually used for UPnP Device Discovery. Seems like some creative microsoft programmer decided to use this service in WCF without documenting it!
Finally two more hints, if you're new to WCF P2P Programming:
This had to be implemented because of changes to the underlaying host topology (in fact, an standalone webserver was turned into a server farm).
I decided to create a new interface DLL as an adapter to the existing app and use the Microsoft WCF (or "dot-c-f", as they like to call it) API to the PNRP service.
The use of a peer-to-peer architecture made the changes lightweight.
The development of the WCF Interface under windows vista (my development box) went quite well and worked almost immediately.
But the problems came up when I deployed the whole thing to my to win2008 hosts. No peer-to-peer communication was possible, and – even worse – the peers didn't even change their state to "connected" (meaning in microsoft speach that they aren't "alone"), although a connection via TCP and IPv6 was possible between both of the hosts.
This lead my search torwards searching for an infrastructure problem. After googling several results saying that PNRP wasn't possible under win2008 - which I couldn't imagine myself - the solution was finally pretty simple: you just have to install and enable three needed windows services:
1. peer name resolution server (install via server management center as new feature)
2. peer discovery server (same point as above)
3. (not mentioned by MSDN!) the SSDP Service has to be enabled and startet. It is not startet automatically with the PNRP service as there is no service dependency! (Simply change the service start option to Automatically.)
Be sure that all three services are running (and are startet upon system startup) and all your hosts will automagically go into the "connected" state on the LinkLocal-Peer-To-Peer-Cloud.
If you don't know what the SSDP Service is good for: don't mind, I don't either. When you're looking at Wikipedia you will find that SSDP stands for "Simple Service Discovery Protocol" and it is usually used for UPnP Device Discovery. Seems like some creative microsoft programmer decided to use this service in WCF without documenting it!
Finally two more hints, if you're new to WCF P2P Programming:
- Better turn off the windows firewall, as it is blocking the IPv4 to V6 Teredo tunneling driver. Be sure that IPv6 is supported by your network infrastructure, as it is mandatory for the PNRP protocol.
- Don't forget a config flag in your app to disable the p2p functions, as there will always be a collegue that is wondering where the heck these "random" informations came from (if he's not aware of other peers running in the same cloud, doing some crazy buggy stuff).
Thursday, February 19. 2009
Silverlight DataGrid 1.1
I recently stumbled over a bug in the Silverlight 2.0 DataGrid.
If you try to edit a row in the DataGrid and change the ItemSource while in editing mode, you will see a blank line in the area of the edited row (like the first 'row' in the image below).

This also happens when the User has clicked e.g. a button or a CheckBox inside the DataGrid before you change the ItemsSource.
Do fix this issue, simply download a new version of the Silverlight DataGrid at the Microsoft Download Site
If you try to edit a row in the DataGrid and change the ItemSource while in editing mode, you will see a blank line in the area of the edited row (like the first 'row' in the image below).

This also happens when the User has clicked e.g. a button or a CheckBox inside the DataGrid before you change the ItemsSource.
Do fix this issue, simply download a new version of the Silverlight DataGrid at the Microsoft Download Site
Wednesday, February 11. 2009
WCF Service Hosting - Enpoint Hostnames
When you have to specify an address for an WCF Endpoint using the NetTcpBinding, you have to specify a hostname:
As most bindings do, also the NetTcpBinding has a Property called HostNameComparisonMode.
The default value HostNameComparisonMode.StrongWildcard means that any host name (or ip) associated with
the computer described using the given hostname will match this endpoint (here: localhost)!
So in the example above, the Service will also be reachable via 192.168.23.42:12564 (given the "localhost" has this IP address).
(via msdn magazine (german))
Uri listenUri = new Uri("net.tcp://localhost:12564/");
ServiceHost sh = new ServiceHost(typeof(MyService), listenUri);
ServiceEndpoint ep = sh.AddServiceEndpoint(typeof(IMyService),
new NetTcpBinding(SecurityMode.None),
"MyService");
sh.Open();
As most bindings do, also the NetTcpBinding has a Property called HostNameComparisonMode.
The default value HostNameComparisonMode.StrongWildcard means that any host name (or ip) associated with
the computer described using the given hostname will match this endpoint (here: localhost)!
So in the example above, the Service will also be reachable via 192.168.23.42:12564 (given the "localhost" has this IP address).
(via msdn magazine (german))
Tuesday, February 10. 2009
SQL2008 Error setting new primary key
Ever got an error like 'could not save table changes that require the recreation of the table' when you tried to create a new primary-key or not-null constraint on a table using SQL Management Studio 2008?
Well, I got this error on my first steps on migrating to SQL2008.
The solution to this problem is pretty simple: an option setting in the 2008 Management Studio has to be changed, as such changes are blocked by the studio.
Just open the Management Studio, go to the Extra->Options Menu, Click on "Designer" and deaktivate the settings as show in the screenshot.
(via
http://www.dotnetnukeblog.de/SQL+Server+2008+Modifizieren+Einer+Tabelle.aspx)


/* Comments */