You are invited to ScaleCamp 2010

Very pleased to receive this email today:

From: Michael Brunton-Spall
Sent: 19 November 2010 16:07
To: Matthew Skelton
Subject: You are invited to ScaleCamp 2010 – 10th December at the Guardian offices, London

Hey,

We are so pleased to be able to invite you to Scale Camp 2010 on the 10th December at the Guardian Offices here in London.

I’m looking forward to some great conversations and debate, particularly around DevOps and how that can contribute to scaling a software platform.

WMIC – command-line control of WMI functions

Before Windows PowerShell and all the flexibility (and complexity) that brings, there was WMIC, the command-line client for WMI.

WMIC works out of the box with Windows XP and later (including Server 2003 and Vista), and allows access to operations provided via WMI: “a powerful, user-friendly interface to the WMI namespace”. Upon first use, the WMIC environment is installed:

C:\> WMIC

Please wait while WMIC is being installed...

Several tasks which normally feel very GUI-oriented, such as checking the battery status, are made very “command-line” with WMIC:

C:\> WMIC Path Win32_Battery Get BatteryStatus /Format:List

BatteryStatus=1

In this case, the batter is discharging. You can see the beginnings of PowerShell in the syntax and detailed status/operations available. Another useful command is useraccount, to return details of the user accounts on the system:

C:\> WMIC useraccount list brief
AccountType  Caption                  Domain     FullName       Name   SID
512          SKELTON-M\Administrator  SKELTON-M  Administrator         S-1-5-21-68**03330-*********-839**2115-500
512          SKELTON-M\Guest          SKELTON-M  Guest                 S-1-5-21-68**03330-*********-839**2115-501
...

Or how about terminating a specific process (notepad.exe) from the command-line? Here we go:

C:\> WMIC process where name='notepad.exe' call terminate

Executing (\\SKELTON-M\ROOT\CIMV2:Win32_Process.Handle="4652")->terminate()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 0;
};

It’s helpful to install the WMI Administative Tools, so you can explore the WMI namespace and investgate the operations available to you via WMIC. For example, to determine the name of the time zone currently used by the system, use the TimeZone path:

C:\> WMIC Path Win32_TimeZone Get StandardName /Format:List

StandardName=GMT Standard Time

The time zone for my computer currently is “GMT Standard Time”.

For simple operations which do not merit PowerShell scripts or installation, WMIC is a good choice.

Microsoft Application Blocks

Microsoft Application Blocks form a collection of ready-built ‘clumps’ of code which solve common problems such as security management, data access, logging, etc. They are the tangible result of the Microsoft Patterns and Practices advice: all of it sound and solid.

John Jakovich, one of the 4 Guys From Rolla, gives a useful An Introduction and Overview of the Microsoft Application Blocks. He summarises the utility of the Application Blocks thus:

…you don’t have to worry about the tedious details required to return a DataReader or write an exception to the System Log. This allows us to concentrate on the business logic in our applications.

I have written too many logging frameworks in the past: it’s boring above all else. I just want to log exceptions in a thread-safe manner, with a unique ID.which I can display to the user if necessary. If someone (i.e MS) has already written code to do (most of) this, then fine – I’ll use it.

The Security block is particularly useful for ASP.NET 1.1, where security and profile management is not as simple as in version 2.0. All that boring stuff about storing Role information in cookies? Solved! Better still, any security holes will be fixed by MS. Again, more time to concentraste on business logic.

Design Guidelines for Class Library Developers

The Application Blocks tie in nicely with a set of guidelines from MS on class library development. They include advice on:

  • array usage
  • exposure to COM
  • casting
  • threading

and several other subjects. This is basically just a gloop of Common Sense, but well worth a read.

MBR BootFX Application Framework

An alternative to the MS Application Blocks comes from Matt Baxter-Reynolds (he of DotNet247) in the form of BootFX:

The MBR BootFX Application Framework is a best-of-breed application
framework that we offer to all our clients who engage us to develop
software applications or software components for them. It’s designed
to give us a “leg up” on new projects by providing a tried and tested
code base for common software development activities.

There are lots of goodies there, including Object Relational Mapping (ORM), and support for SQL Server, Oracle, and MySQL databases. To top it all, it’s open source, via the Mozilla Public Licence 1.1. I met Matt 18 months or so back at a seminar run by Iridium; very personable guy.

Tracking Exceptions in Web Services with GUIDs

Note: This article first appeared in CVu Issue 17.5 (October 2005). CVu is the journal of ACCU, an organisation in the UK dedicated to excellence in software programming. Some links may not work.

Synopsis

This article demonstrates a technique for tracking exceptions across process boundaries in distributed systems using Globally Unique Identifiers (GUIDs); data from log files, bug reports, and on-screen error messages can then be correlated, allowing specific errors to be pinpointed.

Particular attention is paid to XML Web Services, with additional reference to DCOM, CORBA, Java/RMI and .Net Remoting.

The examples are given in C# [.NET 1.1], but the technique can be applied easily to Java and other languages.

Continue reading Tracking Exceptions in Web Services with GUIDs