Thursday, December 07, 2006

Testing Times

I'm sitting the 70-536 (Microsoft .NET Framework 2.0 – Application Development Foundation) exam tomorrow, and I sincerely hope that it's of a higher quality than the learning materials Microsoft provide for it. I've been testing myself using the official MCTS 70-536 Training Kit, and running the example tests provided.

What's disconcerting is that some of the questions are just plain wrong; here's an apposite example:

Which of the following code samples is the most efficient and compiles correctly?

  1. string s = null;
    s = "Hello";
    s += ", ";
    s += "World";
    s += "!";

  2. string s = null;
    StringBuilder sb = null;
    sb = "Hello";
    sb += ", ";
    sb += "World";
    sb += "!";
    s = sb.ToString();

  3. string s = null;
    StringBuilder sb = null;
    sb.Append("Hello");
    sb.Append(", ");
    sb.Append("World");
    sb.Append("!");
    s = sb.ToString();

  4. string s = null;
    s = "Hello";
    s += ", ";
    s += "World";
    s += "!";

So what's the correct answer? Not only do we have two identical options (1 and 4), but they also happen to be the only ones that will compile and execute. 2 is wrong because StringBuilder doesn't accept the "=" or "+=" operators, and 3 also shares the problem that the StringBuilder is never instantiated. Guess which option the test exam says is correct?

Can't say it fills me with much confidence for tomorrow...

 Thursday, November 30, 2006

Elevate Privileges Shortcut

I stumbled across a useful shortcut in Vista for elevating privileges; often you'll need to run a command prompt or another application as an administrative account (if you want to run bcdedit for example). One way is to bring up the Start menu with the Windows key, and type cmd (or the name of the application you want to start) - in a moment you'll see an icon for the command prompt. You can then right click the icon to get the "Run as administrator" option, or (and this is the useful bit!) simply press Shift-Control-Enter to execute as opposed to just Enter to execute and you'll be prompted by the ususal User Account Control dialog.

So, to recap:

  1. [Windows Key]
  2. Type name of application or executable name
  3. Shift-Control-Enter

Unfortunately this shortcut doesn't work with the Run dialog ([Windows] + R)

 Wednesday, November 22, 2006

And What Have You Done With My Body, God?

I've just finished having my mind mangled again for the umpteenth time by the Art Of Noise - probably one of the most infuential 'bands' of the 1980s, or at least before Anne Dudley, J. J. Jeczalik and Gary Langhan jumped the good ship ZTT and went their separate ways with China Records becoming a pastiche of themselves leaving Trevor Horn and Paul Morley behind. "And What Have You Done With My Body, God?" is a 4 CD box-set that covers their crucial period at ZTT, charting the initial foolings with the Fairlight CMI and found sounds to the highly polished released articles (Into Battle With and Who's Afraid Of). At times joyful, playful - sometimes tranquil and downright beautiful - and others surreal and disturbing, this is a fantastic collection of work.

This will leave some listeners cold; there are numerous versions of Beat Box, and the noodlings that were to become the definitive Beat Box (Diversion One) - various different takes on Close (To The Edit) culminating in the monumental twenty minute session that is "Diversion Eight, Diversion Two, Closest, Close-Up, Close (To The Edit), Closed" on CD4 - and not forgetting Moments In Love which appears in no less than four different variations.

But for those interested in the evolution of a band on the cutting edge of technology as they were during 1983 to 1985, this is essential listening.

 Monday, November 20, 2006

One Born Every Minute

Good to see that the scalpers are out in force on eBay, proving that you can sell any old crap; how about a boxed copy of Windows Vista RC1? Sheesh... (You've gotta love the comment - "This is a prerelease versaion[sic] of Windows vista , works perfectly "!)

Monad Moanin'

Last week, Microsoft quietly released Windows Powershell 1.0 (formally known as Monad) to the world. This is a great piece of technology that's worth taking some notice of - it's destined to become my Windows shell of choice; at least when a version for Vista is released. As it is, I'm stuck using it on my development laptop (running XP SP2). Previously, if I needed to do any form of complex scripting on a Windows box, I'd install Cygwin and knock something up in bash. Powershell will now take preference however; it ties in the .NET Framework with a scripting environment, so it gives me a library that I'm already familiar with (and one that I'm likely to be staying with for some time). As a quick example, how to display the number of days until Christmas using Powershell:

[String]::Format("{0} days until Christmas!", ([DateTime]"25 Dec 2006" - [DateTime]::Now).Days)

That's not to say that Cygwin is coming off my systems any time soon, I like having the GNU toolchain available (I'd be lost without rsync, ssh and wget), but for day to day scripting it'll be Powershell.

When it's available for Vista that is!