.NET Utility Libraries Galore

**NOTE** THIS PAGE IS NOW BEING MAINTAINED AND UPDATED AT http://thefreakparade.com/2008/07/net-utility-libraries-galore/ kind of thing I’m talking about]


Linxter Offers Durable Messaging for Remote Clients

A discussion on the nServiceBus discussion list has been taking place recently regarding how to have durable messaging on remote nodes, such as smart clients, where the deployment and maintenance requirements of MSMQ aren’t tenable. The main concept being tossed around was a local database to hold un-sent messages at the remote endpoint that could be attached to any transport, making any non-durable transport durable. Ayende went off to build a prototype (but hasn’t reported back, so I’m not sure if it is still in progress, although there were strange noises coming out of his blog recently that suggest he might still be working on it) and it was mentioned that Evan Hoff was building such a thing using Berkeley DB.

One advantage of both of those options is that durability could be bolted on to any transport, such as HTTP or one of the non-durable WCF bindings, without much fuss. However there is at least one commercial service that I’ve talked about before, Linxter, that provides an internet-oriented message transport (or Internet Service Bus, ISB) with lots of cool features. What I didn’t realize, until today, was that the Linxter client API does exactly what was discussed at the NSB forum – provides a local cache for messages via an embedded DB (SQLite in this case), essentially enabling an x-copy deployable, durable, asynchronous messaging endpoint.

Of course, it doesn’t have the flexibility to attach “durability” to any conceivable transport – because Linxter is it’s own transport – but in most cases I don’t think that should be a big issue. The only question now, is, how much will it cost? Apparently pricing will be announced with Beta 3, which is scheduled for July 31st. Version 1.0 is scheduled for August 15th.

Here is the e-mail I received from Lixter’s Jason Milgram explaining the local queue:

Yes, the Linxter API queues messages locally (does this in Beta2), and does not take them off the queue until they are delivered. In Beta 3, we will offer additional reliability and efficiency for file transfers by enabling chunking. For example, let’s say you are transferring a 100MB file, and after transmitting 70MBs you lose your connection,…when the connection is re-established, it picks up from where it left off. We felt that these queuing and chunking features were pretty important especially with wireless connectivity becoming the norm.
The ISB is a distributed system, with failover built into the SDK (API)  as well as on the ISB. If the API cannot connect to a service on a particular set of clustered servers, it will failover to another set of servers. We can also dynamically reprovision server and service assignments for programs.

And here is the updated roadmap [emphasis mine]:

Release dates:

  • July 31st        Beta 3
  • Aug. 15th        Version 1.0

Beta 3 Overview:

  • Linxter SDK for both .NET and Java
  • Reorganization of methods for on demand and scheduled sending
  • Enhancements to Web Manager user interface
  • Web Manager support for both IE and Firefox
  • Standardization of API local datastore to SQLite
  • Availability of Quick Starts – feature based sample apps

On our website we have added the following:

Evaluating Expressions at Runtime in .NET (C#)

More Extension Methods…

Here’s another selection of nice extension methods.

Create Bullet Graphs with Google Charts in 7 Easy Steps

I haven’t paid much attention to Google Charts so far, but I have enjoyed Stephen Few’s “Bullet Graphs.” A bullet graph is an extremely condensed sort of bar chart that shows the current value of a KPI, and various ranges such as unacceptable, acceptable and target, and an optional indicator line that can mean several things. Anyway, here is an example of a bullet chart (from wikipedia):


Bullet graph labeled.png


This blog post referenced below was referenced in Stephen Few’s blog this morning and describes the several easy steps required to create a bullet graph using the Google API. Being able to easily throw these things up, ad hoc, in any web page is pretty phenomenal, if you ask me. The image below is actually a Google Graph:


Here is the link to the guide:

DEALER DIAGNOSTICS » Blog Archive » Create Bullet Graphs with Google Charts in 7 Easy Steps

SimpleStateMachine CodePlex Project

I have posted a CodePlex project here that implements a simple, customizable State Machine & miniature runtime. The point of this project was to replace Windows Workflow Foundation in one of our applications as the state machine engine. Windows Workflow foundation is a powerful, robust technology but turns out to be unsupportable overkill if all you are really after is defining and coordinating state transitions in your application. Plus, it can be rather difficult to unit test, even more difficult to version and extend once an application is deployed, and requires all sorts of baggage in the form of database infrastructure and GAC requirements, etc.

Anyway, this library does nothing else besides let you define a set of events, states, and transitions between states when triggered by events, and optionally allows for user defined actions to fire during the initialization or finalization of any or all states.

As for representing the actual state machines there are a few options: A visual designer such as WF provides. The WF designer itself is awful for representing state machines, even simple ones, as it was designed to suit sequential workflows as well and the two kinds of diagrams have different needs. It might be possible to create a visual designer that did the job well, but it would be a big task. Another option is to configure state machines in code using an object model or fluent interface. This would have worked, but it ends up looking pretty ugly after a while and you can’t change your state machines without deploying updated assemblies.

The approach I settled on was to use a DSL, using Boo and Rhino DSL, as described by Ayende Rahien in his (unfinished) book on the subject. The State Machine language itself was inspired by Martin Fowler, who appears also to be writing a book about DSL’s.

An example state machine definition looks like the sample below. It isn’t as snazzy and colorful as the visual designer version you get with WF, but in practice it is much more practical.

workflow "Telephone Call"

trigger @CallDialed
trigger @HungUp
trigger @CallConnected
trigger @LeftMessage
trigger @PlacedOnHold
trigger @TakenOffHold
trigger @PhoneHurledAgainstWall

state @OffHook:
	when @CallDialed             >> @Ringing	
state @Ringing:
	when @HungUp                 >> @OffHook
	when @CallConnected          >> @Connected

state @Connected:
	when @LeftMessage            >> @OffHook
	when @HungUp                 >> @OffHook
	when @PlacedOnHold           >> @OnHold
state @OnHold:
	when @TakenOffHold           >> @Connected
	when @HungUp                 >> @OffHook
	when @PhoneHurledAgainstWall >> @PhoneDestroyed
state @PhoneDestroyed

ASP.NET without ASP.NET – SharpTemplate.NET pre-release on CodePlex

This looks like a fantastic, flexible, simple to use template engine for .NET. I can’t imagine not finding a use for this in the near future. I haven’t dug any deeper, but LazyParser.NET may have significant promise as well.


ASP.NET without ASP.NET – SharpTemplate.NET pre-release on CodePlex