# Tuesday, 24 October 2006

[backdated with dasBlog]

OK, I know you really come here for C++ stuff and the occasional picture of autumn leaves, but there are some things I want you to do. First of all, if you're the donating type, and you want to make a donation in my Dad's memory, please don't give it to those "cancer is a word, not a sentence" people. Nothing they did helped him. (Research is fine, just all that cheer-up-it's-not-so-bad stuff bothers me.) He died two days short of the one-year anniversary of his diagnosis, which is actually pretty good for esophageal cancer. The heroes in our minds are the VON. Back in August, had my dad stayed one more day in the hospital I believe he would have died there. Going home gave him many more months and gave us all more time with him and more time to come to grips with what was happening. The VON were what made that possible. Sometimes they came every day, sometimes every other, sometimes two and three times a day. They dealt with his abcess, his draining tube, his pain, his weakness, with all the things that would have otherwise had him in the hospital. They were always polite and respectful and supportive. They didn't bustle around like hospital nurses, bossing everyone and controlling their territory. You can donate to your local VON if you have one, or to the ones who helped Dad at VON of Greater Halifax, 7001 Mumford Road, Tower 1, Suite 300, Halifax NS, Canada B3L 4N9.

Second, if you ever have trouble swallowing, have a terrible acid stomach for which you regularly take antacids, or have a family member who died very quickly of "a growth in the throat" or something similar, go and ask your doctor to test you for Barrett's esophagus. That's about the only hope for prevention of this, the fastest-growing cancer in North America.

Third, no matter how old you are, it wouldn't hurt to talk to your family about your end of life wishes. Whether it's dying at home, what songs to play at the ceremony,  or burial-vs-cremation, the decisions are so much easier when you actually know what the person would have wanted.


Tuesday, 24 October 2006 07:34:35 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Monday, 23 October 2006

[back-dated with dasBlog]

While I was in Africa my father's condition worsened and then he slipped away. He died at home, in the bed he'd been using for several months, without pain, knowing he was dying and that it was time to go. He had taken care of the things he needed to take care of: explaining his latest project to his former graduate students so that they can prove his theory and rewrite some text books, explaining the trickier aspects of the boat motor to my sister, giving some instructions to his lawyer. He was content to go at the end.

His obituary was in the Globe. It could easily have been twice as long.


Monday, 23 October 2006 07:23:19 (Eastern Daylight Time, UTC-04:00)  #    Comments [2]
# Saturday, 14 October 2006

The code definition window is not just for C++. Here's a C# screen shot:

Doesn't seem to do anything for VB at all though. I just see No definition selected no matter where I click.


Saturday, 14 October 2006 05:26:08 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Friday, 13 October 2006

Not enough people know about the code definition window in Visual Studio 2005. I see them trying to understand code by getting editor tips on the classes and functions they see in use:

A reasonably clever trick is to use Ctrl+Shift+Space to get parameter tips for the function:

But the tips are transient, they go away when you use your mouse and try to do some work. So most people fall back on good old Go To Definition:

Sure, this isn't transient, but it leaves you sitting in another file and needing to flip back and forth from file to file when you're just trying to understand what a particular function call does. What I like to use in this case is the code definition window. It's on the view menu:

And here's what it gives you:

It also works to show you the code for a function you're calling. Once it's open, just click on the thing you want to see in the code definition window:

Once you get in the habit of just glancing down to the bottom of the screen to get a little more information, you'll wonder how you ever did without it.


Friday, 13 October 2006 05:15:57 (Eastern Daylight Time, UTC-04:00)  #    Comments [1]
# Thursday, 12 October 2006

Here's an article on static code analyis that makes some nice points. I love the title: I’m not in denial, I’m in a hurry. It can be tough, at the end of a project, to find the time for that tidying up that you once thought there'd be time for. Better to get the comparison of what you're doing to best practices as you go along. In fact, every time you build your app. Then you'll know where you stand.


Thursday, 12 October 2006 09:36:37 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Wednesday, 11 October 2006

One of the things I do for many of my clients is code review. This comes in two flavours. The first is where we all pile into a room with a projector and someone walks us through the code while we ask questions. Sometimes as a result of this the original author has to go away and rewrite bits of the code, but it's just as likely that the outcomes will be everyone understanding how something works, or knowing what there is in someone else's part of the application. The second is less interactive. I read over code and point out bad, dangerous, sloppy, or hard to maintain code. This might be hardcoded error messages in a multilingual application, or non parameterized dynamic SQL, or poor object orientation, or any one of hundreds of other things. Often I point it out not to the author of the code directly, but rather to the author's manager. Or in at least one case, their former manager. (As in, now that we got rid of this person, can you tell just how much mess he left behind?)

Now, if you are thinking of going to Team Systems, let me give you another reason to do so. It can automate a lot of these types of checks. For example, here's a really quite poor little class:

Public Class Company
    Private networth As Integer = 0
    Public name As String
    Private foundingdate As Date

    Public Sub New()

    End Sub

End Class

When I run static analysis against this, in no time flat it points out:

Running Code Analysis...
C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe /o:"bin\Debug\Information.dll.CodeAnalysisLog.xml" /f:"bin\Debug\Information.dll" /d:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" /r:C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules
MSBUILD : warning : CA1020 : Microsoft.Design : Consider merging the types defined in 'Information' with another namespace.
MSBUILD : warning : CA2209 : Microsoft.Usage : No valid permission requests were found for assembly 'Information'. You should always specify the minimum security permissions using SecurityAction.RequestMinimum.
MSBUILD : warning : CA2210 : Microsoft.Design : Sign 'Information' with a strong name key.
MSBUILD : warning : CA1014 : Microsoft.Design : 'Information' should be marked with CLSCompliantAttribute and its value should be true.
C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Information\Information\Class1.vb(6): warning : CA1805 : Microsoft.Performance : Company.New() initializes field networth of type System.Int32 to 0. Remove this initialization as it will be done automatically by the runtime.
MSBUILD : warning : CA1823 : Microsoft.Performance : It appears that field 'Company.foundingdate' is never used or is only ever assigned to. Use this field or remove it.
MSBUILD : warning : CA1051 : Microsoft.Design : Make 'name' private or internal (Friend in VB, public private in C++) and provide a public or protected property to access it.
MSBUILD : warning : CA1823 : Microsoft.Performance : It appears that field 'Company.networth' is never used or is only ever assigned to. Use this field or remove it.
Code Analysis Complete -- 0 error(s), 8 warning(s)
Done building project "Information.vbproj".
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

Meaningless initializations, unused variables, public member variables... they get found. It's a great start.


Wednesday, 11 October 2006 09:33:04 (Eastern Daylight Time, UTC-04:00)  #    Comments [1]
# Tuesday, 10 October 2006

Are you ready?

It's time to launch Office, Vista, and Exchange in Canada. Five cities get a large version of the all day event, with business, IT pro and developer tracks, and seven get IT pro and developer talks only. It starts in late November and goes on until January. Registration is free and these things usually full up fast, so register now.


Tuesday, 10 October 2006 09:05:19 (Eastern Daylight Time, UTC-04:00)  #    Comments [0]
# Monday, 09 October 2006

I've been messing a lot with time zones lately, planning my trips to South Africa, Spain, and Denmark, along with flight connections through other countries, and trying to be sure that I correctly map the local times people tell me with the Eastern times I need to enter in my Outlook calendar. As part of that I found a neat time zone map at http://www.travel.com.hk/region/timezone.htm. Now time zone maps are not exactly hard to come by, but this one gave me some interesting insight.

Until I found this map I believed, in a vague never-bothered-to-check way, that Newfoundland was the only place whose time zones differered by half an hour rather than an hour from the neighbouring zones:

But this map uses that hash pattern to indicate the not-an-hour timezones, and so for the first time I noticed there are other places that do this too:


It's all over the place! But I wonder if people on the other side of the world would get the Canadian joke: The World Will End at Midnight! 12:30 in Newfoundland.


Monday, 09 October 2006 07:35:06 (Eastern Daylight Time, UTC-04:00)  #    Comments [2]