# Thursday, 11 September 2008

I was working at a large utility company in downtown Cincinnati on the morning of September 11 2001.  I had only been at my desk an hour when I heard the rumors: someone had flown a plane into the World Trade Center.  I checked CNN.com but was unable to access its site.  Every news site I tried reported that their server was too busy to respond. 

Instant messages began to trickle in.  Co-workers relayed phone calls from their families.  The office was filled with rumors: a second plane had hit the other tower; one tower had collapsed; another tower had collapsed; the Pentagon was hit; the White House was hit.  It became difficult to separate truth from fiction.  It became nearly impossible to focus on work.  Eventually someone wheeled a TV up to our floor and we were able to watch live reports and hear the news with at least some credibility.

If an enemy attacks the US, Cincinnati could be considered a likely target - many federal government offices, including the IRS and Court of Appeals are there; Procter & Gamble, one of the world's largest companies is headquartered there; and a nuclear power plant sits a few miles west of the city.
 
The department manager walked through our floor around 10AM to announce that management had considered the issue and decided all employees should remain at work.  A half hour later, he returned and informed us that they had changed their mind - the building was closing and all employees were to go home. 

I was one of the last to leave the building because I told a friend that I would drive him home if he couldn't find a ride from someone who lived near him (By that time, the buses were not running)  He found a ride from someone else, but by the time he told me, the building was nearly empty.

When I walked outside, it was nearly midday but the city was eerily quiet.  There were no cars, no buses and no people.  No boats sailed on the Ohio River that morning.  From horizon to horizon, no airplanes appeared in the sky.  Even the birds were gone.

In those days, I used to park about a mile from my office and I didn’t see a soul on my walk.  It could have been 3AM Sunday except for the sun burning overhead.  I was reminded of movies in which the protagonist awakes and goes outside to discover he is the only living man left in the world. 

I drove straight to the school where my two sons (1st and 5th grade) were enrolled.  I walked to one boy's classroom and stood at the window and watched him silently.  I'm not sure how long I stood there but the bell eventually rang and I stopped him as he exited for his next class and chatted for a few minutes, telling him nothing about the attack.  I told him I loved him.  Then I walked to my other son's classroom and did the exact same thing.  I spoke to my wife, who worked at the school.  We had little to say to each other.  School was not dismissed early that day and I left before the boys did.

On the way home, I stopped at a coffee house and sat, numb thinking of the day's events.  I knew thousands had died in New York, but I didn't know what it meant to the rest of us.  I didn't know what would happen in the coming weeks and months.  Were we at war?  Would we be attacked again soon - closer to home this time? 

I once read that everyone in America remembered where they were when they heard about John F Kennedy's assassination.  I was a year old in 1963 and wasn't aware of it until years later.  But I believe the same can be said of September 11.  It is our generation's Kennedy.  I haven't met anyone above the age of 20 who doesn't remember exactly where they were and what they were doing when they heard of the World Trade Center Attack. 

It turned out that the outward changes in our lives were minimal - no further attacks of this magnitude were carried out and no terrorists came near Cincinnati.  But I think we were all changed that day. 

But our attitudes changed that day.  As a country, we became more vigilant and more suspicious.  Security tightened noticeably in public places and most people did not complain about the inconvenience.  People now have a greater appreciation of the risks taken by firefighters, policemen and soldiers as they carry out their duties.  Most of us take our safety less for granted than we did before.

Our lives were instantly separated into the time before September 11 and the time after.  Seven years ago, we didn't how - but we knew that things had changed.

Thursday, 11 September 2008 15:00:14 (GMT Daylight Time, UTC+01:00)
# Wednesday, 10 September 2008

I will be delivering two presentations next Tuesday September 16 at the next Northwest Ohio .Net User Group beginning at 6PM.  The topics are:

Extending your Application with the Managed Extensibility Framework

Microsoft Managed Extensibility (MEF) framework allows developers to add “hooks” into their application to make it extensible at runtime.  These hooks allow you or a third party to extend your application dynamically in the future.  In this session, we will review the MEF tool set and build an extensible application and then extend that application using MEF.

Using Microsoft Distributed Cache to speed your application

Retrieving data from a disc or a database can be a time-consuming operation.  Data that is accessed frequently can be stored in an in-memory cache, which can speed up its retrieval considerably.  Microsoft Distributed Cache (aka “Velocity”) provides a framework for storing and managing cached data.  In this session, we will discuss how to use this framework in your application and demonstrate some code that implements this framework.

HCR Manorcare building at 333 North Summit St. in Toledo.  Click here to view a map.

I'm looking forward to my first visit to this user group in at least five years.

You can read more at http://www.nwnug.com/PermaLink,guid,1877615d-a53b-4b05-b6f6-5d650208af6f.aspx

Wednesday, 10 September 2008 15:47:20 (GMT Daylight Time, UTC+01:00)
# Monday, 08 September 2008

Day 1

Cramped into an overcrowded airplane, my two sons – Nick and Timmy - and I flew across the continent bound for San Francisco. 

I made minimal arrangements for this trip - I had a westbound flight Wednesday and a return ticket Sunday morning; my cousin Sharon and her husband Greg had generously agreed to allow us to stay at their Marin County home for a few days; and I had tickets to the Michigan State – Cal football game Saturday night.  Other than these, I had made no plans for the week. 

A rented car, a drive across the Golden Gate Bridge, and a climb up the hills of San Rafael brought us to Sharon and Greg’s house in time for a dinner of grilled salmon and roasted garlic.  I’ve promised myself that I will roast garlic at my home in the near future.  He used a grill but I don’t think I can control the temperature of my charcoal grill well enough for this task, so I plan to try this recipe.

Sharon and Greg have two small children – Billy is the older and he does not seem to sleep and he is full of energy and chatter.  It was his job to make sure we were awake each morning 60 minutes before we wanted to be.  Elena is younger.  She is shy and quiet and pretty and has eyes like a china doll.  It was her job to cuddle her mother at every opportunity.  Both children are very cute and provided entertainment when we were in their home.
After dinner, when any sane person would be overcome with jet lag and ready for bed, my teenagers insisted they were bored, so we drove to downtown San Rafael to eat ice cream, watch the hippies and shoot pool.

Day 2

The week quickly began to take shape.   Nick wanted to play golf so Greg called his golfing buddy who recommended the Lincoln Park course next to the Presidio Park, overlooking the Pacific Ocean.  Great call.  I’m a pretty poor golfer but I enjoyed the spectacular views of the ocean from the cliffs on which the course sits. 

We ate lunch at the Cliff House which boasts excellent Pacific views and fair entrees.

I relaxed at Sharon and Greg’s house while the boys – still full of energy – found the nearest YMCA and headed there to play basketball. 

Day 3

Before retiring Thursday night, I ordered tickets for a San Francisco Bay boat cruise that included stops at Angel Island (a former immigration station and military outpost) and Alcatraz (most famous as a maximum security prison in the 20th century) 

The contrast between the two islands is stark.  Angel is a lush place with a great diversity of wildlife and flora.  Alcatraz is a near-barren rock with no large indigenous animals and a few bushes and trees clinging to its craggy surface.  Both islands served as prisons at some point in their past.  Japanese immigrants were detained on Angel Island during World War II and enjoyed far fewer privileges than the convicted felons incarcerated at the infamous Alcatraz Penitentiary.

Following the cruise, we searched downtown San Francisco for Lombard Street, famous for its hairpin turns and steep slopes.  After a half hour searching among the various one-way streets and dead ends, we found it and wound our way down it.

When you fly across country to visit family, it’s a pretty sweet deal if you can then get family to drive to where you are staying.  This happened Friday evening when we had dinner with an aunt, an uncle, two cousins and five second cousins.   It was a great time visiting those whom I don’t see nearly enough.

Day 4

Timmy and the two younglings wanted to go to the beach so to the beach we went early in the morning.  It was overcast and a bit chilly and water was closed to swimmers due to a recent shark sighting.  Still it was a nice drive and it was fun to watch the little ones chasing birds for an hour.

In the afternoon, we headed to Berkeley.  My cousin John, his wife Becky and their daughter Jennifer live on the east side of San Francisco Bay and they agreed to drive to Berkeley to meet us for lunch.  I haven’t seen John and his family for five years so this was a real treat.  Had we arrived a week earlier, we might have caught the rest of John’s kids before they headed off to college, but it was fun to catch up.

The football game began at 5PM local time.  I had a good feeling as I was able to secure a parking spot on the street within 3 blocks of the stadium for under $2. (The lots nearby were charging $40-50 for parking.)  My Spartans fought a valiant game that night.  They responded time and again and pulled to within 7 points, despite having two touchdowns erased from the scoreboard.  But eventually the defense ran out of gas and could not stop Cal’s offense on three straight 3rd and long plays.   In the end, Cal defeated MSU 38-31.

Following the game, we met up with my old roommate Pat and his wife Susan.  Susan attended Berkeley years ago and they both had friends in the area.  I drove them to a restaurant near their hotel and was surprised to learn they had walked from the hotel to the game, as we drove at least six miles to get there.

This football game was the beginning of their vacation.  They planned to travel up the Pacific coast in the coming days.  Rather than exchanging gifts on birthdays and holidays, Pat and Susan now exchange vacation plans.

Day 5

It was nearly midnight when we returned to Sharon and Greg’s dark house.  The rub is that our flight for home departed SFO at 6:30AM, which meant I woke up shortly after 3.   A strong cup of coffee and some groggy hugs and goodbyes and we were on our way to the airport.

After a layover in Minneapolis, we finally headed home, tired and sated.

It was a whirlwind trip filled with unplanned activities and little sleep; It was a chance to catch up with family that I only get to see every couple years; It was another little stack of memories for my kids to have about their childhood; It was well worth the time and money spent.

Thanks Sharon.  Thanks Greg.  Thanks Nick and Timmy.  Now back to the world.

      Note: Click here to view photos of my California trip.

Monday, 08 September 2008 16:26:13 (GMT Daylight Time, UTC+01:00)
# Sunday, 07 September 2008

I stopped by the Agile Summer Camp near Brighton, MI yesterday.

The purpose of the event was to gather together people from the software community in an isolated environment to discuss the issues of agile development.  The event was held at a campground in order to isolate people from the distractions of e-mail, web and home responsibilities.  Discussions were held in an "open spaces" style, meaning participants sat in a circle, were given a starting topic, and were free to take the discussion to any point it logically evolved.

I can't evaluate the success of the open spaces as I was only there for a couple hours and my visit coincided with the dinner break, but those I talked to all gave me positive feedback about the day they had spent at the camp so far.  There was no open space discussion scheduled during dinner, but there were still many conversations about agile methodologies, software development, and all the things these folks have in common. 

Most camp participants stayed from Friday evening until Sunday morning and slept in log cabins without electricity or plumbing.  Family obligations prevented me from spending the weekend, but I wanted to stop by because I heard there would be a lot of bright, passionate people in attendance. There were.  Despite surviving the first 24 hours of primitive conditions, the group still radiated a lot of energy.

I applaud this event, not only because those who participated seem to have got a great deal out of it; but because it is one more example of people in the community creating something that will enhance others in the community.  This spirit of cooperation, support and fellowship is one of the reasons I enjoy doing what I do.

Note: Click here to view photos of the 2008 Agile Summer Camp.

Sunday, 07 September 2008 14:19:12 (GMT Daylight Time, UTC+01:00)
# Wednesday, 03 September 2008

Ten years ago, I showed up for my first meeting with my first customer while working at my first consulting job.  The customer was a dressmaker in suburban Philadelphia and I flew out to meet the IT Manager.

Everything went wrong. 
-The receptionist at my office erroneously told the customer that I would arrive first thing in the morning, even though my flight was scheduled to land after noon. 
-The customer was already disappointed by the quality of work delivered to date and had transferred at least part of his blame to me.  "This is your last chance", he told me during our first meeting, even though it was also my first chance. 
-The project was in a horrible state.  It was already past due and over budget when it was assigned to me.  The existing code as an undocumented mess of spaghetti logic, riddled with bugs.  Further it contained no logging or even graceful error handling.  When the program encountered an error, it simply crashed.

After a few months flying across country and working long hours, I was able to get the project quality to a level that was acceptable to the customer. 

But at that first meeting, I was completely confused and thoroughly intimidated.  I was there to help the customer but our relationship felt adversarial from the start.  I did not manage that first meeting well at all.

Since that time, I have had hundreds of first meetings with customers and I have gradually become better at managing that first encounter.

Given my disastrous first day on site, this article serves to give you the benefit of my ten years of trials and errors.  I like to believe that I learn from my mistakes and now you can also learn from my mistakes.

So here are my rules for a consultant’s first meeting with a new customer.
Rule 1: Listen
Rule 2: Don't solve the problem too soon
Rule 3: Set expectations
Rule 4: Do your homework
Rule 5: Other rules

Rule 1: Listen

This is the first rule because it is by far the most important.  You want your customer to describe his pain points for you and you want to have an understanding of those pain points and why they are causing problems.

Most of the time, a consultant is brought in because the customer wants to change something.  Find out what is driving his desire for change. 

Sometimes the customer has a detailed map of where he wants to go; sometimes he has no clue; sometimes he can see part of the solution; and sometimes he thinks he knows the solution but is on the wrong track.  Listen to what he has to say before deciding into which group your customer falls. 

Try not to interrupt, but ask relevant questions to clarify anything you don't understand.  Customers sometimes use jargon that they understand but you do not.  Ask for definitions when these terms come up.

Take good notes.

When the customer finishes, echo back your understanding of what you heard.  You can do this immediately or in a follow-up e-mail shortly afterward.

Rule 2: Don't solve the problem too soon

This point is related to the last one. Consultants and technical people tend to be problem solvers.  If we hear a problem and think we know the answer we want to shout out that answer to show off how smart we are.  (Okay, maybe you don’t; but I find myself fighting this urge all the time.  I’m a show-off and I’ve met many like me in the consulting industry, so I’ll stereotype here.) 
Most customers (another stereotype coming now) hate this.  If you tell them what they need before they describe their problem, you come across as arrogant, sloppy and uncaring. 
Your first idea may be correct but you should verify this before shooting off your mouth.  Of course, there is always the chance that the customer may know more about his own business and his own problems than you do.

It’s okay to ask questions, such as “Have you thought about this?” or “Have you ever tried this?” but be careful.  Don’t come across as suggesting that you know the answers before he even asks the question.  You are likely to lose credibility before you start.

Rule 3: Set expectations

I am a firm believer that every meeting should have an agenda.  For the first customer-facing meeting, you need two agendas:
1) What will be discussed at this meeting?
2) What will be the responsibilities and expectations of each person during the project?

Many projects fail because those involved don’t know what they are expected to deliver.  Assumptions can be fatal to any project because it is unclear who should be working on what.

Although each project is different, here are a few common questions worth clarifying
-Does the customer want a prototype or a production-ready application? 
-What is your role?
-Is the design complete?  
-Are you expected to lead or participate in the design? 
-Does the customer want you to mentor some of their team members?
-Are there any dependencies you need to be aware of?  What is the contingency plan if a dependency is not met?

You don’t need to answer all these questions at this first meeting but you should talk about them early in the project.  And you should leave the first meeting with an idea of the scope of the project and your role on it.

Rule 4: Do your homework

Before arriving at your first meeting, you should make an effort to find out what you can about the customer and his problem. 

Many times, a salesperson or project manager will have already spoken with the customer.  Talk to these people and get their take on what the customer wants.  Don’t accept that the salesperson has provided 100% of the information.  Several times, I have heard a customer describe a completely different problem than the one described to me by the customer.  (See Rule 1 for how to prevent this miscommunication).

Use the World Wide Web to learn at least the core business of the customer’s company. 

A little preparedness creates a good first impression and provides some context for your opening conversation. 

Rule 5: Everything else

Here are a few more bits of advice I’ve picked up over the years.
-Be on time.  Verify the scheduled time and plan to get there early if possible.
-Dress a little better than the customer.  This advice is often given for job interviews and I think it applies here as well.
-Avoid jargon and acronyms unless you are certain that the customer is familiar with the terms you use.  Your goal is to communicate and jargon often gets in the way of that goal.
-Don't take it personally.  I've had customers blame me for the mistakes of other consultants (some of whom worked for other companies), for the quality of Microsoft software, and for the health of their business.  In nearly every case, they are blowing off steam.  You should make every effort to keep the conversation on topic and the topic is: "What are your problems and how can I help you to solve them?".

Conclusion

The above list of advice is certainly not exhaustive but my experience has shown these to be the most important points when meeting a customer for the first time. 

Wednesday, 03 September 2008 18:09:25 (GMT Daylight Time, UTC+01:00)
# Wednesday, 27 August 2008

Microsoft recently released the ASP.Net Model View Controller framework (MVC).  It is currently available as Preview 3 and can be downloaded at http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&displaylang=en

A new MVC project contains a couple sample views and controllers so you can get an idea of the proper syntax to use. 

This article builds on the application created in my last ASP.Net MVC tutorial.  If you have not already done so, please follow the brief states in the previous MVC tutorial before beginning this tutorial

In the last tutorial, we added a model, view and controller to display a list of customers that one can navigate to using a URL formatted as controller/action.  In this article, we will add a new view and controller to an existing MVC project and display details of a single customer using a URL formatted as controller/action/id.  The id is passed automatically to the action method and allows us to filter to a single customer.

1.       Open Visual Studio 2008 and open the TestMVC solution created in MVC Tutorial 2.

2.       Open the Solution Explorer (View | Solution Explorer) and select the Controllers\CustomerController.cs.   Double-click CustomerController to open it in the code editor.

a.       In the CustomerController class, we will create a new action to get the details of a single customer.   

                                                               i.      Add the following private GetCustomer method to the CustomerController class.  In the last tutorial, we wrote methods to retrieve customer 1 and customer 2.  For simplicity, we will get Customer 1 if ID 1 is passed in to our method and Customer 2 if any other ID is passed.

        private Customer GetCustomer(int custID)

        {

            if (custID == 1)

            {

                return GetCustomer1();

            }

            else

            {

                return GetCustomer2();

            }

        }

                                                             ii.      Add an Action method to the CustomerController class to get the details of a customer.  Paste the following code into CustomerController.cs.

        public ActionResult Details(int id)

        {

            Customer cust = GetCustomer(id);

            return View("Details", cust);

        }

                                                            iii.      In the GetCustomer method, we get details of a single customer and return a view.  Unlike the generated code, we explicitly specify which view to return (“Details”) and we pass in some extra data (cust) that the view will consume.

3.       Add a view to the project.

a.       In the Solution Explorer, right-click the Views\Customer folder and select Add | New Item.  The Add New Item dialog displays.

    Figure 1

                                                               i.      Under Categories, select Visual C#\Web\MVC.

                                                             ii.      Under Templates, select  MVC View Content Page.

                                                            iii.      In the Name textbox, enter “Details”.

                                                           iv.      The Select a Master Page dialog displays.  

   Figure 2

1.       Navigate to the Views\Shared folder and select Site.Master.

2.       Click the OK button to add this view content page to the project.

b.      Add visual elements to the View

                                                               i.      If it is not already open, open the Details view by double-clicking List.aspx in the Solution Explorer.  Click the Source tab at the bottom of the editor.

                                                             ii.      Replace the code in Details.aspx with the following

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Details.aspx.cs" Inherits="TestMVC.Views.Customers.Details" %>

<%@ Import Namespace="TestMVC.Views.Customers"%>

<%@ Import Namespace="TestMVC.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <div>

        CustID:

        <%=((Customer)ViewData.Model).CustID %><br />

        Name:

        <%=((Customer)ViewData.Model).FirstName %>

        <%=((Customer)ViewData.Model).LastName %>

        <br />

        Address:

        <%=((Customer)ViewData.Model).StreetAddress%><br />

        City:

        <%=((Customer)ViewData.Model).City %><br />

        State:

        <%=((Customer)ViewData.Model).State %><br />

        ZIP:

        <%=((Customer)ViewData.Model).PostalCode%><br />

    </div>

 

</asp:Content>


The above code displays details of a single Customer model object. 

4.       Modify the List view

a.       Open Views\Customers\List.aspx by double-clicking it in Solution Explorer.

b.      Find the <td>&nbsp;<\td> cell tag following the cust.PostalCode cell.  Replace this with the following code.  This generates a hyperlink displaying the text “Details”.  The URL of the hyperlink will have the current controller (“Customer”) the “Details” Action and the ID of the current customer.

<td>

<%=Html.ActionLink("Details", "Details", new { ID=cust.CustID})%>

</td>

5.       Test the application

a.       Save and compile the solution (Build | Build Solution).   Correct any errors you find.

b.  Run the solution (Debug | Start Debugging).  Depending on the port number used by Casini, it should display in your browser with a URL such as
http://localhost:4152/Home

c.       Navigate to the List page by changing the URL to
http://localhost:4152/Customers/List
(Replace the port number if necessary)

d.      You should see a list of 2 customers in your browser.  Each customer should have a hyperlink labeled “Details”. 

    Figure 3

e.      Click the hyperlink next to customer 1.  The URL should change to
http://localhost:4152/Customers/Details/1
and the details of the first customer should display on screen.

    Figure 4

f.        Set a breakpoint in the Details method of CustomerController.cs and refresh the page to step through the code as it executes.

In this article, we added a view and controller to our application and used these to retrieve and display customer details by the Customer ID. 

.Net | ASP.NET | MVC
Wednesday, 27 August 2008 13:26:29 (GMT Daylight Time, UTC+01:00)
# Tuesday, 26 August 2008

There's nothing quite like riding on a bus for 27 hours with a few dozen software developers.

That's exactly what I did last weekend on my way to and from DevLink in Murfreesboro, TN.

The DevLink bus was the result of much hard work by Amanda who did most - if not all - the organizing.

The bus began its odyssey Wednesday night in Grand Rapids, MI before proceeding to Lansing.  When the bus picked me up in Plymouth, MI at 9:15 PM, it had already been traveling for 3 hours.  From there, it rolled on to Toledo, Columbus and Cincinnati (its final southbound stop at 4AM) before proceeding to its final destination in Murfreesboro, Tennessee. 

The first half of the ride was great fun.  I met new people; I reconnected with old friends; and I met people face-to-face with whom I had only communicated electronically.

Event the two times the bus driver got lost couldn't dampen our spirits.  We were having too much fun.

After about 4AM, the trip began to drag.  Everyone was exhausted and the seats were too uncomfortable to allow more than a few minutes sleep at a time.  This was clearly a bus designed for cross-town trips – not cross-country trips.  DVDs provided some entertainment ("The Big Lebowski" and “Office Space” cracked me up) but you can only focus on movies for so long and the acoustics were less than ideal.

We arrived at our hotel worn and weary at 9:30AM Central time, over 13 hours after leaving Plymouth and 16 hours after the bus began its trip. 

24+ hours of sleep deprivation left me physically ill and I spent nearly all of Thursday in bed.

It was good that I did.  The conference began Friday morning and I awoke refreshed and ready to absorb and exchange ideas at what turned out to be an excellent conference.  (You can read more about it here.)

The ride home was an adventure.  Although the conference ended at 6PM, someone decided the bus shouldn't leave town until 9PM so we had to kill a few hours at a restaurant before heading out. 

Although we picked up at least one new traveler on the ride home, we lost a few more.  Some folks booked a flight to Chicago for a Monday business meeting and a couple people elected to rent a car and drive home rather than subject themselves to the length and discomfort of the bus ride.  I was tempted to join them but I stuck with my plan and boarded the bus at 9.

The mood was more subdued on the return trip. We still had some good conversations early in the ride but the environment lacked the energy sparked by seeing people for the first time in months.

About 2AM, I had just begun to drift to sleep when a sound like a jackhammer awakened me suddenly.  I was sitting just above the tire that blew flat traveling 65 miles an hour on I-71 just north of Louisville, KY.  We pulled off the highway in front of a Waffle House in Carrolton, KY and waited 3 hours for the tire to be fixed.  The repair would have taken far less time if the repair guy had not allowed a drunken Waffle House customer to play with the lug nut gun.  He sheared off the bolts on wheel, forcing the repair guy to return to his shop for more parts and weld on new bolts.

Waffle House provided some entertainment.  Corey attempted to start a relationship with one of the waitresses; and the manager tossed out a drunk who wouldn't stop ordering pork chops long after he was told the restaurant was out of pork chops.  Apparently the Carrolton Waffle House is a magnet for drunks at 2AM Saturday night.  Go figure.

We got back on the highway about 5AM so exhausted that even the uncomfortable seats wouldn't prevent a few hours dozing.

I thought things would go quicker after this because the drivers knew the route better, having just driven it 3 days earlier.  Alas, we became lost in northeast Ohio and drove nearly to Cleveland before turning west toward Toledo.

At 12:30 Eastern time - 14.5 hours after leaving the hotel and 17.5 hours after the end of the conference - we pulled into the parking lot in Plymouth.  I was never so happy to see my car and the 40 minute drive home seemed trivial. 

I was scheduled to read aloud at the 12:15 mass in my church and the last minute substitute is probably still angry with me for missing this, but we all arrived safely.

Was the bus ride a success?  Would I do it again?  Would I take a bus to a distant location with dozens of others like me?  I've decide that, if I can be promised a more comfortable seat, I will do it the next time it's offered.  Everything else was easily tolerable and I did enjoy the fellowship that came with such a long ride with like-minded people.  I even got a few job leads from the conversations I had on the two rides (I am between jobs for those who don't know).

If you go on such a trip, my only advice is

  1. Be prepared for anything
  2. If the Waffle House waitress in Carrolton, Ky tells you they are out of pork chops, shut up and order the hash browns. 

Note: Click here to see more photos from DevLink and the famous bus ride.

Tuesday, 26 August 2008 16:38:58 (GMT Daylight Time, UTC+01:00)

People attend conferences for many different reasons.  Some come for the content of the lectures; some come to meet and hear well-known speakers; some come to meet and network with others in the industry; some come to see old friends.

Me, I come for all those reasons.  At DevLink last week in Murfreesboro, TN, I experienced all those things and more. 

But I also experienced something new.  I had heard of Open Spaces in the past but had not experienced them.  At DevLink, Open Spaces were promoted heavily as a different way of exchanging ideas.  I was curious and gave it a try.

An Open Space event consists of developers sitting together roughly in a circle in a room and they exchange ideas with one other.  A topic is picked in advance by the group but the conversation is not limited to that topic.  If the conversation drifts from the assigned topic and the group remains engaged, this is perfectly all right.  The important thing is that ideas are exchanged and the group remains passionate about the conversation.

And I heard a great deal of passion at the DevLink Open Spaces that I attended.

During the event, I attended 3 Open Spaces sessions plus the planning session (where topics were picked) and the wrap-up session (where the group reviewed the open spaces of the previous 2 days).  In each session I attended, I heard bright people sharing great ideas.  Sometimes we argued and sometimes we were in violent agreement but I enjoyed it all. 
In a session on Service Oriented Architecture, I argued earnestly that, due to the costs of SOA, support from the top was necessary for SOA to succeed within any organization.  Most of the other loud persons in the group insisted that newer tools such as WCF had lowered the cost of SOA sufficiently that a strong grass roots effort could drive SOA in an organization.  By the end of the session, I think we had all learned something and moved a little toward understanding the others' side.

I did attend a few traditional sessions in which a speaker stands in front of a classroom and delivers a lecture to an audience that is mostly passive.  Richard Campbell and Carl Franklin were two of the speakers at this conference and I have long been a fan of their .Net Rocks podcast, so I made a point to attend a lecture by each of them.  Both were good sessions but they were easily topped by Joe Wirtley who gave an excellent talk on WPF.  It was excellent because it focused on building a business application, rather than the eye candy that clutters so many WPF presentations.

Overall the conference was a great success.  It drained me of energy but it fired me up at the same time.

And I haven't even told you about the 28 hours I spent riding a bus with a few dozen techno-geeks.  Or the flat tire that left us stranded in Carrolton, KY for 3 hours at 2AM.  But that’s another story.

Note: Click here to see more photos from DevLink

Tuesday, 26 August 2008 04:49:27 (GMT Daylight Time, UTC+01:00)
# Friday, 22 August 2008

Microsoft recently released the ASP.Net Model View Controller framework (MVC).  It is currently available as Preview 3 and can be downloaded at http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&displaylang=en

A new MVC project contains a couple sample views and controllers so you can get an idea of the proper syntax to use. 

In this article, we will add a new model, view and controller to an existing MVC project. 

1.       Open Visual Studio 2008 and create a new MVC project.  For information on how to create a new MVC project, see http://www.davidgiard.com/2008/08/18/TheASPNetMVCSampleAppDemystified.aspx

2.       Open the Solution Explorer (View | Solution Explorer) and select the Models folder.

3.       Add a Model to the project

a.       Right-click the Models folder and select Add | Class.  The Add New Item dialog displays.
Figure 1
    Figure 1

                                                               i.      At the Name textbox, enter “Customer”.

                                                             ii.      Click the OK button to create a Customer class.

b.      The Customer class opens in the class editor.  This class will contain a few public properties that help describe a customer object.  Add the following code to the Customer class.

    public class Customer

    {

        public int CustID { get; set; }

        public string FirstName { get; set; }

        public string LastName { get; set; }

        public string StreetAddress { get; set; }

        public string City { get; set; }

        public string State { get; set; }

        public string PostalCode { get; set; }

    }

4.       Add a Controller to the project

a.       In the Solution Explorer, right-click the Controllers folder and select Add | New Item.  The Add New Item dialog displays.
Figure 2
    Figure 2

                                                               i.      Under Categories, select Visual C#\Web\MVC.

                                                             ii.      Under Templates, select MVC Controller Class.

                                                            iii.      In the Name textbox, enter “CustomerController”.

                                                           iv.      Click the Add button to create the CustomerController class and open it in the class editor.

b.      In the CustomerController class, we will create some actions.  Each action will instantiate one or more Model objects and display them in a view object. 

                                                               i.      Add the following statement at the top of the CustomerController class. 

using TestMVC.Models;

                                                             ii.      Add the following private methods to the CustomerController class.  For now, we will create customers out of thin air (as if it were that easy).  In a real application, we would probably call a web server or query a database to get customers.

        #region private methods

        private Customer GetCustomer1()

        {

            var cust1 = new Customer

            {

                CustID = 1,

                FirstName = "David",

                LastName = "Giard",

                StreetAddress = "123 Main",

                City = "Boringville",

                State = "MI",

                PostalCode = "48108"

            };

 

            return cust1;

        }

 

        private Customer GetCustomer2()

        {

            var cust2 = new Customer

            {

                CustID = 2,

                FirstName = "John",

                LastName = "Smith",

                StreetAddress = "321 Elm",

                City = "Nowhere",

                State = "OH",

                PostalCode = "41001"

            };

 

            return cust2;

        }

 

        private List<Customer> GetAllCustomers()

        {

            Customer cust1 = GetCustomer1();

            Customer cust2 = GetCustomer2();

            List<Customer> allCusts = new List<Customer> {cust1, cust2};

            return allCusts;

        }

 

        #endregion

                                                            iii.      Add some Action method to the CustomerController class.  We’ll start with a List action.  Paste the following code into CustomerController.cs.

        public ActionResult List()

        {

            var allCustomers = GetAllCustomers();

            return View("List", allCustomers);

        }

                                                           iv.      In the List, we get a list of customers (all 2 of them) and return a view.  Unlike the generated code, we explicitly specify which view to return (“List”) and we pass in some extra data (allCustomers) that the view will consume.

5.       Add a view to the project.

a.       In the Solution Explorer, right-click the Views folder and select Add | New Folder.  A new folder appears in the Solution Explorer.  Rename this folder to “Customer”.

b.      In the Solution Explorer, right-click the Customer folder and select Add | New Item.  The Add New Item dialog displays.

                                                               i.      Under Categories, select Visual C#\Web\MVC.

                                                             ii.      Under Templates, select  MVC View Content Page.

                                                            iii.      In the Name textbox, enter “List”.

                                                           iv.      The Select a Master Page dialog displays. 
Figure 3
   Figure 4

1.       Navigate to the Views\Shared folder and select Site.Master.

2.       Click the OK button to add this view content page to the project.

c.       Add visual elements to the View

                                                               i.      If it is not already open, open the List view by double-clicking List.aspx in the Solution Explorer.  Click the Source tab at the bottom of the editor.

                                                             ii.      Replace the code in List.aspx with the following

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="TestMVC.Views.Customers.List" %>

<%@ Import Namespace="TestMVC.Views.Customers"%>

<%@ Import Namespace="TestMVC.Models"%>

 

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <h2><%= Html.Encode(ViewData["Message"]) %></h2>

    <table>

        <tr>

            <td>ID</td>

            <td>First</td>

            <td>Last</td>

            <td>Addr</td>

            <td>City</td>

            <td>State</td>

            <td>ZIP</td>

            <td>&nbsp;</td>

        </tr>

        <% foreach (Customer cust in (List<Customer>)ViewData.Model)

           { %>

            <tr>

                <td><%=cust.CustID %></td>

                <td><%=cust.FirstName%></td>

                <td><%=cust.LastName%></td>

                <td><%=cust.StreetAddress%></td>

                <td><%=cust.City%></td>

                <td><%=cust.State%></td>

                <td><%=cust.PostalCode%></td>

                <td>&nbsp;</td>

            </tr>

        <% } %>

    </table>

</asp:Content>


The above code displays a list of Customer model objects.  In a real-world example, we may choose to have the Customer model derive from a base class and only refer to the base class in the view.  This would increase the separation between our view and our model.

6.       Test the application

a.       Save and compile the solution (Build | Build Solution).   Correct any errors you find.

b.  Run the solution (Debug | Start Debugging).  Depending on the port number used by Casini, it should display in your browser with a URL such as
http://localhost:4152/Home

c.       Navigate to the List page by changing the URL to
http://localhost:4152/Customers/List
(Replace the port number if necessary)

d.      You should see a list of 2 customers in your browser
Figure 4
    Figure 4

e.      Set a breakpoint in the List method of CustomerController.cs and refresh the page to step through the code as it executes.

In this article, we created a model, view and controller from scratch and displayed them.  You can download the code for this project here.

In the next article, we will use the ID of the URL to specify a single customer.

.Net | ASP.NET | MVC
Friday, 22 August 2008 14:02:34 (GMT Daylight Time, UTC+01:00)
# Thursday, 21 August 2008

I have been plagued recently by a recurring problem with Visual Studio 2005.

When I attempt to exit Visual Studio, I receive the error "Visual Studio cannot shut down because a modal dialog is open" and I am not able to exit.  The rub is that there is no modal dialog - close every visible window in VS, close all other apps, resize, move and minimize VS and I can find no dialogs, modal or otherwise.  Some bit inside VS is set incorrectly convincing itself that a dialog has not yet been closed.

The only solution was to open Task Manager and kill Visual Studio.

I have automatic updates turned on so, if this is a bug, I expected it would have been fixed by now. 

I found a number of posts and threads about this issue so it is not uncommon but nearly every post did not list a solution.

After some digging, I discovered a hotfix for this problem that is not included in the normal Windows updates. 

You can read the details of the problem from Microsoft here http://support.microsoft.com/kb/936971 and you can download the hotfix here
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=7259

One important point.  Visual Studio must be closed before installing the hotfix so you may end up killing the process via Task Manager one last time.

Thursday, 21 August 2008 00:51:23 (GMT Daylight Time, UTC+01:00)