# Thursday, December 10, 2009

When writing .Net code (or code in any language for that matter) that updates a database, you need to be cognizant of the fact that it takes a finite amount of time to connect to a database and process any commands sent to the database.

ADO.Net permits you to set a TimeOut value on a Connection object and on a Command object.

The Command TimeOut property allows you to configure how long a command waits to successfully complete execution of a query. By default, a Command object will timeout after 30 seconds

It’s important to strike a good balance when setting timeout values.

Sometimes we expect a database action to take a long time and we want to give it time to complete before we pull the rug out, so to speak.

On the other hand, if a problem prevents a command from executing properly, it's useful to know this sooner so our application can handle it.

Changing a command timeout is simple. The Command object exposes a read/write ConnectionTimeout property. Set it to the number of seconds you wish the comand to wait on executing before aborting.

After the Command TimeOut period, if the command has not completed, an exception is thrown. However, the database server does not know this, so the command will continue to execute on the server - your application just won't know the results.

The Connection TimeOut is the amount of time the Connection will spend attempting to connect to a database before giving up and throwing an exception. The default Connection Timeout value is 15 seconds. On a slow network, it may take longer to connect, so you may wish to increase this value. However, if the application is unable to connect to the database - if the server is unavailable, for example - it's best to find this out sooner rather than later.

Changing the Connection Timeout is less obvious than changing the Command Timeout. The Connection class exposes a ConnectionTimeout property; But this property is read-only, so you cannot use it to change the timeout. To change a timeout, you must modify the connection string. Add or update the following to your connection string:
    Connection Timeout=XXX
where XXX is the number of seconds to wait for a connection to remain open before aborting all pending operations on that connection.

In your applications, it is important to strike the right balance when setting timeout properties.

Thursday, December 10, 2009 3:25:03 PM (GMT Standard Time, UTC+00:00)
# Wednesday, December 9, 2009

Tomorrow evening - Thursday December 10 - I will speaking at the Flint .Net User Group. My topic is An Introduction to Object-Oriented Programming, a talk I've done twice before.

More information is available here.

This will probably be my final presentation for 2009.

Wednesday, December 9, 2009 7:20:07 AM (GMT Standard Time, UTC+00:00)
# Tuesday, December 8, 2009

The Great Lakes Area .Net User Group traditionally does not hold a regular meeting in December.

This year, we will replace the December meeting with a special event. Software developers in the area are invited to come together to share code and ideas in an informal setting.

I first heard of this idea from my friend Mike Wood. He is on the board of the Cincinnati .Net User Group, which sponsors a monthly pair coding meeting that they refer to as "Bitslingers". Shortly after hearing of Mike's group, I learned that a similar meetup took place weekly in Columbus. Because the Columbus folks meet in the morning, they call their group "Code and Coffee". I'm trying to think of a clever name for the Detroit area meetup.

The first Detroit-area meetup will be Wednesday December 16 from 6-9PM at Biggby Coffee at 26185 Evergreen Rd in Southfield, MI. If Biggby gets too crowded, we will move next door to Potbelly.

Bring your laptop and experience pair programming and exchange ideas with other bright .Net developers. Work on an open source project or dive into a new technology or explore a new technique or learn a new language.

I will be there with a personal project I started to help me learn ASP.Net MVC and the Entity Framework.

If this event is successful, we will consider holding it regularly.

Tuesday, December 8, 2009 2:22:37 AM (GMT Standard Time, UTC+00:00)
# Friday, December 4, 2009

For the third consecutive year, I will be attending CodeMash. This annual event will next be held at the Kalahari Resort in Sandusky, OH January 13-15.

I really like the CodeMash conference. Here's why

1. It has a regional feel.
There are a lot of bright, passionate developers in Ohio, Michigan, Kentucky and Tennessee. You will see a good number of them at CodeMash, as presenters and as attendees.

2. The content and speakers are excellent.
I've heard many of these speakers before and it's an impressive list. In addition to thought leaders from the Heartland, CodeMash attracts internationally known authors and speakers, such as Mary Poppendieck, Chris Smith, Andy Hunt, Jim Wooley and Gary Short.

3. It's cross-platform.
As a .Net developer, it's easy for me to get tunnel vision regarding how I do software design and development. Learning from Ruby, Java and Python developers gives me a different perspective.

4. The sessions aren't the only place to learn.
There are so many smart people at these conferences that I learn as much outside the sessions as I do in them. I can talk to an expert in the hallway and ask specific questions about my project; or I can attend an open space and discuss a topic of interest with other smart people.

5. It is affordable.
It's tough to find a better deal than this. The cost for the 2-day conference is currently $220 (It would have been only $175 if you had registered last week. Sorry.) An optional "precompiler" day will set you back another $75. Compare that with a national conference like PDC, which costs thousands of dollars.

6. It's fun.
What can I say? I thrive on interacting with these folks. They are passionate about many of the same things I am. Plus there are activities at night, such as parties and poker tournaments. There is even an indoor water park at the resort. Many attendees bring their families with them to enjoy the slides while they are at the conference.

Interested yet? Is so, you can get more information at CodeMash.org. But hurry. I rushed to write this because I just saw a tweet announcing that only about 30 tickets remain.

Friday, December 4, 2009 3:54:51 PM (GMT Standard Time, UTC+00:00)
# Wednesday, December 2, 2009

Monday evening, my show - Technology and Friends - appeared on Channel 17 (CTN) in Washtenaw County, Michigan.

I'm happy to announce that more episodes of Technology and Friends will be available on Comcast cable in my area. If you have Comcast cable in Washtenaw County, you can watch the show on Channel 17 at the following times.

Four episodes are scheduled to air over the next two weeks. The times are listed below.

The three episodes (Episode 48: Phil Japikse on HopeMongers.org; Episode 57: David Truxall on Debugging; and Episode 60: Stephen Toub on Parallel Computing) will air back-to-back-to-back at the following times.

November 30, 2009 5:00 PM
December 3, 2009 2:00 PM
December 4, 2009 9:00 PM
December 5, 2009 6:00 PM
December 6, 2009 Noon
December 7, 2009 4:00 PM

Episode 58: Sai Naik on the benefits of SharePoint will air at the following times.

December 9, 2009 11:00 PM
December 10, 2009 8:30 PM
December 12, 2009 11:00 AM
December 14, 2009 8:00 PM
December 16, 2009 4:00 PM
December 19, 2009 7:00 PM

As always, you can still view episodes on this site.

Wednesday, December 2, 2009 12:54:59 PM (GMT Standard Time, UTC+00:00)
# Monday, November 30, 2009

Episode 63

In this conversation, independent consultant Michael Eaton describes the challenges developers face estimating software projects. He then describes approaches to these challenges, based on his experience.

Monday, November 30, 2009 3:27:37 AM (GMT Standard Time, UTC+00:00)
# Thursday, November 26, 2009

Sometimes, life gets hard and it's easy to forget that I have much for which to be thankful. Here are some things for which I am thankful this year.

My sons
At 15 and 18, they have grown up strong and smart and good natured (at least they are good-natured by teenager standards). They are tall, good-looking, athletic and popular, without being arrogant about it. I cannot wait for them to fully grow to manhood.

My siblings
My sister passed away this year. Her death and what followed put a major strain on the whole family. My siblings and I banded together for support, without which we could not have made it through this trying time.

My parents
They are pushing 80 and their health varies each day, but they are still going strong. I'm glad they are still a part of my life.

My friends
You know who you are and I appreciate the listening ear and the cold beer.

My career
This wasn't my first career choice, but it is the one that I've enjoyed the most. The constant learning keeps me moving forward.

Happy Thanksgiving all. Don't forget the good things and good people in your life.

Thursday, November 26, 2009 4:19:25 PM (GMT Standard Time, UTC+00:00)
# Tuesday, November 24, 2009

Recently, I was asked to migrate code from one source control repository to another.  The customer had been using Visual Source Safe (VSS) for many years and had dozens (maybe hundreds) of projects checked in. Most of these projects had a long history of file versions.
VSS was a decent product when it was first released, but it falls far short of newer source control systems, such as Team Foundation Server (TFS), Subversion and CVS. This customer selected TFS as their new source control system, but they did not want to lose the history they had captured in VSS.

They asked me how to move the years of VSS history into TFS. Tools exist to do this, including  Microsoft’s VSS2TeamFoundation (available at  http://msdn.microsoft.com/en-us/library/ms181247(VS.80).aspx). However, migration tools have several disadvantages:

  1. Migrating years of source control can take a really long time, maybe weeks. You will probably want to do a test migration of your data, which will extend the time requirement even further.
  2. If you have been checking code into a source control system for any length of time, there are bound to be some mistakes: Projects that were started but never went anywhere; Code changes that were mistakenly checked in and had to be reverted; and duplicate source code erroneously checked into two distinct folders. If you migrate your all source code history, these mistakes will be migrated as well.

A simpler alternative to migrating every version of every project in every folder is to simply get the latest code from the old source control repository and check it into the new repository. Using Visual Studio, this requires only a few steps:

  1. Open the project in Visual Studio
  2. Get latest from the old source control system
  3. Remove bindings to the old source control system
  4. Connect to the new source control system
  5. Check the code into the new source control system

Repeat this for each solution. You will now have a current version of all relevant code checked you’re your new source control system.

Some users will tell you this is not enough. These users want to keep all the history of every bit of code - every version, every branch and every project. Using the above migration strategy, you can still do that. My recommendation is to keep the history in your old repository, mark that repository as read-only and leave it online. Users will still be able to use this old source control system to find their old code, but will use the new source control system for all version control going forward. This is far simpler and faster than trying to push years of changes into a new repository.

The lesson here is: Always consider the simplest alternative and determine whether it meets your needs, before considering more complex solutions.

Tuesday, November 24, 2009 11:49:04 AM (GMT Standard Time, UTC+00:00)
# Monday, November 23, 2009

Episode 62

In this episode, Jay Harris discusses the challenges integration code from different team members and how Continuous Integration can help solve these challenges.

Monday, November 23, 2009 11:46:40 AM (GMT Standard Time, UTC+00:00)
# Wednesday, November 18, 2009

Episode 61

Chris Woodruff organized the 2009 Grand Rapids Give Camp which helped dozens of charities with software projects. On the final day of the Give Camp, Chris sat down with us to describe what went into the camp and what was accomplished.

Wednesday, November 18, 2009 6:25:04 AM (GMT Standard Time, UTC+00:00)