DonXML Blog

The East Coast Don

  • NYC .Net Meeting Thursday, Jan. 15th

    I’m going to the NYC .Net meeting (which I usually don’t do since it is quite a commute) on Thursday.  Scott Hansleman (sponsored by INETA) is presenting a session on the Zen and Art of Web Services (got to show support for my homies).  I wonder if Rory will try to stow away in Scott’s luggage.  If anyone wants to get together, contact me, or just meet me at the meeting.

  • OneNote For Blogging

    I’m sure others have thought of this, but OneNote would be an excellent tool for a blogging editor, except for the fact that the API isn’t public.  I use OneNote all the time to jot done my blog entries, and then copy and paste them into the my site.  I’d like to create a plugin for OneNote to post to my blog via the SOAP APIs, but since the OneNote APIs are private that can not be done.  Yes I know that I could save it to a mht file, and write a script to parse it and post it to my site, but that’s a kludge.  It would be so much better to do it right from OneNote.  I see that Don Box is creating an XSLT to convert WordML to XHTML, which is another possibility, if I wrap that in a Word Macro that can post to my site.  Maybe that is something that I should tackle this week.

  • NJ/NYC Bloggers Dinner/Meeting 12/18

    I know this is short notice, but if anyone in the NJ/NYC area wants to get together with a bunch of other .Net bloggers, we are meeting up at the NYC .Net meeting tomorrow 12/18.  I had planned on hooking up with Sean Gerety and some of his coworkers this week, and then Tim Marman suggested meeting at the NYC .Net meeting.  We will be going out for dinner/drinks afterwards.

  • Object Constraint Language

    Geez, I don’t know why I haven’t bumped into this before, but while doing some research on Test Driven Development for my current client, I ran across the Object Constraint Language[corrected his name from Josh to Jason.  doh!] Jason Gorman has released a cool slide deck on OCL for .Net developers that you should check out (plus check out the other slides on UML for .Net developers).  You use it to supplement your UML diagrams.  Instead of having free form text in the UML constraints, you use OCL instead.  The thing that I like about it is that it is totally declarative.  It is an expression that can only evaluate to true or false.  OCL is also a C like language, so it is easy to convert to C#.  Josh talks about the different ways we implement constraints in our code.  There is the Debug.Assert() method, which most C++ programmers use (Design By Contract), and the Defensive Programming version, throwing Exceptions.  Since Debug.Assert isn’t a viable way to implement constraints in .Net (it throws a PopUp Box and is meant for debugging only), most .Net developers use the Defensive Programming style.  That is, before you do any real work in a method, you check the pre-conditions and throw exceptions if there is a problem.  This is the style that I’ve been using in most of my apps.

  • Lessons Learned

    When using a COM component created by a company known for their great cross platform statistics software, but not known for their Windows expertise, creates a COM component and sets the component’s threading model to both (STA and MTA models), don’t trust it.  If said component was developed for and tested against VB 6.0 and you are using .Net, don’t trust that it can handle MTA, even though their sample .Net code never checks to make sure it is running on STA thread.  And if you are really foolish enough to try to use this component in a multithreaded service, and it works “almost” all the time, but occasionally hangs all threads in the process, the first thing you should do is make sure all threads that call the component have their ApartmentState set to STA.  Then make sure that the wrapper dll that you wrote to make life easier to deal with this crazy component checks the thread’s ApartmentState, and throws an error if it isn’t STA.

  • When Good Programs Go Bad

    Ahhhhh!  I hate it when good programs go bad.  As you can probably tell from the lack of good quality posts lately, I’ve been busy with work.  At my client, we are at the end of our development cycle, and getting ready for formal testing (thanks to all the FDA requirements it takes about 3 times as long as it should).  Everything was looking good except for the most complicated piece of code (which of course is mine).  Basically, I wrote a .Net data provider for SAS, and placed that in my Data Access Layer.  I re-engineered the Async Application block to work with my Line of Business code (and removed all the SQL Server stuff), which calls my Data Access Layer which calls either the Oracle Provider or my SAS provider.  The .Net SAS provider calls a COM dll (provided by SAS) via COM interop, and the COM component talks to a Unix box via a TCP/IP.  Lots of places for things to go wrong, and unfortunately, something does go wrong occasionally (but not always).  I can’t see to track down exactly what goes wrong, but the net result is sometimes a worker thread makes a call to the SAS server, (via the SAS provider and the COM component) and it never stops waiting for a response.  I can check the SAS process on the Unix box, and it says it has completed and is closing the connection, but either the COM component never gets the close message, or the COM interop never fires the complete event (or even the error event).  We have all sorts of network issues, so it could be a network issue, so I’ve got to do some network sniffing.  Or, it could be COM interop causing the problems.  I thought it could be a multi-threading issue, but I still get the problem occasionally when single threaded.