THINK

that’s how i naturally know

Archive for the ‘Programming’ Category

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

without comments

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

Concepts beyond: Port sharing, IIS hosting, behaviors, tracing, message logging, using MSVS tools to do Metadata extraction.

Written by Jake

December 7th, 2011 at 2:55 pm

Posted in Programming

Tagged with ,

WCF Tutorial: WCF jargon (Part 2 of 3)

without comments

Just a stub:

Service
Host
Endpoint
Binding
Metadata
Behavior
Protocol

Tracing
Message
Fault

Proxy
Client

Written by Jake

December 7th, 2011 at 2:47 pm

Posted in Programming

Tagged with ,

WCF Tutorial: WCF Overview (part 1 of 3)

without comments

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 only thing fixed is SOAP) such that JAVA or other apps can consume the services.
Hide implementation and expose only interface specific faults (as oppoosed to Exceptions)

A WCF service is typically compiled as an independant DLL that can be hosted by one of several methods i.e. IIS, Windows Service or Self-hosted e.g. in a WinForms application, WPF application.

The Microsoft .NET 4.0 framework with Microsoft Visual Studio 2010 provide some magic code and convenient designer UI to build both the WCF service and the client.

Written by Jake

December 7th, 2011 at 2:44 pm

Posted in Programming

Tagged with ,

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

without comments

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) of SDK. See Sync Framework Tips and Troubleshooting topic for details.

But that statement isn’t totally clear: The way to install for 64bit development machine is to download the x64 for the SDK and the fill the x86 parts with the redistributables from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=19502

It works for me at least. Hope it helps.

Unrelated tidbit: I broke the Microsoft Forums layout when I posted this as a reply to http://social.microsoft.com/Forums/en/syncdevdiscussions/thread/34a04f62-014a-48a0-9397-256b6ad1387b

Check this out:

Written by Jake

December 6th, 2011 at 10:33 am

Posted in Programming

Tagged with

Connect to remote SQLEXPRESS server (2005 / 2008)

without comments

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 machine’s services.msc and enable the SQL Server Browser service. You may want to change the startup to Automatic as well.

Additionally, you may need to configure SQL Express to use Mixed Mode Authentication. This is normally a one-time configuration during the installation of the server, however, it can be changed manually through the registry at HKLM\Software\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer and set LoginMode to 2 (decimal)

Then restart SQL Server (SQLEXPRESS) in services.msc to make it use the new settings.

If users are required, use Microsoft SQL Server Management Studio to add users that can log in with SQL authentication.

Written by Jake

November 25th, 2011 at 1:19 pm

Posted in Networking,Programming

Tagged with

One-to-many mappings

without comments

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. The only way is to construct your own container by creating some sort of Dictionary<Key, List>.

Better still, if you only need to add elements once you can just use a simple List<data>, add your data by List.Add() then make a LINQ call to List.ToLookup(). And you immediately have a one to many mapping. This is much more elegant since you do no need to check the dictionary for existing key each time you want to add data.

Written by Jake

October 3rd, 2011 at 11:52 pm

Posted in Programming

Tagged with , ,