Monday, October 25, 2004

KB Article 307340 - At least I tried to get it fixed

Anyone with even a basic understanding of the complexitites of performance diagnosis knows that performance problems come from many different factors. Highlighting one potential cause of performance problems without even mentioning others (particularly in an official communication like a KB article) doesn't seem overly wise to me, and I put in some correspondance through the MVP program internal newsgroups on KB article 307340 - PRB: High CPU Utilization in Web Service or Web Form on these grounds.


What I said was:

KB article 307340 (PRB: High CPU Utilization in Web Service or Web Form
http://support.microsoft.com/default.aspx?scid=kb;en-us;307340&Product
=aspnet) isn't an overly helpful article. Suggesting that it is
reasonable to correlate high CPU utilization on a web server with string
concatenation in the absence of any other supporting information is totally
unreasonable, and very unhelpful to the IT administrators charged with
diagnosing and fixing a run-away CPU problem, and the developer whose code
is running on the box.


IMO, the article should be scrapped entirely, or at a minimum, expanded to
included:


* a very clear statement that there are many other problems that can cause
this problem totally unrelated to string concatenation.


* include the Perfmon counters that can be used to test whether the problem
is string concatenation related. Looking at the ratio of generation 0
collections to gen 1 and gen 2 (a ratio of around 1 to 10 should exist
between the each generation step, excessive gen 0 collections indicate the
creation and collection of an excessive number of short lived objects) and
the % time in GC counter, all of which are available on the .NET CLR Memory
performance object.


* a link to the CLR profiler on MSDN so that string concatenation hypothesis
can be conclusively proved if perfmon backs up the assertion.



The response I got was that the article was technically accurate and will not be changed. After going to the effort of providing a fair amount of further information that could have enhanced the article, I'm disappointed that they choose not to include it. I've personally come across two occasions where this article has caused people to fly off to a conclussion without even attempting a proper diagnosis, and given this is one of the few articles that the Knowledge Base published on .NET performance, I would have hoped it would be a lot better.


Well, at least you are warned now...

Sunday, October 24, 2004

Learning More Technology Than You Can Poke a Stick At

I'm currently all over the place in terms of the technology I'm focussing on. I'm working pretty hard on a large project for a client where SQL Server DTS 2005 is going to be a key technology, so I'm focussing on learning and understanding this technology during working hours.


Out of hours, I'm going through the C# 2.0 spec and other related material in detail getting ready for the update of Eric's book. Also, I'm doing the C++ column for internet.com, and have been looking at STL.NET and CodeDOM in Managed C++.


I also do some work for the local Microsoft office, and I've got the Whidbey Ascend training on C#, C++ and BCL enhancements coming up in early November. The material comes pre-canned, but it is still a bit of work to make sure it is all familiar. In addition, I'm touring Australia and New Zealand in mid-December talking on WSE 2.0 at user groups, and this is a slide deck I'm preparing from scratch.


As you could imagine, I'm not doing as many photos as I'd like. I did get this waterfall in the Royal National Park south of Sydney in full flow (thanks to Sydney's big wet) at sunset last week.


Saturday, October 16, 2004

Updating A Programmer’s Introduction to C# for C# 2.0

I've recently signed on to do the updated version of A Programmer's Introduction to C# for Apress. The first two editions of this book were written by Eric Gunnerson, who was the C# PM, but announced in September has was moving to another team in Microsoft. Gary emailed me to see if I was keen to do an updated version of the book, and being a big fans of Eric and the first two versions of the book, I happily agreed.


I'm getting together a revised TOC at the moment. The stuff in black is the TOC of the second edition of the book, and the stuff in red is what I plan to add. Any comments or feedback would be welcome.



Chapter 1 Object-Oriented Basics

Chapter 2 The .NET Runtime Environment

Chapter 3 C# QuickStart and Developing in C#

Chapter 4 Exception Handling

Chapter 5 Classes 101

Chapter 6 Base Classes and Inheritance

Chapter 7 Member Accessibility and Overloading

Chapter 8 Other Class Details (including static classes)

Chapter 9 Structs (Value Types)

Chapter 10 Interfaces

Chapter 11 Versioning and Aliases

Chapter 12 Statements and Flow of Execution

Chapter 13 Variable Scoping and Definite Assignment

Chapter 14 Operators and Expressions

Chapter 15 Conversions

Chapter 16 Arrays

Chapter x Generics

Chapter 17 Strings

Chapter 18 Properties (including property accessors)

Chapter 19 Indexers, Enumerators and Iterators

Chapter 20 Enumerations

Chapter 21 Attributes

Chapter 22 Delegates and Anonymous Methods

Chapter 23 Events

Chapter 24 User-Defined Conversions

Chapter 25 Operator Overloading

Chapter x Nullable Types

Chapter 26 Other Language Details (including partial classes and inline warning control)

Chapter 27 Making Friends with the .NET Frameworks

Chapter 28 System.Array and the Collection Classes (including System.Collections.Generics)

Chapter 29 Threading and Asynchronous Operations

Chapter 30 Execution-Time Code Generation

Chapter 31 Interop (including fixed size buffers)

Chapter 32 .NET Frameworks Overview

Chapter 33 Windows Forms

Chapter 34 DiskDiff: More Sophistication

Chapter 35 DiskDiff: Making It Useful

Chapter 36 Deeper into C#

Chapter 37 Defensive Programming

Chapter 38 The Command Line Compiler

Chapter 39 C# Compared to Other Languages

Chapter 40 C# Resources and Futures

Thursday, October 14, 2004

customErrors mode="Off

Glad I'm not the only one the occasionally stuffs this up on a live site:


A Week In Perth

I've spend the last week in Perth with my family visiting the in-laws. The weather was pretty miserable the whole week, and there where very few photo opportunities. We took an overnight trip up to the Pinnacles, which are one of WA's marquee photo locations, but the light was pretty crook, and I didn't get any good shots despite spending sunset out there. The Pinnacles are a pretty amazing place - the 4WDs in the background of this image give some scale to the size of the place:


.


The performance of the Canon 28-300 lens that I got just prior to the trip was one of the bright points of the trip (outside being able to spend a relaxing week with the family). As you'd expect from an L-series lens, the pictures where sharp over the entire zoom range, and 28-300 covers so a wide range of photographic situations, I didn't switch to another lens the entire trip. If you don't mind the weight, its an awesome lens.


I also caught up with Nick Randolph, who runs the WA .NET Community of Practice. Nick is a great guy, and it is good to hear a perspective on what is happening in .NET outside Sydney.

Friday, October 08, 2004

First Developer.com article up

I'm doing a C++ column on Developer.com. Not sure of the regulaity, but I am aiming for monthly. The results of my first effort are up at here.

Sunday, October 03, 2004

Whidbey C++ - Easier than C# in a number of areas

I've got a few C++ sessions and columns coming up over the next couple of months for Microsoft Australia and as part of a new C++ column I'm doing for Developer.com, and have used this as motivation to begin to really understand where C++ is going in Whidbey. Like everyone else (or so it seems), I am no fan of Managed C++, and had to give it up when my underscore key broke due to overuse. All the C/C++ I have done over the past couple of years has been getting code bases to the point where they could be called with P/Invoke or COM interop from pure managed applications. While I think I got to the stage where I understood Managed C++ well enough to program in it, I had zero confidence that any Managed C++ I produced would be maintainable by the folks I left behind when my engagement with an organisation was done.


Anyway, enough Managed C++ bashing. The new C++ language extensions coming in Visual C++ 2005 are really good. While they resemble C# more than Managed C++, they are a long way from a poor-mans C#, and actually makes some programming tasks a lot easier than C#. The two primary benefits are deterministic clean-up of disposable objects that are logically located on the stack (via the injection of a using statement by the compiler), and the ability to declare trivial properties in a single line (eg. property string Name;). While this seems like a minor feature, it cuts down on the amount of pasted get and sets that end up in a method, and is something that C# really lacks. I asked Anders about this features at the MVP conference last April, and got an unenthusiastic response.


If you are coming from a Visual C++ 6.0 perspective, the language looks really clean and immediately understandable. Given the great interop capabilities of C++, and the fact that it will be a really first-class experience for developing .NET applications, I'd expect to see most of those still in the 6.0 product moving into Visual C++.NET (even if they stick to native code) with this release.

No time to blog - photographing

I've spend most of my non-work time that I usually devote to .NET pursueing photography. I'm loving the 1D Mk II, though the one issue that I have found annoying is the sensor dust issue. For a camera series as robust as the Canon 1, the fragility in the face of sensor dust is annoying.


I've done a few prints over the long weekend - here are a couple of my favorite images so far: