Nima Dilmaghani’s Technology Blog

Oomph: A Microformat Toolkit from Microsoft

Posted in javascript, Microsoft, programming, software, web development by nimad on October 22, 2008

Microsoft has just released Oomph: A Microformat Toolkit.  According to Karsten Januszewski, “Our main goal with Oomph is to make Microformats more accessible for users, developers and designers. Oomph is an amalgamation of applications: an Internet Explorer Add-in built in C++; a cross-browser HTML overlay built using JQuery that aggregates Microformats (hCard and hCalendar); a set of CSS styles for Microformats; and a Windows Live Writer plug-in written for inserting hCards”

There is a video demo on YouTube:

The code is on CodePlex at

Silicon Valley Code Camp is this weekend

While I am sitting far and away from Silicon Valley, I will be watching as the second Silicon Valley Code Camp happens this weekend. I want to tell all the developers, coders, architects, hackers, or whatever techie names they want to call themselves who live in or near the Valley how lucky they are to have such a great event there. Some of my favorite techies will be speaking at this event. People like Douglas Crockford, Juval Lowey, and Matt Mullenweg will be taking time to share their knowledge and experiences with the rest of us and thanks to the hard work of folks like Peter Kellner who have spent countless hours organizing this event, it will all be for free. Believe me, people from other parts of the country or the world do not have this same luxury to drive a few minutes from their home and listen, learn, and share with such a powerful group of software engineers and pioneers involved in such a divers array of technologies. Fortunately, the word has gotten around and over 700 people have registered. Unfortunately, many of those who register will not show up. Mainly because registration is free and the barrier to entry is nothing. So at the last minute, they decide to do something else or feel lazy or … I don’t really know why. All I know is that this is a great opportunity. People pay hundreds of dollars at conferences to see the same speakers give the same talks and folks in the Valley have a wonderful chance to take advantage of it for free this weekend. So don’t let this opportunity go by. If you have not registered, register now. If you have registered, set your alarm clock for Saturday morning and go down there. You are blessed with the opportunity to live in the valley and take advantage of this. Take full advantage of it.

I wish I was there.

The tools folks said they used at Conference

At the conference Someone put a sheet on the wall and folks filled it out with:

here is a flickr link to the photo of the first page and here is what was on the sheet:

Update:  AltNetPedia has this list in much better order now.

What tools do you use?
Visual Studio!
Big Witeboard Wall!
Rhino Mocks
MS Test
Team Build
Mac Book
Structure Map
Textmate for C# (Really!)
Active Record Migrations
NAntMy Generation
Visual SVN
Socket Wrench

Index Cards
Baseball Bat
Media Wiki
Synergy (network KVM)
Tortoise SVN
SQL Server
Acrobat Connect
SQL Diff
CI Factory
SQL Compare
XML Doc Viewer
Lots of e
Cross Loop

Microsoft announces its new MVC architecture for Web Apps

Today at the conference, Scott Guthrie demoed the new MVC architecture that Microsoft will be releasing in Spring 2008 for web apps. The first CTP should be available in two weeks. This architecture is very similar in many ways to the Rails architecture but takes full advantage of Microsoft .NET 3.5’s features and the strong typing in .NET. The crowed of alpha geeks that where incredibly critical of Microsoft the night before all gathered in one room and intently listened. Many questions were asked: Does this framework work with such and such? Can I do so and so. Scott’s answer was yes to all of these questions. The crowed was enchanted by Guthrie. No one had anything negative to say. There were a few syntactic and minor suggestions. And some mental wresting from some of the geeks, but Scott’s technical answers addressed the issues raised. Everyone was incredibly impressed. Scott’s presentation and rapid fire answers to questions demonstrated his detailed understanding of all the testing frameworks as well as alternative development frameworks out there and his team’s synthesis of all this knowledge in what appears to be a superior product to what currently exists in the market.
This will be a MVC pattern similar to Rails with a similar URL mapping convention and an architecture that allows you to plug in your favorite testing tools. Both Scott Hanselman and Philip Wheat taped the talk and will post it shortly. I strongly recommend watching it. This architecture is far superior in separation of concerns, testability, maintainability, and scalability to the existing ASP.NET architecture that was basically mimicking a state-full WinForms environment in a stateless web world to bring existing WinForms developers up to speed with web application development quickly. It will enter a heated battle with Ruby on Rails for the top spot as the best way to develop modern web apps. The Microsoft .NET Framework will have certain advantages such as WCF, Linq, and strong typing while the dynamic nature of Ruby and it’s faster innovation rates due to its open source nature will have other advantages. It will be interesting to see how this fight will pan out.

Note that because of a fundamental change in the design, there will be a new (smaller) set of ASP.NET controls that will work in this model. This architecture relies more on the native html controls (which is a good thing. See my CSS blog post to see what hoops you need to jump through to make ASP.NET controls work well with CSS). AJAX Control Toolkit controls that talk to the server also will get counter parts that will work in this model. There will be no change to the Microsoft Ajax Library or the networking stack of the Microsoft Ajax offering. This stack will also improve the existing ASP.NET architecture by replacing the UpdatePanel that was designed to wrap existing ASP.NET controls which were not originally designed for Ajax with a control that can be passed into the app as a JSON object and placed in a placeholder.

To read other perspectives please read the following blogs:

Bob Grommes, Chris Holmes, Howard Dierking, Jeffery Palermo, Jason Meridth, Joshua Flanagan Mike Moore, Roy Osherove,

Update: Sergio Pereira has written nice blog post that goes in more detail with sample code.

topics at

jay flowers: loop diagrams from system thinking

jeffery palermo: advanced nhybernate techniques

paul juliean : different styles of pair programming

mvc stuff and plugging the dlr into that ruby view,

can we call it msft does rails

ndunit and xunit

ddd domain driven design

scott belware behavior driven design

rod how to sell agile to management

making tests pretty

eric anderson how to introduce bdd to developers who are not actively seeking better ways to do that. how to lower barrrier to writing specs

passion, what to do to build that passion

what is going on with architecture, what you have learned about

unit testing

futurespective on msft. give msft ideas on where to go.



what we lack in .net community that they have in ruby and java community

scott gu new mvc pattern from msft. use nunit to test it.

simon guest guidance or lack of from msdn. how to fix or replace it

westin benford monorailmoving from to monorail. why would someone spend 6 months on monorail and then move to ror

dynamic languages on the cl

aspect oriented programming

why move from tdd to bdd.

how to move organizational skill up

kevin d? how to move legacy code under test

jacob boris. how to avoid xml hell

howard turking. runs msdn magazine (laughter which was not cool) how to systematically moving it up to the masses vs c++ hates the vb community.

moving a .net team to ror. tips tricks

it is harder to build software this way how to make it easier.

intersection of the domain moder pattern and rich internet app built on silverlight

dave ohara. how do we take these ideas and sell them to folks in a way that they see the value.

tom integration tests involving databases. i am fan of nhybernate and active record. (use sql light with database in xaml -joke)

lightning talk for 5 min. to do quick demos, …

roy: a famous speaker said that td will deteriorate your design, can it really do that. when to use it or not. how it compares with bdd.

mike from uk you are all a freindly bunch… i am a java manager now. all alpha geeks have left as martin has already left. apple is taking over the desktop. is vista is the last nail in the coffin. why should i care about msft anymore.

vista ME will be out in just 2 years.

where does a model go, what is the lifespan. when to use mockin, when not.

agile project management.

scott: writing and understanding user stories.

jean paul — becoming a catalyst for change in your organization. how to introduce things like agile into the organization

james kovacs — why are we facinated with executable xml. it is terribly verbose. painful.. can we do better. most msft devs diddnet go to college.

ruby for dummies, i mean .net developers.

testing guis.

fostering passion within a company to grow.

are executable requirements possible. are … better. can we do better.

domain specific languages for business and geeks.

language oriented progamming is challenging. design asthetics and environment is challengeing with mocking and dependency injection.

what is the persona for .net. mort, einstien, elvis, belware

sorry for misspelling everyone’s names.

Enums in JavaScript

Posted in AJAX, ASP.NET, ATLAS, javascript by nimad on October 2, 2007

Enums, (enumerated types) are very simple but incredibly useful programming constructs. However, while the EcmaScript specification has the enum keywork reserved, they have not implemented it in the language. While Microsoft’s JScript has an implementation of Enum, I recommend not using it since your code will not work in browsers other than IE. However by using associative arrays you can get a good deal of the enum functionality easily:

var myEnum =
First : 0,
Second : 1,
Third : 2

both return a 2

If you really want enums, the Microsoft AJAX Library implements them. You first declare the enumeration and then register it with the class the enum belongs to. Here is an example from the Microsoft Ajax Control Toolkit:

// Create an alias for the namespace to save 25 chars each time it’s used since
// this is a very long script and will take awhile to download
var $AA = AjaxControlToolkit.Animation;

$AA.FadeEffect = function() {
/// <summary>
/// The FadeEffect enumeration determines whether a fade animation is used to fade in or fade out.
/// </summary>
/// <field name=”FadeIn” type=”Number” integer=”true” />
/// <field name=”FadeOut” type=”Number” integer=”true” />
throw Error.invalidOperation();
$AA.FadeEffect.prototype = {
FadeIn : 0,
FadeOut : 1
$AA.FadeEffect.registerEnum(“AjaxControlToolkit.Animation.FadeEffect”, false);

You can use this enumeration in this way:


Why object oriented JavaScript is not always a good idea

Posted in cookie, javascript, web development by nimad on September 7, 2007

JavaScript is not inherently an object oriented language. When we build object oriented constructs, we add additional complexity. Sometimes this is necessary, other times it gets in the way. Here is one example. Suppose you want to write a few functions that allow you to set and retrieve values of cookies. In his book, JavaScript: The Definitive Guide David Flanagan encapsulates this functionality in an object. He instantiates a cookie object and then access’s the actual cookies via the properties of this object. The problem with this approach is that an object’s life cycle is tied to a page while a cookie can live a much longer life. Here, the overhead and the extra complexity of wrapping a cookie in an object actually makes things less useful and forces the user to instantiate the object on every page that needs to access the cookie and rehydrate it with the values of the actual cookie.

A simple yet effective approach is Scott Andrew‘s. He simply defines three method’s that do the job. These methods can be called from anywhere. Here is his code copied and pasted from

function createCookie(name, value, days)


  if (days) {

    var date = new Date();


    var expires = "; expires="+date.toGMTString();


  else var expires = "";

  document.cookie = name+"="+value+expires+"; path=/";

function readCookie(name)


  var ca = document.cookie.split(';');

  var nameEQ = name + "=";

  for(var i=0; i < ca.length; i++) {

    var c = ca[i];

    while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces

    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);


  return null;

function eraseCookie(name)


  createCookie(name, "", -1);