<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jason Hyland</title>
	<atom:link href="http://www.jasonhyland.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasonhyland.com</link>
	<description>Because the ratio of people to cake is too big</description>
	<lastBuildDate>Wed, 28 Sep 2011 14:01:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Using a COM component in a IIS Hosted WCF Service &#8211; Class not registered</title>
		<link>http://www.jasonhyland.com/2011/09/28/using-a-com-component-in-a-iis-hosted-wcf-service-class-not-registered/</link>
		<comments>http://www.jasonhyland.com/2011/09/28/using-a-com-component-in-a-iis-hosted-wcf-service-class-not-registered/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 13:55:02 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.jasonhyland.com/?p=103</guid>
		<description><![CDATA[If you are hosting a WCF service which utilises a COM component and is hosted in IIS you might, like I did, get confused when the calling client returns an error from the service complaining that the COM class is not registered (when you know it is!) Exception is: COMException &#8211; Retrieving the COM class ...]]></description>
			<content:encoded><![CDATA[<p>If you are hosting a WCF service which utilises a COM component and is hosted in IIS you might, like I did, get confused when the calling client returns an error from the service complaining that the COM class is not registered (when you know it is!)</p>
<p><span id="more-103"></span><br />
<blockquote>
<p>Exception is: COMException &#8211; Retrieving the COM class factory for component with CLSID {093CB055-4B2E-4700-BAEB-7EE2DED9CB8B} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0&#215;80040154 (REGDB_E_CLASSNOTREG)).</p>
</blockquote>
<p>This was very strange as instantiating the service directly worked fine. <a href="http://stackoverflow.com/questions/1036856/retrieving-the-com-class-factory-for-component-with-clsid-xxxx-failed-due-to-th" target="_blank">StackOverflow</a> to the rescue again. It appears that because my service was running in a 64bit app pool, the host process couldn’t locate the registration (There are <a href="http://msdn.microsoft.com/en-us/library/ms724072%28VS.85%29.aspx" target="_blank">separate portions of the registry</a> used to store 32-bit and 64-bit applications)</p>
<p>The fix was simply to <strong>set the app pool to enable 32-bit support</strong></p>
<p><a href="http://www.jasonhyland.com/wp-content/uploads/2011/09/image12.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.jasonhyland.com/wp-content/uploads/2011/09/image_thumb13.png" width="392" height="158"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonhyland.com/2011/09/28/using-a-com-component-in-a-iis-hosted-wcf-service-class-not-registered/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Return multiple values from Python</title>
		<link>http://www.jasonhyland.com/2011/09/21/return-multiple-values-from-python/</link>
		<comments>http://www.jasonhyland.com/2011/09/21/return-multiple-values-from-python/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 07:57:00 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.jasonhyland.com/2011/09/21/return-multiple-values-from-python/</guid>
		<description><![CDATA[I’m playing with Python for a little pet project (more posts to come I hope) and I just love the way Python deals with returning non scalar values from functions def getStarSign(name): return name,42,'Taurus' name, age, starSign = getStarSign('Jason Hyland') print name, age, starSign This just feels so intuitive. The alternatives in C# are just ...]]></description>
			<content:encoded><![CDATA[<p>I’m playing with Python for a little pet project (more posts to come I hope) and I just love the way Python deals with returning non scalar values from functions</p>
<p><span id="more-96"></span>
<pre class="csharpcode">def getStarSign(name):
    <span class="kwrd">return</span> name,42,<span class="str">'Taurus'</span>

name, age, starSign = getStarSign(<span class="str">'Jason Hyland'</span>)

print name, age, starSign</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>This just feels so intuitive. The alternatives in C# are just unsatisfactory: out params, returning tuples or dictionaries or other such ‘hacks’</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonhyland.com/2011/09/21/return-multiple-values-from-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using XSD to generate class for schemas which use imports</title>
		<link>http://www.jasonhyland.com/2011/09/19/using-xsd-to-generate-class-for-schemas-which-use-imports/</link>
		<comments>http://www.jasonhyland.com/2011/09/19/using-xsd-to-generate-class-for-schemas-which-use-imports/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 09:58:42 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[BizTalk XSD Schemas]]></category>

		<guid isPermaLink="false">http://www.jasonhyland.com/2011/09/19/using-xsd-to-generate-class-for-schemas-which-use-imports/</guid>
		<description><![CDATA[I’ve always prefer to use class based messaging in BizTalk. This is pretty straightforward and involves generating classes from schemas using the XSD.exe tool supplied. Because I treat messages in BizTalk the same way that DTO’s are used in traditional domain driven development – the are merely a mechanism of passing data from the UI ...]]></description>
			<content:encoded><![CDATA[<p>I’ve always prefer to use <a href="http://blogs.msdn.com/b/dhtoran/archive/2005/06/01/423754.aspx">class based messaging</a> in BizTalk. This is pretty straightforward and involves generating classes from schemas using the XSD.exe tool supplied.</p>
<p><span id="more-81"></span>
<p>Because I treat messages in BizTalk the same way that DTO’s are used in traditional domain driven development – the are merely a mechanism of passing data from the UI (or in my case an integration point) to the next layer.</p>
<p>
<p>However, I came across an error generating the class today referring to an ‘element is not declared’</p>
<p><a href="http://www.jasonhyland.com/wp-content/uploads/2011/09/image4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.jasonhyland.com/wp-content/uploads/2011/09/image_thumb4.png" width="517" height="177"></a></p>
<p>After some head scratching I realised that it was complaining about a node that I’d imported from another schema. I guess this would have caused the generator a bit of a problem. Thankfully Google came to the rescue with this <a href="http://www.mgbrown.com/PermaLink38.aspx" target="_blank">post</a> from Martin Brown . I reproduce the code here (the post is almost 8 years old);</p>
<p>Schema 1</p>
<pre class="csharpcode">&lt;?xml version=<span class="str">"1.0"</span> encoding=<span class="str">"utf-8"</span> ?&gt;
&lt;xs:schema targetNamespace=<span class="str">"http://example.com/XMLSchema1.xsd"</span>
    xmlns:xs=<span class="str">"http://www.w3.org/2001/XMLSchema"</span>
    xmlns:examp1=<span class="str">"http://example.com/XMLSchema1.xsd"</span>
    xmlns:examp2=<span class="str">"http://example.com/XMLSchema2.xsd"</span>&gt;

    &lt;xs:import <span class="kwrd">namespace</span>=<span class="str">"http://example.com/XMLSchema2.xsd"</span> schemaLocation=<span class="str">"XMLSchema2.xsd"</span> /&gt;

   &lt;xs:element name=<span class="str">"example"</span>&gt;
        &lt;xs:complexType&gt;
            &lt;xs:sequence&gt;
                &lt;xs:element name=<span class="str">"test"</span> type=<span class="str">"examp2:myType"</span> /&gt;
            &lt;/xs:sequence&gt;
        &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
&lt;/xs:schema&gt;</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Schema 2</p>
<pre class="csharpcode">&lt;?xml version=<span class="str">"1.0"</span> encoding=<span class="str">"utf-8"</span> ?&gt;
&lt;xs:schema targetNamespace=<span class="str">"http://example.com/XMLSchema2.xsd"</span>
    xmlns:examp2=<span class="str">"http://example.com/XMLSchema2.xsd"</span>
    xmlns:xs=<span class="str">"http://www.w3.org/2001/XMLSchema"</span>&gt;
    &lt;xs:complexType name=<span class="str">"myType"</span>&gt;
        &lt;xs:sequence&gt;
            &lt;xs:element name=<span class="str">"test"</span> type=<span class="str">"xs:string"</span> /&gt;
        &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
&lt;/xs:schema&gt;</pre>
<p>So, the key trick is to pass in the imported schema in the XSD command line. The other thing to remember if you aren’t setting the output filename is to put the “real” instance schema at the end of the list of schemas otherwise you’ll get a file named after your imported schema.</p>
<pre class="csharpcode">xsd.exe schema1.xsd schema2.xsd /c</pre>
<p>Thanks google!</p>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonhyland.com/2011/09/19/using-xsd-to-generate-class-for-schemas-which-use-imports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The challenge of migrating legacy code</title>
		<link>http://www.jasonhyland.com/2011/09/16/the-challenge-of-migrating-legacy-code/</link>
		<comments>http://www.jasonhyland.com/2011/09/16/the-challenge-of-migrating-legacy-code/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 17:32:10 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.jasonhyland.com/?p=71</guid>
		<description><![CDATA[If you&#8217;d have told me back in 2001 that I’d still be looking at VB6 code 10 years later I would have laughed in your face. But like the fabled hover skateboards I’m still waiting for (thanks a bunch Marty), the future has a habit of pulling out a few surprises when you least expect ...]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;d have told me back in 2001 that I’d still be looking at VB6 code 10 years later I would have laughed in your face. But like the fabled <a href="http://en.wikipedia.org/wiki/Hoverboard">hover skateboards</a> I’m still waiting for (thanks a bunch Marty), the future has a habit of pulling out a few surprises when you least expect them. So having spent the last few years working on entirely greenfield projects I found myself part of a team migrating a large financial system from VB6 and PHP to a shiny new SOA based architecture.</p>
<p><span id="more-71"></span></p>
<p>Unless you are very lucky, when embarking on a major enterprise transformation you will have to deal with a significant base of legacy code. To you and many of your developers it’s probably seen as badly designed, poorly implemented code that someone else wrote and left you to maintain - or more commonly known as “<a href="http://en.wikipedia.org/wiki/Not_Invented_Here">not invented here</a>” syndrome.  It has probably been serving the company well and making it money for many years. Your options are either a complete rewrite or integration with the current code base – or somewhere in between those extremes. Of course, you could have taken on so much technical debt maintaining your systems that you’ve now become bankrupt and defaulted. Even then, Uncle Bob cautions on <a href="http://blog.objectmentor.com/articles/2009/01/09/the-big-redesign-in-the-sky">the big redesign in the sky</a>.</p>
<p>The company (they are the people that pay your salary) are likely to have limited sympathy anyway for most suggestions which involve the wholesale rewrite of this legacy code. Of course you can always roll out the trite arguments that the system will be easier to maintain, it will be able to adapt to new opportunities and can meet changing needs of the business much more quickly, it will save money in the long run. And do you know what they may even go for it. But, don’t underestimate the risk you are taking before embarking on a complete rewrite.</p>
<p><img style="margin: 3px 10px 3px 9px; display: inline; float: right;" title="" src="http://nsarchive.files.wordpress.com/2010/04/mk_6_nuclear_bomb.jpg" alt="The Nuclear Option: Rewrite?" width="302" height="228" align="right" /></p>
<p><strong><em>So, before you pull the trigger on the nuclear option, take some time to consider how you can live with a staged migration of systems and components.</em></strong></p>
<p>The first thing we wanted to do is ensure that where possible, any new components or services we create utilise our new solution design. This would be pretty straight forward if our new components lived in isolation. Yeah, right. Think of all those little features that any new business requirement needs – for example, cross cutting concerns like configuration, logging, exception handling etc. So you start thinking about migrating some of these as well. Then you realise that if you migrate these, then you’ll soon be migrating other dependencies or worse, duplicating config stores, log locations etc.</p>
<p>As soon as you start pulling at the edges of your code base to look at what can be migrated to the new solution you soon run into these difficulties. A web of dependencies. One strategy to deal with this is to get your new and old code to integrate in a way which doesn’t pollute your new environment but allows you to leverage your existing infrastructure whilst staging the migration. Thankfully, Microsoft have thought this through and have given us some great tools to get components talking together.</p>
<p>In this series of posts I’m going to look at how we could deliver that integration</p>
<ul>
<li>How COM components can call WCF services</li>
<li>How WCF services can expose legacy COM components</li>
<li>How well does .NET/COM integration perform</li>
</ul>
<p>If you want to learn more about the integration between .NET and COM I’d strongly suggest getting a copy of <a href="http://www.amazon.co.uk/NET-COM-Complete-Interoperability-Guide/dp/067232170X" target="_blank">.NET and COM: The Complete Interoperability Guide</a>. Whilst it’s almost 10 years old, much of the COM complexities are covered in great detail.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasonhyland.com/2011/09/16/the-challenge-of-migrating-legacy-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

