Category Archives: Programming

Tech Ed 2007, Day 2 Wrap Up

Yesterday, I ventured into the world of Microsoft CRM 4.0 and IIS7 which were both very educational. Day two at Tech Ed was going to leave the products behind and jump into the deep end of software development.

Building BackgroundMotion using the Composite Web Block

The first presentation I attended was by Jeremy Boyd, a Microsoft Regional Director for New Zealand. The presentation was about building a community site named Background Motion which is all about sharing rich media that can be used as wallpaper within Vista utilising Dreamscene.

If the talk was simply about building a web site using ASP.NET, then it wouldn’t be all that interesting so Jeremy took everyone through how to utilise the Composite Web Block and developing against the Model View Presenter pattern, as opposed to ever popular Model View Controller approach. I really enjoyed seeing the Model View Presenter pattern in use first hand and I thought that the structure and flow felt really good; structure and order are always a good thing – anything to help code sprawling over time.

I have to give plenty of accolades to Jeremy, his presentation was without a doubt the smoothest that I have been involved with so far at Tech.Ed 2007. The flow of switching between the slides and into the Visual Studio was always seamless; no fluffing around configuring references or not having it compile unexpectedly. Jeremy used a simple system to make sure this worked as expected, he had numerous copies of his solution waiting in the appropriate state for each step of the presentation. No only were the technical aspects of the talk sorted out well in advance, his presentation style and pace throughout the talk were excellent.

Enterprise Library 3.x

The second talk I went into was about the Enterprise Library, formally known as Enterprise Application Blocks. Version three of the Enterprise Library comes with a bunch of bug fixes to some of their existing blocks such as the Data Access Application Block but the really interesting news was with the addition of the Validation Application Block and the Policy Injection Application Block.

Touching on each of those points briefly, the Validation Application Block is a generic validation package that provides an array of out of the box validation routines. Validation isn’t anything new, so the important point to note about the Validation Application block is that the same code will work identically using ASP.NET, Windows Forms and Windows Communication Foundation. You could use the validation block to provide ASP.NET level validation and provide a different or additional set of validation routines on the business object itself. The validation can be set up through configuration, attributes and through code. Through the use of the Validation Application Block, it is now convenient to only write validation routines and rules once where as it typically tends to be duplicated.

The real funk started happening when the Policy Injection Application Block came out to play. Using the Policy Injection Application Block, it is possible to separate out common tasks which happen across the enterprise or domain and reuse those through injection. As an example, common tasks like logging, authorisation and validation are common and typically should be reused throughout the code without copy/pasting the functionality. After configuring what policies to inject where and in what order, a new business object is instanced. Instead of getting back an instance of that business object, you get back a proxy that for all intended purposes looks and feels like the business object you asked for. When calling methods on this proxy business object, it invokes the Policy Injection engine and the request for the actual method must flow through pre and post execution paths on the policy injection engine before being accepted. Nifty stuff !

.NET Framework 3.0, Putting It All Together

This talk was about how to integrate all of the different .NET 3.x features into a single application. It appears that the community can see the strengths in any one of the components, however were struggling to see all of them integrated seamlessly together in a single application.

Enter Dinner Now, a fictional online business which lets you order take away food from more than one restaurant at a time and have it all delivered to your home. The Dinner Now sample application uses a wide spread of technology including IIS7, ASP.NET Ajax Extensions, Linq, Windows Communication Foundation, Windows Workflow Foundation, Windows Presentation Foundation, Windows Powershell, and the .NET Compact Framework.

The idea behind this presentation is quite exciting, however I felt that it could have had a little more meat in it. Maybe the talk was geared at a slightly lower entry point but I felt too much time was spent explaining what the different technologies accomplishes and not enough time going through the technical aspects of it. That said, I still found the presentation entertaining and it is fantastic that Microsoft have now recognised the requirement for a sample scenario that is more complex than Northwind.

Tech Ed 2007, Day 1 Wrap Up

Today was my first ever experience with Microsoft Tech Ed and it was a great one, what a fantastic conference! Across the course of the day, I attended a few different presentations:

Microsoft CRM 4.0 (Codename: Titan)

Across the course of the day, I attended three different presentations for CRM 4.0:

  • introduction
  • reporting and business intelligence
  • technical presentation aimed at developers to extend and enhance Microsoft CRM 4.0

The presenter noted that the difference between CRM 1.x and CRM 3.0 was a revolution, while the CRM 4.0 is more of an evolution. The majority of the functionality from Microsoft CRM 3.0 exists within the updated version, however with a lot of improvements along the way. Some of the items which caught my attention during the presentation:

  • Brand new user interface, it looks fantastic. I actually thought Microsoft had released a winform application when he first opened it up and then I realised that it was running with Internet Explorer and my jaw pretty much hit the floor.
  • Judicious use of AJAX throughout the product to reduce the number of popup windows and form postbacks required to get things done. Some of them are so subtle that you won’t even notice them (the best kind), such as an input box which turns into a drop down list when you enter a string and the AJAX’d response contains more than a single item.
  • The entire work flow pipeline from CRM 3.0 has been replaced with the newly released Windows Workflow Foundation that ships as part of .NET 3.0. It isn’t possible to write your own custom work flow and deploy it into Microsoft CRM 4.0 just yet, however it’s a feature that they are well aware of and plan to implement soon. In the mean time, the presenter thought that if you implemented all of the appropriate interfaces in the WF component and edited the XAML manually that it’d probably ‘just work’. Of course, until it ships with the functionality to load in your own custom work flow components, they are never going to suggest that as a recommended strategy.
  • To support the service based environment that most organisations operate within now, it is possible to implement asynchronous activities. Of course, you could then implement an activity when the data relating to the asynchronous event completes.
  • Since Microsoft CRM 4.0 is going to be deployed as a Microsoft Live product, significant work has taken place to increase the performance of the application. Considering the presenter was running it on his notebook, with two virtual PC’s running and all the associated server related services; it was very fast – so I can only imagine how fast it’d feel deployed on quality server hardware.

I’m very pleased that I attended the Titan presentation, even if I’m not going to use it immediately. It has really opened my eyes as to what the product is capable of and I can already see fantastic applications of it within our business.

Internet Information Services 7 (IIS7)

IIS, the Microsoft web server, has been undergoing heavy surgical procedures since version five. IIS5 was a horribly slow, hard to configure product that no one wanted to use and the market share that Apache held reflected that. With the release of IIS6, many of the problems of IIS5 were resolves or at least reduced – however what they had still felt as though it was largely IIS5 with some spit and polish. The release of IIS7 feels as though they have finally unshackled themselves from their forefathers and are starting fresh.

The big highlights in IIS7 which I love are:

  • A fully integrated request pipeline, which means that all requests (static, .NET, PHP, CGI, ..) all take the same path through the server.
  • IIS7 is built around a modular architecture, much like Apache. This is a good thing on a few levels but primarily for security, memory consumption and performance.
  • Developers are able to extend/enhance IIS7 through the use of modules and handlers, which can intercept the requests at virtually any point in the request/response cycle. The modules can be written in managed or unmanaged code using languages such as C, C++ or .NET.
  • Configuring IIS7 is a snap with its new web.config inspired configuration. Everything about the web server is configured within these XML files, even the loading and unloading of modules from each virtual host.
  • A new kernel level output cache is available, which can cache any response regardless of how it was generated. No longer are you limited to using the output cache which is part of ASP.NET, using the kernel level output cache you can just as easily cache PHP, CFML, CGI and so on.
  • Performance improvements across the board, especially for filters which were utilising the CGI interface within IIS. IIS7 now implements the Fast-CGI interface which has dramatically improve performance. During the presentation, the presenter compared a PHP photo gallery running under CGI, Fast-CGI and Fast-CGI with kernel output caching which results in 13, 57 and 920 requests per second on his laptop.

There were a lot of other very cool things which are available in IIS7, unfortunately you need to be running Windows Vista or Windows Server 2008 to get access to it; of which we’re not just yet.

Windows Communication Foundation

Daniel Crowley-Wilson gave a quick half hour presentation on using Windows Communication Foundation to deliver RESTful web services. For a long time, .NET developers have really only been able to deliver remote services through SOAP and WS-* which work however aren’t the nicest things to deal with. I was very excited to see what looked like a clean implementation of REST; in fact I would have loved if Daniel had of had an hour or so to provide a little more comprehensive presentation but it what he delivered packed a good punch for 20 minutes!

Windows Workflow Foundation

Throughout a few different presentations, Workflow Foundation was demonstrated. As mentioned toward the top, Microsoft CRM 4.0 utilises Workflow Foundation for all of its workflow components and individual presentations demonstrated it directly. Developing against a framework like Workflow Foundation to perform complex flow related tasks just makes sense as it removes so much of the complexity. After talking to a few people and seeing it in action a handful of times in the last month, I can see clear advantages in upgrading certain components of our enterprise stack to use Windows Workflow Foundation.

I can’t wait for Tech.Ed day two, I’m going to really enjoy attending another IIS7 presentation and I hope to find the time to get in a couple of the fast paced half hour Chalk Talks.

Ruby .NET Runtime Released

Microsoft have recently released another dynamic language runtime built on top of the .NET Common Language Runtime, this time for Ruby.

Ruby.NET is implemented using a new .NET library that Microsoft are calling the Dynamic Language Runtime. The DLR provides a set of features specifically targeted at dynamic languages like Ruby and Python, such as a shared dynamic type system and support to generate fast dynamic code.

At this stage the Ruby.NET runtime is in a pre-alpha state, so the majority of the Ruby language unit tests are passing however it wouldn’t be possible to deploy a Ruby on Rails application yet.

This space should be quite interesting to watch, now that Microsoft and Sun both have an alternative runtime available for Ruby. The fact that there are now choices for the runtime is definitely a good thing for the Ruby language since it has taken quite a bit of criticism over the execution speed of the language.

Fast forward a year and I think it’s likely that JRuby will probably win the race. I don’t necessarily think that it will be a superior implementation of the Ruby runtime; however since it runs through the Java Virtual Machine it is at a distinct advantage as the majority of Ruby On Rails applications are deployed in a Unix/Linux environment.

Google Gears, Shifting Into The Offline World

One of the biggest problems that have plagued a lot of new, cool web applications is that they are not available when you’re not connected to the internet. That might seem like a silly thing to say, however certain types of applications lend themselves to being used all the time in an online environment, so when you’re not connected it is a real pain.

Google have decided that its a good time to fix this problem by releasing a product known as Google Gears. The Google Gears product hopes to solve the ‘offline web application’ problem by providing a browser plugin for Windows, Linux and Macintosh which enables a web application to be tolerant of being offline.

The first public application to see the benefits of the new Google Gears is the web based feed reading application named Google Reader. After installing Google Gears, it’s now possible to disconnect from the internet and continue using Google Reader as if you were connected. After reconnecting to the internet, the changes that were made to the offline data are shipped back to the online version of your Google Reader data and everything continues as normal.

The recent release of Google Gears must come as a bit of a blow to companies like Joyent who released a product in March known as Slingshot. The Slingshot product provides similar capabilities to Google Gears, however it is limited to the Ruby on Rails development platform. I expect it won’t be long before someone provides a Ruby on Rails wrapper over Google Gears and it starts to gain momentum in the development world.

Right at this moment, the idea of providing an offline web application doesn’t appeal to me. I’m connected to the internet all day at work and its available when I get home as well. That attitude would likely change a lot if I were the type of person who travels a lot of has sporadic access to the internet; then it would really shine. I expect some pretty exciting development in this space in the very near future.

Internet Explorer IMG Element & Empty Width/Height Attribute Error

Recently found an error, bug or omission within the Internet Explorer rendering engine which I haven’t personally encountered before. The error involves the familiar <img> element and the use of the width and height attributes.

The following <img> element definitions will render as expected within Mozilla and Opera:

  • <img src="/path/to/image.jpg" />
  • <img src="/path/to/image.jpg" width="" />
  • <img src="/path/to/image.jpg" height="" />
  • <img src="/path/to/image.jpg" width="" height="" />

When a web browser encounters an img element without width or height attributes, the browser is required to render the image in its default aspect ratio. When either of the width or height attributes are provided, the browser is required to resize the image when rendered to meet the requested size.

Unfortunately, when Internet Explorer encounters items two, three and four listed above an error occurs where the browser does not render the image at all. Instead of disregarding the img elements empty width and height attributes, it considers the empty value to equate to zero (0) and the image is rendered appropriately.