19 April, 2010

Excel Solutions - Gross, but Occasionally Useful

So, once again maybe I'm behind the curve a bit, but I just found the Excel project types in VS2008. So in those cases where I need to hack something in Excel, I can now do it with managed code instead of VBA.

There were, however, a few things to note.
1) Security. The code needs to be Fully Trusted to run. In Admin Tools-> Microsoft .NET Framework 2.0 Configuration, go to Configure Code Access Security Policy. Go to Runtime Security Policy->User->Code Groups->All_Code, and add a new code group. I named mine "Ross Dev", based it on URL (specified my dev folder), and gave it Full Trust. Office projects are automatically given Full Trust, but at some point I had to do this, not sure why-- maybe when I tried to move it out of the original location.

This can also be done with the Caspol.exe commandline tool, but I like the GUI.

b) My app had to make a call to a web service, and it took a while to return data. I got a message about "blah blah blah pumping Windows messages blah blah" and mentioned an MDA ("Managed Debugging Assistant"). To turn this @#$% off, note the name of the MDA, go to the Debug->Exceptions... in VS, and expand "Managed Debugging Assistants"-- untick the trouble maker.

3c) The issue I haven't resolved, and therefore have just accepted, is that even though I created the project as an "Excel 2003" app (because the customer has not upgraded to Excel 2007 yet), when I close VS and re-open, it automatically updates the project to Excel 2007. No questions, prompts, or options-- it just does it. I don't know what will happen if it's put on machine with only Excel 2003 though. And I don't particularly care.

06 April, 2010

Valrhona Abinao 85% dark chocolate

Now ordinarily I'd consider 85% cocoa well beyond my chocolatey limits, but turns out this Valrhona one is pretty smooth and is doing a fine job of keeping me awake this first day back at work after a long Easter weekend.

Thanks for the Easter gift, boss!

Using xpath in BizTalk orchestrations

Because I always forget the syntax... Below is how to get a count of the number of records from within an expression shape:

{variable name}= xpath({MsgName}, "count(//{MsgNode})");

You can use other xpath functions in place of "count".

You can also write values using this method, but you'd need to do this within a construct block shape.