Performance counter provider in C#

| No Comments

Chris Sells (www.sellsbrothers.com) posted a command line parsing utility class (in C#) a while ago. I can't find a link to it now so here's the source.
Based on its use of reflection I created a base class for performance counter providers. Download the source here.

SmartGrid.NET website

| No Comments

SmartGrid.NET is something i am involved with, independently from my current employer.

SmartGraph.NET website

| No Comments

finally managed to put together a website for something i worked on a while ago. its a C# implementation of graph scheduler engine toolkit called SmartGraph.NET

NOTE: until the site comes back up the SmartGraph.NET source code can be downloaded from here.

i have started using msi installations for our project. one thing that i found useful is the orca msi tool, which seems to be part of some Microsoft Platform SDK. you cannot download it separately though, unless you go here ;-)

C# explorer context menu handler

| No Comments

here's some code that shows how to implement a Explorer Shell Extension in C#. it allows you to create custom context menus in directories you want. download source code here.

references for this implementation:

once you build it, use 'regasm /codebase' (i try to stay clear of the GAC as much as possible) to register the assembly for COM interop, that's it!

i have just noticed that in ATL shipped with VS2003 CComBSTR ToUpper() and ToLower() ASSERT when called on an empty (not NULL) string. i have to say i don't understand why that makes sense? surely it is desireable that a conversion to upper/lower on empty string yield an empty string and not an assertion.

fortunately we use our own CComBSTR wrapper, so the fix for this is as easy as:

   HRESULT ToUpper()
   {
      if ( ::SysStringLen(this->m_str) > 0 )
         return CComBSTR::ToUpper();

      return S_OK;
   }

wrapper for the ATL::CUrl class

| No Comments

some useful code for manipulating url-type strings. uses ATL::CUrl and allows non-standard url types. examples provided show how to implement a COM url:

   com:///Clsid=0002df01-0000-0000-c000-000000000046&ClsCtx=CLSCTX_INPROC_SERVER

and a PubSub url:

   pubsub://localhost:1234/Queue=A.B.C

download sources here.

soa2wsdl part II

| No Comments

i decided that soa2wsdl is going to be very useful in helping me deal with web service development (see previous posting on this). i created a simple C# console app which does the transform and which can also execute the 'wsdl.exe' utility to generate C# code from WSDL.
the zipped project is here.

smartgraph.net

| No Comments

some of my spare time (away from my current employer) is used up developing various ideas, mainly in C# on .NET and C++.

one of the concepts that i frequently re-use is the Directed Acyclic Graph or DAG. this is a simple DAG implementation, part of smartgraph.net (soon to go on-line hopefully :-).

soa2wsdl

| No Comments

i never really liked WSDL, but, because of its interoperability, i use it frequently. in my current work on service oriented architecture (SOA), i stumbled onto an article on Clemens Vasters' blog. it shows how metadata attributes can be used to embelish an XML Schema. taking Clemens' hint, i created an XSL Transform which generates WSDL from 'embelished schemas'. an example of such a schema (soa-sample-getprice.xsd) is given below. download the other files:


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:soa:sample:price-service" 
            xmlns:xs="http://www.w3.org/2001/XMLSchema" 
            xmlns:soa="urn:soa:metadata" 
            xmlns:tns="urn:soa:sample:price-service" 
            xmlns="urn:soa:sample:price-service" 
            elementFormDefault="qualified" 
            soa:service="GetPriceService" soa:url="http://soa1.soahost.net"
>
    <xs:complexType name="GetPriceRequestType">
        <xs:sequence>
            <xs:element name="SessionId" type="xs:string"/>
            <xs:element name="Ric" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="GetPriceResponseType">
        <xs:sequence>
            <xs:element name="SessionId" type="xs:string"/>
            <xs:element name="Ric" type="xs:string"/>
            <xs:element name="Value" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="GetPriceFaultType">
        <xs:sequence>
            <xs:element name="SessionId" type="xs:string"/>
            <xs:element name="Ric" type="xs:string"/>
            <xs:element name="Reason" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="GetPriceMethodType">
        <xs:all>
            <xs:element name="GetPriceRequest" type="tns:GetPriceRequestType" 
                    soa:message="GetPriceRequestMessage" soa:message-type="request"/>
            <xs:element name="GetPriceResponse" type="tns:GetPriceResponseType" 
                    soa:message="GetPriceResponseMessage" soa:message-type="response"/>
            <xs:element name="GetPriceFault" type="tns:GetPriceFaultType" 
                    soa:message="GetPriceFaultMessage" soa:message-type="fault"/>
        </xs:all>
    </xs:complexType>
    <xs:complexType name="GetPriceInterfaceType">
        <xs:all>
            <xs:element name="GetPriceMethod" type="tns:GetPriceMethodType"
                    soa:method="GetPriceMethod"/>
        </xs:all>
    </xs:complexType>
    <xs:element name="GetPriceInterface" type="tns:GetPriceInterfaceType"
                    soa:interface="GetPriceInterface"/>
</xs:schema>