Wednesday, August 27, 2008

SqlServer Timeout Expired Exception

One of our users emailed and said he got the following exception with a reporting query:
System.Data.SqlClient.SqlException: Timeout expired.  
The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

The exception just started happening because the database has slowly been increasing to where the report query fails to finish in a timely manner. The timely manner is 30 seconds, the default for .Net database connections.

You can increase the default time of 30 seconds by using the "CommandTimeout" field on the "Command" object as shown below:

using (connection) {
SqlCommand sqlcommand = connection.CreateCommand();
sqlcommand.CommandTimeout = 60; //default is 30 seconds
sqlcommand.CommandText = sqlText;
...

Don't be misled by the database connection string option, "Connection Timeout", e.g., "Data Source=myMachine; Integrated Security=SSPI; database=Northwind;Connection Timeout=60". That timeout is for getting the connection, not for how long it queries the database.

Monday, August 25, 2008

Car Buying Tips


I just bought a new car this weekend and wanted to share some tips:
1. Go to Edmunds.com to price your dream vehicle.
2. Get a small notebook (a physical paper-thingy, oddly enough, they still make them) and keep all your notes in one place. Staple business cards into the notebook. I had scraps of paper everywhere and it was a mess.
3. When you first visit a dealership, ask for someone from the internet department - they can get you the best deals. Better yet, phone ahead and make an appointment.
4. When you've got your car model, trim number, and options set, use Edmunds.com to send an email to all the dealers near you asking for a quote on a car. Ask for the Vin# of the auto. I had a car swapped out from under a deal at a dealership. It was suppose to have a certain option for the price, but oddly enough didn't.
5. Ask for the car price and the final "drive-out" price.
6. After getting the best deal, email all the losers and ask if they can meet the price.
7. After getting the best price, take a copy of the email with you to the dealership, just in case, like in my situation, the dealership forgot the low price quoted.

Tuesday, August 19, 2008

Find Duplicates of Your Images on the Web with TinEye




I like a new startup named, TinEye. It searches its archives of the web for the original or altered versions of your photos. I asked it to track down one of my photos and it found five unauthorized copies floating around on various sites. (Not that it matters to me, any publicity is good, but I could at least ask for a link back).

Computer Generated Actors

The following clip is very impressive. Estimates are that digital actors could replace carbon-based ones in 2020. With the right software we could place ourselves or family members into future mainstream movies, not by photoshopping, but by swapping out the digital actor component in a "film". Software would play the film, but access your new character instead of the original component. How about swapping out the characters in "Aliens" with the cast of "Friends"? Weirder things will happen.

Thursday, August 14, 2008

Jeffrey Palermo at Austin .Net Users Group - TDD, DI, and SoC with ASP.NET MVC




This last Monday Jeffrey 'Party With' Palermo gave an excellent talk to the Austin .Net Users Group on Separation of Concerns. He gave a brief overview of Dependency Injection and Test Driven Development/Design while introducing Microsoft's ModelViewController framework, which is all about separating concerns so components can be better designed, freely replaced in the future, and tested.
Jeffrey said something that made sense about SoC and GUI testing: "Any decision can have bugs. Don't put decisions in the GUI which is hard to test. Views should only create HTML."
The first official release of MVC is guessed to be late October, 2008, although prereleases are coming out every six weeks or so.

Wednesday, August 13, 2008

PeopleWare by DeMarco and Lister


Click to read reviews or buy Peopleware

I've just finished reading Peopleware by DeMarco and Lister and have put it on my Recommended Reading list. Buy one and read it.

This is a great book, it's 20 years old, but still relevant. I thought the highlights were these:


  1. Projects fail not for technical reasons, but for sociological reasons.
  2. Our successes stem from good human interactions, not from incremental technical improvements.
  3. Making errors should be encouraged - everyone should have a few mistakes during the project when we tried something and it didn't work. When the answer to "How many mistakes did you make?" is "none"; that's a bad sign people aren't trying enough new things.
  4. We need people who make the team "jell" - they are worth more than coders.
  5. We spend too much time trying to get things done, and not enough time asking if the thing is worth doing.
  6. People really like to make very high quality stuff, but the market wants high quantity.
  7. Parkinson's law, "work expands to fill the alloted time", doesn't apply well to software developers.
  8. Beware of claims to increase software productivity by 100% because most time is not spent programming.
  9. When testing productivity of programmers, some were 10 times more productive than others. This is not quite what it sounds like since not all a person's time is taken with programming.
  10. During "programming games", language did not affect the outcome (except assembly language) and experience didn't matter (if they had more than six months experience).
  11. Quiet places for work are extremely important to allow programmers to get in the "flow" of their work. (This agrees with Joel Spolsky, but not the Agile wing of development).
  12. Corporations have entropy. Differences, and creativity, in departments are slowly ground out of them to create a flat, bleak landscape of sameness.
  13. Big Methodologies don't work; better to use training, tools, and peer reviews.
  14. Fujitsu encourages all projects to do some aspect in a nonstandard way.
  15. Letting teams strive for less than perfect quality is the "death knell" for the team. Teams really want to do high quality work.
  16. "Sociology matters more than technology or even money."
  17. Overtime is destructive and counter-productive.
  18. People hate change. We are agents of change.
  19. Try to keep people on one project at a time, not spread over several at one time. They are less efficient and more frustrated.
  20. Don't waste your peoples time in meetings and overstaffing projects early.
  21. Create a fun, creative, productive team environment - somehow.


Their recommendation for having quiet offices struck me. As a result we got the loud cell phone in the office turned down and I bought one of my people, who is affected by the noise, some noise-canceling headphones to see if that would help with the noise. It didn't.

Saturday, August 02, 2008

Salman Rushdie threatens to sue ex-guard over book

Is it just me or does it seem ironic that Salman Rushdie the champion of "free speech" for books is threatening to sue the author of a book that implies Salman is "cheap, nasty and arrogant"?