I am a OSS enthusiast and want to use tools like nHibernate in my daily application development practices. What I am not is a CIO or Architect at my company. There are several roadblocks, misconceptions and valid concerns that are raise when I suggest using an OSS tool in one of our projects. One of the biggest concerns I have heard is that of responsibility. The question usually is phrased like this:


"When we encounter a blocking bug what do we do?"


The overwhelming OSS response to this is: "Fix it yourself and submit a patch." And this is where I lose management. Management doesn't want to take on the responsibilities of fixing platform bugs. In their eyes it is much easier to purchase packages from vendors who take on those responsibilities. The role of tools like nHibernate, Ninject or even Prism in my environment is to allow me to focus on business value and functionality. We are not a platform company.


I want to find a solution to this problem, and I think it falls down to money. My company is willing to pay good money to a vendor for a tool that allows us to deliver business value quickly. I wonder if that same cash flow relationship could be applied to OSS.

Say, I have to make a choice between vendor Product X and nHibernate for ORM. Product X requires a license fee of $1000 per developer. I chose nHibernate and put my $1000 per developer in the bank as a emergency fund.

Six months later, I encounter a bug or blocking problem in nHibernate that is going to prevent me from releasing my product. I can't fix it myself. I do not have the time or the skill needed to do so. I create a test case for the problem and submit it with a portion of my emergency fund to the community for a solution.

My question is, do you think anyone would accept it? What if we wanted them to be contractually obligated to fix the bug upon acceptance? Is anyone out there currently doing this? Would any of the current developers want to do this? Is this a viable alternative to vendor software here?

So here is a list of the OSS tools I would like to use. Anyone out there willing to commit to saying, "Yes, if you can provide me with a test case, I can provide you with a fix for that OSS tool. I charge $X amount per hour or this flat fee."

  • nHibernate
  • Fluent nHibernate
  • Castle Winsor
  • Ninject
  • Rhino.Security
  • Prism
  • MVC Contrib
  • Caliburn

If your particular pet OSS project is not listed, I would still like to hear from you. This list came of the top of my head from what I am currently interested in.


 
Categories: Development | Tools

Saw this on Boing Boing today and can't agree more. I declare this my official stance on everything from today forward.

The Cult of Done Manifesto

  1. There are three states of being. Not knowing, action and completion.
  2. Accept that everything is a draft. It helps to get it done.
  3. There is no editing stage.
  4. Pretending you know what you're doing is almost the same as knowing what you are doing, so just accept that you know what you're doing even if you don't and do it.
  5. Banish procrastination. If you wait more than a week to get an idea done, abandon it.
  6. The point of being done is not to finish but to get other things done.
  7. Once you're done you can throw it away.
  8. Laugh at perfection. It's boring and keeps you from being done.
  9. People without dirty hands are wrong. Doing something makes you right.
  10. Failure counts as done. So do mistakes.
  11. Destruction is a variant of done.
  12. If you have an idea and publish it on the Internet, that counts as a ghost of done.
  13. Done is the engine of more.

Blatantly stolen from this source. Bre Pettis & Kio Stark are obviously geniuses.

I sometimes suffer from deer in the head lights syndrome. Before doing anything, I psych myself out thinking  "all the things that need to get done", all the things "I don't know" and "how will I make it perfect" thoughts. I read constantly about a topic but I never do...

The only way I can get myself out of that mode is to simply throw myself at the task/idea and start doing. Fail over and over, learning from each experience until one day I can look back and say, "Hey I actually do that pretty well now."

My hard drives at work, home and in my laptop are littered with useless half projects where I was attempting to get an idea or approach thought though. Travel down one path, fail, done. Travel down another path, fail, done.

Failing is how we learn. You never fail if you don't start. Stop reading this. Get excited and make things. Done, done done.


 
Categories: Commentary | Random

I have two silverlight assemblies, CaseManager.Applet and CaseManager.Applet.Sample. The Sample assembly has a reference to the base Applet assembly. The sample assembly has an embedded resource png image. The base applet assembly has a view xaml that I wish to display that image programmatically.

In the sample assembly I have a bit of code that creates a Uri like so:

private void RegisterIcon()
{

var icon = new AppletIcon()
{
ImageUri = new Uri("CaseManager.Applet.Sample;component/images/guiness_2.png", UriKind.Relative),
ModuleType = GetType(),
Text = "Sample Module"
};

container.RegisterInstance("SampleModule", icon);
}

 

When I execute this code all the properties of ImageUri throw InvalidOperationException. I am not sure why. I have a hunch that it has to do with the way the assemblies are referencing each other in one direction. Anyone have suggestions?

 

Update: ok I found it by using the googles searching for WPF instead of silverlight info. The following code does the job:

 

ImageUri = new Uri("/CaseManager.Applet.Sample;component/images/guiness_2.png", UriKind.Relative),

Things to note here:

  • The slash at the start of the Uri string.
  • The short name of the assembly containing the resource.
  • the ;component/ section.

From there it is basically the path inside your project to the image. Hope this helps someone else.

For what it was worth I was missing the very first slash. /facepalm
 

Categories: Development | Silverlight

My company is investigating a dramatic shift in our product offering. We are looking at offering a SAAS product delivered via Silverlight. Our current offering is a large scale  classic ASP.NET case management system that is installed on site with the client and heavily customized. Our SAAS application is intended to start as a scaled down version of this application.

One of our main goals was to produce a highly modularized application that has been described as "simple widgets of functionality" that are driven by tasks instead of long menu trees. Our source of inspiration is the iPhone and it's clean interface.

Using the amazing Balsamiq, I generated a couple mock ups of a possible UI. I needed something concrete to work toward while learning WPF & Silverlight and modifying my mind set from stateless web mentality.

Desktop 

Side Note: Balsamiq is AWESOME. If you have not tried it go now and do it this blog post will wait.

These high level vision statements lead me down the path of a component based UI. I have had a copy of the Composite Application Guidance for WPF sitting on my desk for a couple of months, so I thought I would give that a chance. I then created a separate version of my mock up that described the areas and their function with in the context of a "desktop" screen.

areas

I then downloaded Prism & Unity and with a copy of Silverlight 2 in Action, I began my journey into the bowels of XAML and figuring out exactly how layout works. After a day or so of discovery with the Canvas, Grid & StackPanel controls I came up with this. It's a fairly simple layout consisting of five rows and a hidden control for user notifications. Working with XAML was very difficult for me at first as I wanted to resist table based layouts like the plague due to my HTML bigotry. But once I gave in, I started making progress.

One goal I had was to explore Prism's Region types and how they interact with the UI. In my application shell I had defined regions for each of the major areas of the UI and I wanted to create a "Place Holder" view that I could populate each of the regions with that would give me some information at runtime.

Following the Prism sample code, I created a ApplicationModule class which would represents the Applications role in the UI modularity. This module is the first to load and set default values within the application before moving on to interrogate other assemblies for other modules. One thing the application module does is to set all regions to a default place holder view like so:

 

public class ApplicationModule : IModule
{
private readonly IUnityContainer container;
private readonly IRegionManager regionManager;
private readonly IRegionViewRegistry regionViewRegistry;

public ApplicationModule(IUnityContainer container,
IRegionManager regionManager,
IRegionViewRegistry regionViewRegistry)
{
this.container = container;
this.regionManager = regionManager;
this.regionViewRegistry = regionViewRegistry;
}

#region IModule Members

public void Initialize()
{
RegisterTypesAndServices();
RegisterViewsWithRegions();
}

private void RegisterViewsWithRegions()
{
//registering placeholders with current regions
this.regionManager.RegisterViewWithRegion(RegionNames.Branding,
() => this.container.Resolve().View);
this.regionManager.RegisterViewWithRegion(RegionNames.Menu,
() => this.container.Resolve().View);
this.regionManager.RegisterViewWithRegion(RegionNames.Breadcrumb,
() => this.container.Resolve().View);
this.regionManager.RegisterViewWithRegion(RegionNames.Content,
() => this.container.Resolve().View);
this.regionManager.RegisterViewWithRegion(RegionNames.SystemNotification,
() => this.container.Resolve().View);
this.regionManager.RegisterViewWithRegion(RegionNames.UserNotification,
() => this.container.Resolve().View);

}

private void RegisterTypesAndServices()
{
this.container.RegisterType();

}

#endregion
}

I then wanted my place holder view to display a bit of information about its current context. Specifically I wanted the view to tell me what region it belonged to and its current dimensions. The XAML for this is not even worth looking at, it's a user control with a text block. The problem I ran into was getting any kind of information about the current context of the user control. My first attempt lead me to the VisualTreeHelper class and this code:

 

var parent = VisualTreeHelper.GetParent(this) as FrameworkElement;
this.PlaceHolderText.Text = parent.Name ?? "Placeholder";

 

This basically left me with a blank screen. Interesting enough the parent of my user control was not the region that contained it but a stack panel with no name that is not even defined in the XAML. It appears that the region is not a UI element so much as a concept within prism. After a couple hours of working with this I was stumped and hit the twitterverse to see if Glenn Block might offer a suggestion.

Glenn was the PM at Microsoft for the Composite Application Guidance for WPF. Seriously his name features prominently on the Authors page. If anyone could point me in the right direction, it would be this guy. It was somewhat of an obvious noob question, but I was very focused on the application DOM. He suggested that I check out the RegionManager.

After fiddling around with the region manager I came up with this:

public partial class PlaceholderView : UserControl, IPlaceholderView
{
private IRegionManager regionManager;

public PlaceholderView(IRegionManager regionManager)
{
InitializeComponent();
this.regionManager = regionManager;
}


private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
foreach (IRegion region in regionManager.Regions)
{
foreach (UserControl view in region.Views)
{
if (view == this)
{
PlaceHolderText.Text =
string.Format("{0} PlaceHolder : {1}x{2}",
region.Name, view.RenderSize.Width, view.RenderSize.Height);
return;
}
}
}
}
}

 

This almost has me there. For some reason, I get the correct width of the region my user control is inhabiting but the height always reports as zero. I am sure it has to do with how I have structured my application shell and plan to track this one down today.

In the end, I really like Silverlight. Prism allowed me to put something together fast based on a mock up and has DI baked in in a nice way.


 
Categories: Development | Tools