My TechEd Session: Advanced Microsoft BizTalk 2006 R2 Concepts

My TechEd Session: Advanced Microsoft BizTalk 2006 R2 Concepts

Just wanted to point out I’ll be at Tech Ed in Orlando next week presenting my first break out session.  The session is “Advanced Microsoft BizTalk 2006 R2 Concepts”.  It’s SOA312 on Thursday at 2:45 PM. 

The abstract is below:

“Business processes are a required component in most Enterprise Integration solutions today. Business processes are modeled, designed, and built inside BizTalk Server 2006 R2 using Orchestrations. Orchestration can range from a few simple shapes to a complex multi Orchestration, Transactional process. This session focuses on highlighting key Orchestration features to shorten development time and increase overall Business Process reusability. Also, messaging-only scenarios using WCF are discussed, and the power of BizTalk as a Web service routing system is shown. Topics covers are: Untyped Messages, Dynamic Transforms, Starting Orchestration and Passing Port Parameters, using Helper .NET Components, and Message Only WCF Calls.

If you like the content on me website and blog, then you’ll probably like this talk.

Hope to see you there.

IE7 issues with this site…

IE7 issues with this site…

Apologies if anyone has been experiencing IE7 crashes when trying to read articles on this site (though I don’t really see why I should apologise for IE7 crashing!). As far as I can tell, this seems only to affect IE7 users on Vista. IE7 on XP appears to be unaffected, and Firefox is OK. The problem appears to be related to having a ‘blogmap’, although it only affects certain pages (articles, rather than posts). I’ve removed my blogmap, and the problem appears to have gone away.

If anyone has any further problems, please contact me via the site (once you’ve recovered from a crashed IE7 instance, that is!).

Update: The problem continued to re-occur, although far less frequently. So I played around some more. I had switched on the Subtext CoComment feature. I switched this off, and things got much more stable. So, something about CoComment support in SubText seems to cause an IE7 crash. I’ve put the blogmap back in. Seems to be working OK.

Its hard to remember to live before you die…

Its hard to remember to live before you die…

It is so easy to get caught up in our day to day existence… it often takes a moment to make us once again  become present to the now.

I have been teaching my daughter to stand up and gain the confidence to walk. Tonight when I got home from work she took her first steps… of course I was on hand with my video camera to capture the moment!

function CreateSilverlight(){Sys.Silverlight.createHostedObjectEx({source: “streaming:/33/IndigoWalk”,parentElement: IndigoWalkWrapper});}

var IndigoWalkWrapper = document.getElementById(“IndigoWalkWrapper”);

Microsoft Expression Landed Today

Microsoft Expression Landed Today

As of today the full family of Microsoft Expression products are available for purchase in New Zealand!

Web, BlendMedia (includes license for Expression Media Encoder when it ships) or the whole Studio (which includes includes the other 3 + Design).

For developers Web and Blend are included in MSDN Premium subscriptions. The whole Expression Studio is available to those with the Visual Studio Team Suite subscription.

To purchase any of the Microsoft Expression products today contact your Microsoft Reseller (they can give you NZ pricing etc).

The boxed products in stores are coming but that is a bit further away.

P.S. If you are having been using the trial versions of Microsoft Expression over the last year please share your projects with me. I’m always interested in showcasing local work.


The Daily WTF for Dummies

The Daily WTF for Dummies

I don't know why this site changed it's good ol' name from The Daily WTF to "politically correct" WorseThanFailure but I wouldn't do it in my case. I happen to perform code reviews on Java to .Net migration recently and in both I find enough "programming pearls" to keep me saying WTF every day for weeks. I thought about posting some of them and sharing the link with creators of such masterpieces as I may guess who's behind. They might get angry at me but it's for good to let them learn from their mistakes (if capable).

There's a Russian book for children by Gregory Oster. The title translates like Harmful Advice for Naughty Children and Their Parents. Unfortunately, it's not been translated in English yet. It's filled with sarcastic rhymes and stories that will make your abs sore of laughing. The only English reference to this book I found is here. The book "teaches" kids to do bad things in quite humorous fashion.

I compiled some "tips" from code reviews in the manner of "The Harmful Advice: For Lamer Programmers and Wannabies". Code is stripped and de-personated so no harm to business only to developer's ego perhaps:

1. Whenever you use ADO.NET open as many DataReaders as possible and do not close them when done. Better yet, open several of them in nested loops. It's OK to keep connections open, that's what connection pools for, right?

2. When you get the data back in the DataReader, religiously check the data field for null:

    if(dataReader[0] != null)
{ myVal = dataReader[0];

Sometimes, it's good to double check later down the road:

    if(myVal != null){}

It's all about defensive programming. And never trust DbNull and IsDbNull method of the DataReader.

3. Don't rely on reference types (.NET), they are evil. In most important cases pass them using ref keyword:

    SomeMethod(int param1, string param2, ref SomeClass imfeelingspecial);

4. Value types in .Net are more useful than you'd think. On a good day they can pass your data in and out just as easy as reference types:

SomeStruct commonInfo = new SomeStruct();
commonInfo.Field = “Let's see.”;
FoodProcessor proc = new FoodProcessor(commonInfo);
proc.MunchData(); //- munches data and re-assigns commonInfo fields
if(commonInfo.Field == "Expected Value From FoodProcessor")
{// <- lots of prayers needed to make it here!
{//- Doh! It always comes here anyways...

5.  Do not trust SQL select results, it's not always obvious how many columns it returns. Make a habilt of checking the columns count in the resordset:

string sqlQuery = "SELECT column1, column2, column3 from SomeTable WHERE column4 = " + someVal;                                 
 if (reader.Read())
     int fcnt = reader.FieldCount;
     if (fcnt >= 1)
         var1 = reader.GetDecimal(0).ToString().Trim();
     if (fcnt >= 2)
         var2 = reader.GetDecimal(1).ToString().Trim();

6. For money calculation always use low precision floating data types:

Float itmPrice = new Float(getIn().getRecords(count).getItemPrice());
Float itmQty = new Float(getIn().getRecords(count).getItemQuantity());
float exPrice = itmPrice.floatValue() * itmQty.floatValue();
extendPrice = extendPrice.valueOf(exPrice);

So, in this Java example, for itmPrice = 2.66 and itmQty=995 you will get a nice special price of 2646.7002. Decimal arithmetic is for pedants.

7. Always warm up the CPU before performing date calculations. This can be achieved by using many variables of different types and converting them back in forth to each other:

      Calendar myCal = Calendar.getInstance();    
      Float fltTermNbr = new Float(newSrvcTerm);
      Float sevenDays = new Float("7");
      float fltTermNbrInDays = fltTermNbr.floatValue() * sevenDays.floatValue();
      String strTermNbrInDays = "";
      strTermNbrInDays = strTermNbrInDays.valueOf(fltTermNbrInDays);
      strTermNbrInDays = strTermNbrInDays.substring(0, strTermNbrInDays.indexOf("."));
      Integer IntegerTermNbrInDays = new Integer(strTermNbrInDays);
      int intTermNbrInDays = IntegerTermNbrInDays.intValue();
      myCal.add(myCal.DAY_OF_YEAR, intTermNbrInDays);

Just for us, lazy ones, all the Java code above is trying to do is:

             int termNbrInDays = Convert.ToInt32(newSrvcTerm) * 7;
             myDate = myCal.AddDays(myDate, termNbrInDays);

Still suck at writing bad code? Consider a mentor. Hire a developer with the thickest resume and largest amount keywords in it. At the end, one must be really hardworking to create one. Give him a title he wants: usually Lead Architect or something like this. Let him write the code and teach others. Well, I have to go back and dig up some more jewels…


BizTalk 2006, WCF (basicHttpBinding), Adding Web Reference will go in end less loop.

BizTalk 2006, WCF (basicHttpBinding), Adding Web Reference will go in end less loop.

When I tried to add a “Web Reference” to a WCF service (basicHttpBinding), I encountered following behaviors

1. Either it will throw an exception showing “Failed to add Web Reference” and no more clue anywhere, OR

2. Message saying “This page is accessing information that is not under its control. This poses a security risk. Do you want to continue?” it wont wait for your reply, it will go on endless loop until you click “NO” (then you need to close some 50 or windows), OR

3. It will throw an exception message saying, “Could not generate BizTalk files. Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index”

I attached following screen shots for reference:


Tweaking the WCF config file with different setting didn’t give me any luck. At last I figured out the issue is due to the namespace declaration for the WCF service. Just removing the namespace declaration and defaulting it to use “” (which is not the best practice) solved the problem.


[ServiceContract(Name = “BackOfficeServices”, Namespace = http://companyurl/Service/BackOffice)]


[ServiceContract(Name = “BackOfficeServices”]

I can’t really justify the reason, but I guess it will help someone.



More on Outsourcing/Offshoring

More on Outsourcing/Offshoring

The current issue of Dr. Dobb’s Journal has an article (Software Development In Eastern Europe) about the Outsourcing/Offshoring topic I posted a while ago. The article focuses in Eastern Europe. One of the interesting conclusions was that the %u00abregion%u00bb no longer competes for price with countries like India. The cheap talent seems to be gone, and prices will soon rise to that of Western countries (“one source describes the formerly crucial pool of cheap Eastern European programming talent as simply %u00abgone%u00bb”). Apparently the communication (and cultural?) barriers are lower than with other countries, which seems to be relevant to this, as well as the proximity of the EC.

The topic that really struck me as interesting was in part 4, where the article discusses how several companies are now doing their R&D work (including product development) in those countries. It’s not only dumping code made to measure, but also the R&D and creating work itself that’s being moved.

A few months back, I met two guys online in a chat. One of them worked for EDS, the other was a car mechanic. This same topic came up, and they seemed very concerned about Europe and our loss of identity because of immigration and cheap labor (not only in IT). The second guy said the “selected” that job precisely because the know it wouldn’t ever be offshored.

Kind of ironic, isn’t it?

Customizing the Web Service Software Factory

Customizing the Web Service Software Factory

Together with a colleague, I spent 2 weeks customizing the Web Service Software Factory, to change some of its behavior. It was the first time I used it in practice, apart from doing the tutorials and some peeking into the recipes and available actions. We basically modified the source of the contracts from XSD files to information stored in a database, some templates, and created a new template from scratch.

We changed the WCF version, not the ASMX, and what I found was that changing this factory is much simpler than creating one from scratch.

The documentation is still lacking (I still remember reading all the docs on GAT of one of the beta’s and being utterly unable to create a factory with it), but the factory’s actions are very well factored, and were very simple to change. Apart from the incomplete documentation, the feature that really irritated me was the lack of intelisense/syntax-coloring/debugging while writing t4 templates. A real nightmare. Microsoft should look into this ASAP. I called a friend asking for advice, and his comment was: “Just leave your generation code out of the templates, in .net helper methods. There’s no way around it.

I also like the pattern the factory uses to create projects and organize the code’s functionality, and will use it surely in future projects.

Pipeline Component, XmlSerialization and Performance

I’m basically replying to Yossi’s post here. I tried to leave it as a comment in his post but for some reasons my comments are not getting posted in his blog.

Myself and Yossi used to work together in a big public sector Healthcare BizTalk project for nearly 1.5 years.

First off all I need to thank Yossi for his complement about my white paper “Understanding Design-Time Properties for Custom Pipeline Components in BizTalk Server“. Yossi mentioned in his post about the potential performance problem in using XmlSerializer inside pipeline component. Until now I thought his point is valid, but after reading the very first chapter from Professional BizTalk Server 2006 by (DJ, KS and EF) , where Darren explains about Serialization and performance hit, its clear there is NO PERFORMANCE HIT by using XmlSerialization in a BizTalk solution.

I thought the explanation will be helpful for readers to make the decision. The following extract is from the book (Page 11):

When you first use the XmlSerializer in your application against a given type, a dynamic class is created and compiled on the fly to represent the serialized class. This has an obvious performance over head, but it will be cached for susbsequent requests

This cache is maintained per AppDomain, which is fine for applications like BizTalk, as there is by default only one AppDomain per BizTalk host.

So, eventually by using XmlSerialization inside the pipeline component, you’ll hit the penalty only once during the lifetime of the component. That’s until some one restarts the host.