Two Great Leadership Speeches

I’ve run into two outstanding leadership speeches recently. The first is by General Welsh, commander of the U.S. Air Force in Europe. It is from a recent speech to the Cadet Wing at the Air Force Academy. I remember some good speeches while I was a cadet, but none as impressive as this. I particularly liked how he called everyone, even lieutenants, by their first names and gave the whole speech without any notes. Kudos to the Association of Graduates for sending out a link with the speech.

General Welsh Speech to USAFA

The second video came via my wife Sue, who in turned got it from her boss Toby. The concept that “people don’t buy what you do but why you do it” is fascinating. There are lots of good examples and anecdotes as well.

How Great Leaders Inspire Action by Simon Sinek

Fixing SQL Divide By Zero Error

We had an issue yesterday with reports failing in Tracker.Net yesterday. The exception was “Divide by Zero Error Encountered.” I first thought it might be an error in a report itself. But searching for the error pointed to the SQL Server query instead. This Stack Overflow article describes the problem pretty well. The problem with my reports was that I was calculating the “percent score” on a test. I was accounting for a null “maximum score” but not for a zero maximum score. I haven’t checked the SCORM specification to see if a zero value is even valid, but it doesn’t really matter as at least one customer has data like that. Here is the original section of a query:

Tracker_SessionLessonStudentLog.LessonTestScore / ISNULL(Tracker_SessionLessonStudentLog.LessonMaxScore, 100) AS SessionPercentScore

The ISNULL() function checks if LessonMaxScore is null and, if so, substitutes 100. But it doesn’t address the situation where LessonMaxScore has an actual value of 0. That’s what caused the divide by zero error. As suggested in the article referenced above, I added the NULLIF() function as shown below.

Tracker_SessionLessonStudentLog.LessonTestScore / NULLIF(ISNULL(Tracker_SessionLessonStudentLog.LessonMaxScore, 100), 0) AS SessionPercentScore

So if the inside expression is 0, the whole divisor becomes null and the SessionPercentScore becomes null.