Santosh Benjamin’s Weblog

September 30, 2008

Powershell : Calling BTSTask.exe

Filed under: Biztalk, Powershell — Tags: , — santoshbenjamin @ 7:20 pm

I set out to write a bunch of PS functions to manage Biztalk to keep in a little script library that i could then call from external scripts etc (I found and came up with some other good stuff that i’ll share shortly but this is something i had to write about immediately).

One of the tasks was to export bindings for an application. This is something that i found incredibly hard to do from within a function. It works alright when just called interactively, just like any normal command prompt, but invoking the process within a function had me lose a lot of hair (and theres very little spare anyway :-( ).

Anyhow, i’ll spare you the gory details. After mucking around with System.Process, trying to capture the output window , invoking cmd etc, the solution was drop dead simple.

A snippet of the function is as follows

function bts-application-exportbindings ([string]$bindingFile, [string]$appName)

{

$taskParams = ” ExportBindings /Destination:$bindingfile /ApplicationName:$appName “

$p = [diagnostics.process]::start(“BTSTask.exe”, $taskParams)

}

Thats all. But my goodness, it had me really frustrated for a while. C’est la vie!! Hope it helps some of you…

Powershell and Arrays as named parameters

Filed under: General, Powershell — Tags: — santoshbenjamin @ 7:07 pm

While theres a ton of stuff on the usage of Powershell as an interactive scripting system there is not as much from a general programming perspective of a developer , at least not much that i could find today.

For example, while there is a flood of posts showing how you can manipulate the “args” system variable and how you can pass in an array on the command line by simply putting in several arguments with spaces, i was looking for a way to pass parameters into a function where 1 of the several parameters happened to be an array and then i needed to parse that array. After much trial and error, i found a solution. Here it is for any powershell newbies to benefit.

My main script file has a function like this  (very trivialised example)

function showfriends([string] $mainPerson, [string[]] $friends)
{
 Write-Host “Main person is “,$mainPerso
 Write-Host ‘friends count is : ‘ ,$friends.Count
 foreach($friend in $friends)
 {
  Write-Host $mainPerson “has a friend named:” ,$friend
  }

}

Now to call it i use the following line

showfriends -mainPerson:Smith  -friends:@(‘Jon’, ‘Joshua’)

which will then print

Smith has a friend namd Jon

Smith has a friend named Joshua

The reason i got stuck intiially was that i was trying to use foreach-object and PS insisted on prompting me to enter the objects. Another thing that got me stuck was that on a site with tutorials , the illustration of some syntax had showed the usage of [array]  which did not work for me.

Classic Menus for Office 2007

Filed under: General — Tags: — santoshbenjamin @ 3:34 pm

I’m one of those folk who cannot stand the new Office Ribbon. I frequently collate material from various sources into single documents for easy reference and Just remembering how to set up the page orientation and do a print preview itself is very cumbersome. So i found a tool which resets all the menus to the Office 2003 or ‘Classic Style. The article which pointed me to the tool itself is here and the shareware tool can be downloaded here.

I’m all in favor of the revamped object model and the new ways to programmatically create and access documents but IMO the UI is a travesty. But some people like it.

Anyway, I got something to get rid of that UI and i feel so much better already.

September 29, 2008

Rosario is now VSTS 2010

Filed under: General — Tags: , — santoshbenjamin @ 8:36 pm

I first saw this article in SDTimes on VSTS 2010, and then found some official word on the subject in Brian Harry’s post titled Shining the Light on Rosario  which is a fairly detailed note (and an earlier note titled “Charting a course for Rosario” which provides even more infomation )

To quote a section from the article in SDTimes (emphasis mine)

“ The company has not committed to a release date for VSTS 2010. Dave Mendlen, director of developer tools at Microsoft, noted that it would be part of the next wave of the .NET Framework, .NET 4.0. Microsoft will also ship a standard edition of Visual Studio 2010 concurrently.

VSTS 2010, formerly known by the code name “Rosario,” expands the company’s ALM vision with more roles and fewer walls between them, effectively “democratizing” ALM, said Mendlen. Modeling plays a heavy role in how that is accomplished.”

While perhaps a bit disappointing if you were waiting for it to be out any time now (considering it was initially positioned as a rev up from the Team System component of VSTS08), it actually makes a lot of sense at least to me. There are some good resources on the net with explanations of the new features especially with regard to “baking in” of the factory approach and of course, theres an April 08 CTP of Rosario available if you want to play with it. Looking at the sheer breadth of features, i didnt think it would be possible to incorporate all that as a kind of feature pack to 2008 as it would make a substantial change in the VS IDE and I was also hoping that they would link it into the next version of the VS IDE (code named Hawaii) so we didnt have to upgrade twice in quick succession.

Check out that article. Now we just gotta wait for the PDC with bated breath for more to be revealed. :-)

September 20, 2008

Workflow Services & Application Protocols

Filed under: WCF, WF, Workflow Services — Tags: , , — santoshbenjamin @ 3:20 pm

Its taken some time (and a lot of procrastination) but I’ve finally decided to properly get into WF and WCF and as a Biztalk guy, one of the things that most interests me is Workflow Services. I’ve known the basics of all of this for a long time but never dived into it, so i started sort of working backwards and chose Workflow Services as my starting point (no use in trying to learn the old Data Exchange mechanisms of WF V1 now really). I picked up some nice videos from Channel 9 and some from the VS2008 Training Kit.

I soon got into the video titled Building WCF Services with WF and within 2 minutes ran into something that disturbed me so much I had to write this immediately. When talking about the advantage of writing WCF services with WF, Pravin says that one of the pros is that “Application Protocol is enforced” and goes on to give an example where if we had a service where there was an AddPurchaseOrder and also a CreateCustomer, we (as service implementors) might expect that the Customer would be created first before the Purchase Order. But the client would not know this by looking at the WSDL. So we set up a flow in the WF and expose these methods at some point and if the client calls them out of sequence we can throw exceptions etc.

I dont know about you, but IMO, this would not be good service design. Let me try to explain. First of all I wouldnt mix two widely different documents in the same service unless this was merely a ‘composite’ which internally invoked the CustomerService and the PurchaseOrderManagement service. Even if it was a composite, the contract specified by this composite should allow the client to give the customer info (or a pre-existing ID) along with the other PO info all together and then communicate with the Customer and POMgmt to create the customer or update an existing record and then pass stuff between them all through well defined messages.  Those backend services are still valid on their own and can accept messages being sent directly to them from other clients but the composite is providing some extra functionality. Now if the whole process was rather long running and there was state to be maintained in between calls to those backend services then we can make use of low level persistence services in the framework so we could dehydrate the composite while waiting for responses. But I would not make the composite service so ’stateful’ that it exposed two or more methods as entry points and insisted that they be called in a sequence. (its a completely different matter if you are implementing a convoy in Biztalk where you may have multiple receive shapes which are linked together by correlation. Here we are talking about different ‘method calls’). Theres no service provided here just a wrapped collection of methods.

Just creating a few classes (whether declaratively implemented or handcoded) and exposing them over the wire doesnt make them business services. It worries me that devs are going to be throwing together some simple classes , fitting WCF endpoints on top of them and saying “Look, we have SOA” (and worse still, with all the designers, the claim would be “we have model driven SOA”.)  This is like going back to the ‘bad’ old days where people thought they had webservices just because they could stick [WebMethod] attributes on function calls. Let me re-iterate my point, a collection of visually designed classes that can listen on the wire is not model driven SOA. Its just that – a collection of classes, nothing more, nothing less.

So, back to the ‘protocol’ business. Sometime ago there was a lot of talk of web service choreography and a choreography description language to specify a sequence of ordered message exchanges. If the ‘composite’ service (discussed above) was implementing something like this, it would make sense. It shouldnt expose two random entry points and force a sequence of invocation. And if the composite was not providing any other  value other than just stringing together two calls why not just make the contract of the ’second’ service explicit (for instance , require a CustomerNumber or something) that makes it apparent that Customers should exist first and then we could do away with the composite altogether.

But theres nothing wrong with the Workflow Services as such (at least nothing thats immediately apparent considering im just getting into them.. flaws may surface in a few days). It seems like WF and WCF were made for each other and this is a good way of linking the two. I just dont buy the ‘application protocol enforcement’ claim.

What do you think? What ways would you choose to implement sequencing? Does anyone else use the workflow services to enforce sequence?

September 18, 2008

BAM Training Kit

Filed under: Biztalk, Training Kits — Tags: , , — santoshbenjamin @ 6:25 pm

Just came across this new resource on MSDN, the BAM Training Kit. Looks quite interesting. According to the blurb,

There are several roles involved during a BAM solution development including business analyst, BizTalk developer, and system administrator. This training breaks down the BAM solution development into roles. Each lesson covers the background information, the tools and the development procedures.

This kit contains the following:

  • An overview of the BAM feature (“BAM Training.doc”)
  • A BAM solution sample (“BAM Training_Hands-On Exercises.doc”)
  • Sample code files to use with the sample solution (“BAM Training_Lab Files” folder)
  • A PowerPoint slide deck to use in an instructor-led setting (“BAM Training_Instructor Slide Deck.ppt”)

Download link is here.

Another good resource is Mike Stephenson’s BAM QuickStart where he has written up a concise intro to BAM and provided a list of resources including whitepapers and a webcast for the same. Check that out as well.

September 11, 2008

Is Oslo just like Access?

Filed under: Architecture — Tags: , , — santoshbenjamin @ 9:10 am

eWeek publlshed a couple of articles on Oslo very recently. They are

I found the background material on how it all started to be quite interesting and also to hear that its been in the works for more than a decade. At least, thats how the writer puts it. I think they mean that attempts at incorporating modeling into the implementation of enterprise applications have been in incubation for that long.  However the point that really disturbed me was on the description of the tool. To quote the article , (emphasis mine)

 

“Lovering said the Oslo tool is novel with respect to development tools in that it will feel familiar to the masses. “If you’re [a Microsoft] Access user, it will be more familiar to you, let me put it that way,” he said. Indeed, said Lovering, the tool is basically an interactive database development tool. “So, if you kind of think of Access, [Microsoft] Excel, …” that is an approximation of the tool.Lovering said.”

 

 

I have heard a lot about the platform,most of which I am not allowed to talk about obviously, but even with the amount of public information available i thought it was pretty obvious that

  • (a) it isnt a tool but a code name for a platform and
  • (b) its most certainly not a ‘database’ development tool. There is a database component but its a repository.

I think that it must be a misquote. The article does go on to quote Lovering saying

“However, “you have to be a little bit careful with that comparison because it could be misleading. I’m trying to give you sort of a general feeling of the center; it is not [Access and Excel], but those are the best approximations I have if you haven’t experienced the tool.”

Hmmmm…Was it some sort of UI for the repository thats being referred to it? I dont know …Maybe he’s trying to say that like Access lowered the bar for database development, this will lower the bar to creating enterprise applications which sounds better but calling it a database tool is odd. I certainly hope it isnt the revenge of Microsoft Access :-)

 

 

 

 

 

September 9, 2008

Pet Peeves 2

Filed under: General — santoshbenjamin @ 10:31 pm

Ok, so one more complaint on language usage and i’ll go back to proper tech stuff, I promise.

2 things that i see very often which are more than just typos are the following:

  • Using ‘extravert’ instead of extrovert: This comes up very often in posts and articles about personalities. The opposite of an ‘introverted’ personality is ‘extroverted’ not ‘extrAverted’.
  • Using ‘ance’ instead of ‘ence’: This appears in lots of code and posts about the same. For example, it should be written as Persistence  (e.g Persistence Ignorance) not ‘Persistance’. In the same way its Dependence not Dependance (eg) Dependency Inversion.

Now you may not care much about these things but when i see code with this kind of writing, it goes down a couple of notches in my esteem. So, maybe i’m being nitpicky, but hey, this is my opinion.

Update: This had me in splits. I found an incoming link to this post from the Animal Shelters Directory and I was rather flabbergasted (nice old English word eh?). I wondered about the connection between this post and that site and then figured out that they probably spidered everything to do with “Pet” so the title Pet Peeves triggered it :-) . With ‘pets’ and ‘tenants’ this must seem like a temporary shelter for animals that pay rent , or would it be a shelter for ‘principled’ (tenet :-) ) animals?

September 1, 2008

Its ‘Tenet’ not ‘Tenant’

Filed under: General — Tags: — santoshbenjamin @ 12:27 pm

Ok, so the next time i see a post anywhere with this silly terminology/grammar i’m going to scream so loud everyone in the UK and across the Atlantic will hear it. Im losing count of the number of times i’m seeing people use the word tenant when they should be using ‘tenet’

For example

  • The 4 SOA ‘Tenants’  : Stop. Please. Unless you are talking about services that have to pay someone rent, it is ‘SOA Tenets’.
  • The Workflow Tenants: Aargh!! Again, unles you mean a workflow which lives in someone else’s home and pays rent, stop. Its ‘Tenets’. [Although workflows are 'hosted' in other processes i've yet to see any host process demand payment upfront!! :-) ]

In case you want more evidence, check out MerriamWebster Online or any good dictionary

  • Tenet:  principle, belief, or doctrine generally held to be true; especially : one held in common by members of an organization, movement, or profession
  • Tenant : one who has the occupation or temporary possession of lands or tenements of another; specifically : one who rents or leases (as a house) from a landlord

I know languages evolve and all that but sometimes things can get downright ridiculous. This hasnt got anything to do with language changing. Its the wrong word. Full stop.

Aah! Now i feel better already. I know its a bit of a rant but i couldnt help myself :-) .

Blog at WordPress.com.