Archive for January, 2009

jQuery 1.3.1 and jQuery UI – UPDATE

January 24th, 2009

I reported some problems – but here is my update:

1. first off, make sure if you are using jQuery UI that you get the correct version.  I ended up using the theme roller and that was slick – included everything I needed in a nice package.

Also you can get exactly what you need here: http://ui.jquery.com/download

2. My problem child was the tabs view.  However, it was really linked to the jQuery Validation library.  Luckily, this was quickly updated to support 1.3.  After getting the updated validation library it worked

So… I’m officially upgraded to 1.3.1 and things are flying quickly and without pain points!

jQuery…. rocks!

Single Responsibility Principle

January 21st, 2009

Gabriel Schenker’s Blog has a good post on the Single Responsibility Principle.  I enjoy these articles and his is pretty good I think.

I must agree with him, and I’m guilty as well, as not following the SRP to the level in which he shows.  The end result though if a very clean, maintainable code base. 

Check it out!

Silverlight – Patient Discovery Demonstrator

January 16th, 2009

It’s amazing to see what Silverlight can provide, and this demonstration provides a chance to see what incredible UI can be done with Silverlight.

I must say, when I see something like this, it’s really amazing. 

After working on a rich web javascript application, the pros and cons of javascript vs. the rich programming capability of C# in Silverlight is hard to ignore.  I tried Flex Builder, and loved the UI widgets they have, but I didn’t like the ‘ActionScript’ development environment.

I’ve noticed more and more everyday, free rich Silverlight controls, as well as some great Telerik controls, etc.. that quicken the development of Silverlight apps as well as provide a common control theme. 

I think the key to Silverlight’s acceptance will be the ability for MS to get Silverlight out to the users in the same capacity as what the Flash runtime has. 

There is some benefit in Silverlight vs. just a click once I think – and that is the security model.  Certainly not a big deal for an intranet application, where sticking to full WPF is the better option I would say outside of plugging in little ‘RIA islands’ into the intranet web app (ie. a rich Silverlight upload control, a rich form on a page vs. tons of javascript/ajax calls).  But in terms of an site for the public, knowing that the silverlight app your downloading has limited access to the machine itself does provide some peace of mind. 

But, I’m off track, check out this demo – it’s quite amazing.  To think they shoved enough ‘.net’ into a 4mb sandbox is quite amazing  :)

Now, if I could only have a dedicated UI designer expert on a project – that would be nice  :)

I definitely would like to provide the data access and business logic pieces to a designer who is building the rich interface to the user.  In my career- outside of a graphic artist providing me some nice images, I’ve never had the luxury of working with a true designer – ie. someone that really knew how to work a tool like Expression Blend with a great UI presentation layer.

jQuery 1.3 Released

January 14th, 2009

Some great new stuff added to jQuery – please welcome in jQuery 1.3 !

Details here

I’ll be digging in soon to update my sites with this latest version and report back any gotchas.

There is a note about validation library updated for 1.3, and I use that one – so will have to test all that out.

Rhino Service Bus – Starbucks Example Updated

January 14th, 2009

Ayende has done it again  :)   Now, he has a Service Bus in place – with an example in the repository, the ‘starbucks example’

From his post:

  • There is zero setup necessary, Rhino Service Bus will create the queues if they don’t already exists. Again, the idea of reducing moving parts.
  • All three actors are running in the same process – but each is running in a different AppDomain.
    Note that this is a common deployment choice for development, but not one that I would use for production.
    The idea is that this make it significantly easier to debug & develop a distributed application.
  • There is very little configuration whatsoever. And a lot of conventions about how to figure out what consumers to use and how to build it.
  • The use of sagas & conversations is demoed. The entire buying process is a single conversation composed of several sagas.
  • The customer actor is showing how we can create instance & temporary subscriptions.
  • I really appreciate the setup of Rhino Service Bus, fantastically done!  This is a good ‘simple’ service bus implementation.  Ayende discusses why he created this with NServiceBus/MassTransit around – mostly because he didn’t need all the features of these full blow engines, as well as easier setup, etc… which is where I think most my needs fall as well.

    Ayende has blogged about this service bus, here is the Rhino Service Bus rss feed for more information.

    Creating SharePoint Applications with Visual Studio 2008

    January 5th, 2009

    Chris Johnson shares his PDC presentation on ‘Creating SharePoint Applications with Visual Studio 2008’

    This uses “the Visual Studio 2008 extensions for SharePoint (VSeWSS)” and the Silverlight toolkit to do charting.

    Castle EventWiring Configuration: Programmatically

    January 1st, 2009

    One of the greatest things about the Castle Windsor Inversion of control container is the ability to create ‘facilities’ that take advantage of the container.  One such facility is the ‘EventWiring’ facility.

    An example of configuring this via xml:

    <component id="notification.service"
                      service="MyEventSample.INotificationService, MyEventSample"
                      type="MyEventSample.DefaultNotificationService, MyEventSample" >
                <subscribers>
                   <subscriber id="SuccessSubscriber"
                            event="Succeeded"
                            handler="OnSuccess"/>
                   <subscriber id="FailedSubscriber"
                            event="Failed"
                            handler="OnFailure"/>
                </subscribers>
             </component>

    This is good, but what if I want to do the above programmatically?   Castle Windsor provides a fluent interface to help register components and set up their properties, etc… 

    Here is an example:

    container.AddComponent<TheService>("TheService");
                container.Register(Component.For<INotificationService>()
                    .ImplementedBy<DefaultNotificationService>()
                        .Configuration(Child.ForName("subscribers")
                                             .Eq(
                                                    Child.ForName("subscriber").Eq(
                                                        Attrib.ForName("id").Eq("SuccessSubscriber"),
                                                        Attrib.ForName("event").Eq("Succeeded"),
                                                        Attrib.ForName("handler").Eq("OnSuccess")
                                                    ),
                                                    Child.ForName("subscriber").Eq(
                                                        Attrib.ForName("id").Eq("FailedSubscriber"),
                                                        Attrib.ForName("event").Eq("Failed"),
                                                        Attrib.ForName("handler").Eq("OnFailure")
                                                    )
                                             )
                                       )
                                  );

    (You can learn more about this from the component registration tests in the trunk)

    Ayende also pointed out in a recent blog post how to combine both xml configuration with programmatically registering components.

    var container = new WindsorContainer(new XmlInterpreter());
    container.Register(
    	AllTypes.Of(typeof (ConsumerOf<>))
    		.FromAssembly(typeof(Program).Assembly)
    	);

    I do especially like the ability to register all components of a certain type in an assembly.  I’ve done this with my asp.net mvc controllers –> services –> dao – each in a separate assembly and easy to register all of a certain type.

    MvcContrib provides the capability of registering your controllers.  Let me show a simple example of how I’ve done this.

    Again, I have 3 assemblies – one for my controllers, another for my services, and then another for my Dao’s (Repositories):

    So, in my global.cs – I register like this:

    protected virtual void InitializeWindsor()

            {

                Logger.GeneralLogger.Info("InitializeWindsor");

                
                 IWindsorContainer _container = new WindsorContainer();

                ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(_container));

                Logger.GeneralLogger.Info("RegisterControllers");

                //Register Controllers

                _container.RegisterControllers(Assembly.Load("Bistro.Controllers"));

                //Register Services

                _container.RegisterBistroServices(true);

                //Register Daos

                _container.RegisterBistroData();

            }

    Example of the services:

    public static void RegisterBistroServices(this IWindsorContainer _container, bool isTransactional)

            {

                _container.Register(

                            AllTypes.Pick().FromAssemblyNamed("Bistro.Services")

                            .Configure(c => c.LifeStyle.Transient)

                            //.Configure(c => c.AddAttributeDescriptor("isTransactional", "true"))

                            .If(s => s.Name.Contains("Service"))

                            .WithService.FirstInterface());

            }

    I am struggling with the Dao’s however, so I’m currently using:

    (But looking on how to refactor it)

    Assembly daos = Assembly.Load("Bistro.Data");

                Type[] daoTypes = daos.GetTypes();

                foreach (Type daoType in daoTypes)

                {

                    if (daoType.BaseType != null)

                    {

                        if (daoType.Name != "GenericDao`1" && daoType.BaseType.Name.Contains("GenericDao"))

                        {

                            try

                            {

                                Type serviceType = daoType.GetInterface(string.Concat("I", daoType.Name));

                                //_container.AddComponent(daoType.Name, serviceType, daoType);

                                _container.Register(Component.For(serviceType).ImplementedBy(daoType).LifeStyle.Transient);

                            }

                            catch (Exception ex)

                            {

                                throw new BistroException("Initialization Error " + ex.Message, ex);

                            }

                        }

                    }

                }

    The problem I have here is that it uses a base type as well as a service for each.

    ie.

    MyDao : GenericDaoWithTypedId<DomainObject, Guid>, IMyDao

    MySecondDao : GenericDaoWithTypedId<DomainObject, Guid>, IMySecondDao

    So, if you have a solution for this one, let me know – I’d love to clean up the Dao so it looks more like the service’s registration above  :)