August 5, 2005 Fun

I Love Arguing with Ian

Ian and I submitted the final manuscript for Programming Avalon, Beta Edition, on July 13th (right on time, I’ll point out). Since then, the O’Reilly folks have been working overtime to fix my prose (I’m not a big fan of editorial guidelines or templates). As part of that process, they sent Ian and me a 400+ page PDF file for us to check. In the process, I submit changes to the manuscript, Ian argues about the ones with which he disagrees and then I argue with his arguments. It’s great fun.

Here an excerpt in which we’re arguing over a single word that has nothing whatsoever to do with the technical content of the book while two professional editors from ORA watch, waiting for us to decide:

Page 51:  You want to change “breathing space” to “breathing room”?  Why?  The term “breathing space” is a common idiom.  (And judging by Google, that’s not just a UKism.)  I prefer it to “breathing room”, so unless there’s a good reason to change I’d prefer to leave it.

[csells] googlefight shows “breathing room” to be slightly more popular than “breathing space,” plus I’d never personally heard the latter. Also, you use the word “space” in a close previous sentence and I liked the variety.

Here we’re arguing over a single word again and, to help make my argument, I claim super powers:

Page 205: Why do you want to change “useful” to “handy”? Is there something wrong with “useful”?

[csells] because you use the word “used” later in that same sentence. Having “useful” and “used” so close together made my spider sense tingle.

Here we’re dealing with the vagaries of our personal styles and my preference for brevity (Ian can highlight a single word and write several paragraphs on it, while I like to highlight several paragraphs and comment “huh?“). In this case, I circled an URL and said “too big:”

Page 222: Yes it’s a big URL, but there’s not a lot I can do about that — if you can convince Microsoft to make a smaller URL in the next day or so, please do.  There’s a shrinkster URL in there too, so I don’t see what the problem is.  And I’m not going to agree to removing the original URL.

[csells] I didn’t say it was a *long* URL (I can hardly blame you for that, Ian : ); I said it was a *big* URL. What I meant was, the font looks too big in comparison to the size of the fonts around it.

Here we’re arguing over grammatic style, again, while two professional editors look on, letting us fight it out like children in the backseat of the car on a family vacation:

Page 224: I’m not quite sure what you’re proposing as the new text here, although I do see the problem.  How about:

“(It doesn’t matter where the UICulture element appears within this section.)”

[csells] I’m suggesting that I prefer parenthetical comments to be part of the sentence, e.g. “Foo sucks (and by ‘sucks,’ I mean ‘blows’).” You tend to do it the other way and I find it jarring, e.g. “Foo sucks. (And by ‘sucks,’ I mean ’blows.’)” Plus, there’s the matter of consistency, i.e. I do it in the former way in my writing and you do it in the latter way in yours; we should pick one and stick with it (and to be clear — we should pick my way : ). Unfortunately, I packed my Strunk & White, but I have every confidence that they got it right, too. : )

In this case, after reading several hundred pages of the book again, I was getting a little punchy, so I highlighted a Bezier curve, redrew it by a couple of pixels and suggested that after doing the math in my head, I feared a bug in Avalon’s rendering of Beziers; could ORA check it with their Cray?

Page 252: Well those were all drawn in Avalon using the exact positions chosen for the control points.  Also, I’ve been using Bezier curves for about 15 years now, and they all look exactly as I’d expect them to look.  I just cranked up Illustrator on the Mac.  It seems to agree with Avalon…  So does Acrylic.  What maths are you doing that indicates a different result?

[csells] I was just teasing. If my mention of the use of a Cray wasn’t enough, didn’t the bit about me doing the math “in my head” tip you off? I am delighted to know that you spent time double-checking things, however. : )

See? Big fun! : )

August 3, 2005 Tools

WinFX Beta 1 Online SDK Docs

July 28, 2005

Don Box Slept Here

July 27, 2005 Spout

Limiting/Monitoring my sons’ access to the ’net?

My 11-year old wants to do email and IM and he’s already surfing the web. Does anyone have any recommendations for good software to limit and monitor his internet access? Thanks!

July 22, 2005 Tools

Cool Avalon Default Style Trick

Karsten shows a cool trick for pulling out the default style of an Avalon lookless control. This is super useful if you want to replace an existing control's look, but you don't want to have to start from scratch.
July 20, 2005 Fun

Have Sex With Prostitutes at the PDC

At least that's the message I'm getting from the 2nd episode of the Channel 9 guy’s trip across country to the PDC (I'm not saying that's a bad message -- it sure beats the whole "ActiveX" thing...).
July 17, 2005 Fun

I don’t know who has time for this stuff @ work…

but it’s fun anyway…

[Scoble]

July 16, 2005 Spout

My First MsBuild Task

I wrote my first custom msbuild task this morning. I used the the Extend the MSBuild with a New Task topic from the msbuild wiki and it worked well to get me started. I started with the simplest thing that used at least an input property:

// HelloTask.cs
using System;
using Microsoft.Build.Utilities; // reference assembly of same name
using Microsoft.Build.Framework; // ditto

namespace MyFirstTask {
  public class HelloTask : Task {
    string _who;

    [Required]
    public string Who {
      get { return _who; }
      set { _who = value; }
    }

    public override bool Execute() {
      Log.LogMessage(string.Format("hello, {0}!", _who));
      return true;
    }
  }
}

My task implements the msbuild ITask interface by deriving from the Task helper base class, which provides the Log object, among other things. The only thing I have to do is implement the Execute method, which needs to return true on success. To prove that my task is called, I use the Log object to log a message (I could also log an error or a warning). The public Who property is set from the use of the task in an msbuild file. By marking the property with the Required attribute, I ensure that msbuild itself makes sure that a Who is provided.

Once I’ve compiled my task, I can use it directly from a .proj (or .csproj or .vbproj) file:

<!-- fun.proj -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="HelloTarget">
    <HelloTask Who="Joe" />
  </Target>
  <UsingTask
    TaskName="MyFirstTask.HelloTask"
    AssemblyFile="C:\MyFirstTask\bin\Release\MyFirstTask.dll" />
</Project>

Notice the HelloTask element, which creates an instance of my HelloTask class and sets the Who property. The mapping between the HelloTask and the MyFirstTask.HelloTask class in the MyFirstTask.dll assembly is in the UsingTask element. Running msbuild against fun.proj yields the following output:

C:\taskfun>msbuild fun.proj
Microsoft (R) Build Engine Version 2.0.50215.44
[Microsoft .NET Framework, Version 2.0.50215.44]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Build started 7/16/2005 7:04:09 PM.
__________________________________________________
Project "C:\taskfun\fun.proj" (default targets):

Target HelloTarget:
hello, Joe!

Build succeeded.
0 Warning(s)
0 Error(s)

Time Elapsed 00:00:00.04

Notice the “hello, Joe!” output by the task as its Execute method is called. Notice also that while the task is in its folder, the .proj file can be anywhere, so long as it has a UsingTask that maps appropriately. By convention, the UsingTask elements are kept in .targets files and put into shared folders to be used between multiple project files, e.g. Microsoft.common.targets, etc. Refactoring the UsingTask out of the .proj file and into a .targets file looks like this:

<!-- My.Fun.targets -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask
    TaskName="MyFirstTask.HelloTask"
    AssemblyFile="C:\MyFirstTask\bin\Release\MyFirstTask.dll" />
</Project>
<!-- fun.proj -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="HelloTarget">
    <HelloTask Who="Joe" />
  </Target>
  <Import Project="c:\My.Fun.targets" />
</Project>

Of course, a real task does far more than this one, but it was hella easy to get started.


← Newer Entries Older Entries →