WCF Tutorial: WCF Service with Windows Service (Part 3 of 3)

Just a stub Creating Service Contract Creating DataContract Creating FaultContract Creating Windows Service Host Creating Proxy Creating Client Creating app.config with WCF config Editor in Microsoft Visual Studio 2010 Installing/Uninstalling/Starting/Stopping Windows Service Host with sc.exe Use client to connect proxy to host, and consuming services. Programatically configure service and proxy using and without using app.config […]

WCF Tutorial: WCF Overview (part 1 of 3)

Just a stub first: WCF is Windows Communications Foundation By default, it sends message using SOAP protocol by serializing data structures into XML. For serialization, it specifies the DataContract and DataMember attributes. For Interface programming, it specifies the ServiceContract and OperationContract attributes. For Error and Exception handling, it specifies the FaultContract attribute. Language agnostic (the […]

Microsoft Sync Framework Unhandled Exception “Retrieving the COM class factory for component with CLSID…”

From the Microsoft Sync Framework 2.1 SDK download page http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=23217 in the last part where it says instructions: It is not possible have full 32-bit Sync Framework 2.1 SDK installed side-by-side with the 64-bit SDK; therefore you will have to install one version of SDK (64-bit) completely and only selected components of other version (32-bit) […]

Connect to remote SQLEXPRESS server (2005 / 2008)

A few things to set up on the SQLEXPRESS before client can connect to it remotely. Go to SQL Server Configuration Manager > Network Configuration > Protocols for SQLEXPRESS and enable TCP/IP. The default installation of SQLEXPRESS does not enable TCP/IP. If you are connecting via other protocols, enable those (obviously). Go to the host […]

Bottom margin or spacing in an inline img

Inline img tags by default is positioned such that it has an additional bottom spacing relative to its parent block element. If the parent block element e.g. div have zero padding and the img have zero margin, the img height will not equal to the div height as the additional spacing will push the parent […]

One-to-many mappings

A lot of times I had to look for a data structure to store one to many relationships such as a list of products keyed by their categories. I remember the last time I coded in C++ I used a whole lot of std::multimap to do just this. With C#, there isn’t such a container. […]

Tournament rankings – a K-ary sort problem

I was working on some programming projects then I suddenly got stuck at a particular problem that took me a whole day still unable to solve. When simplified, it looks like this: Background Consider a tournament where we want to find out the ranking of N contestants. In each competition, M contestants compete with each […]

C# static initialization sequence

Object orientated code could break down dangerously when using static class members in an unorthodox manner. Static initialization sequence goes like this: 1. Program starts, mark all classes that has static members as statically uninitialized. 2. Enters a scope where static calls are made. 3. Check, in order of execution sequence, get the first class […]