Use WMI Code Creator to explore the details of WMI

One utility has paid incredible dividends over the past few days (not only because it is free): WMI Code Creator. This small Microsoft-provided gem allows you to explore the entire WMI namespace, and will generate code (C#, VB.Net, and VBScript) based on what you select.

If you’re using WMI, this utility goes right along-side the WMI reference documentation on MSDN in terms of usefulness.

A free replacement for the Windows defragment utility

Defragmenting hard drives is something that is often unnecessary, but when it is necessary, most people run the built-in Windows “Disk Defragmenter” utility. It’s serviceable, but there is a better option: JkDefrag.

There’s a few things that make JkDefrag an improvement over what Windows offers:

  • It runs on anything that mounts like a disk drive — including USB drives and memory sticks.
  • You can run it from Windows, from a command line, or as a screen saver.
  • It offers several different optimization strategies.
  • It can be configured to defragment specific drives, files, or folders, or to exclude defragmenting specific drives, files, or folders.
  • You can run it in the background and tell it to run at less than full speed.
  • It’s continually developed by a person who you can actually talk to via an online forum.
  • There’s no installer — just extract files from a ZIP archive into a directory and run the executable.
  • It’s free, as in free beer, and open source.

Hats off to Jeroen Kessels for writing a fine utility and making it available for free. He doesn’t even ask for donations (too bad, because I’d have sent him a few bucks if he did!).

Free file archiving and (de)compression with 7-Zip [with expensive minimum donations]

In thinking about all the free and open source tools I use, one seems to run underneath the radar: 7-Zip.

7-Zip will compress, expand, encode, and decode more formats than you can shake a stick at. It integrates seamlessly with Windows Explorer, so you just right-click and choose the option you want, as shown below.


[That little fuzzy thing in the background is my dog, Thea. How I miss her!]

The fact that 7-Zip does so much and is free makes me wonder why anyone would pay $30 for a copy of WinZip. Instead, donate that money to Igor Pavlov, author of 7-Zip.

I decided to do just that. Heading over to the donate page for 7-Zip tells you that the “base donation amount is $50 or €40, but if you would like to donate more, just change the Quantity field”. Apparently, you can donate more than $50, but you can not donate less than $50 — donations must be whole-number multiples of $50.

This is a bit odd. I would think a minimum donation for a free product would be less than the retail price of a commercial product. I wonder how many people don’t donate due to this high number?

Considering that 99% of the archive files I receive are ZIP files, that Windows can compress and expand ZIP files (albeit slowly), and that minimum $50 price tag, I’m going to pass. If Mr. Pavlov would let me set a lower donation level, I’d be happy to oblige; until then, I have that weird feeling I get when there’s a minimum tip amount added to a restaurant bill.

I guess I’ll look for another free/open-source product to send my money to.

Cancel (and renew) WebEx MeetMeNow to save $10 per month

I recently tried WebEx‘s MeetMeNow service (14-day trial). When the trial expired, I figured I’d cancel it — not because it wasn’t good (it was) or because it was too expensive (only $49/mo), but because I wasn’t sure if I’d need it in the next 30 days, and figured I could just renew the subscription right before the next time I’d need it.

I clicked the Cancel link, and was given a special 20% offer to change my mind. OK, I changed my mind again — deciding to keep the service at the $39/mo price.

The tip here? If you want to save $10/mo using MeetMeNow, sign up for the free trial, then cancel, then accept the service at $39/mo. Can’t argue with the marketing — it snookered me in. 🙂

The ultimate launcher: Launchy

William of Bug this! Technie Journal writes about how he likes Vista’s start menu search feature, which lets you quickly find programs in the start menu (Tools that save you headache on trying to find your program in 100+ items start menu). I also liked the feature, and I agree with him in that the feature is not good enough to warrant a Vista upgrade. However, while he found a solution in Colibri, I prefer Launchy.

What does Launchy let you do? To understand, let’s look at some ways to open Remote Desktop Connection:

  1. Click Start, then All Programs, then Accessories, then Remote Desktop Connection.
  2. Press Windows-R to open a command prompt, then type mstsc, then press enter.
  3. Press ALT-Enter, type rem, then press enter.

Launchy screenshot#3 is Launchy in action. You can mistype commands, and it’ll still find reasonable matches — type reno and you’ll still likely find Remote Desktop Connection. Multiple matches? Choose from a drop-down list that puts the most recently used and best matches at the top. It’s super-productive.

With Launchy, here’s how I open Mozilla: ALT-Enter, moz, enter. Visual Studio? ALT-Enter, vis, enter. Cisco VPN Client: ALT-Enter, vpn, enter. This is very cool.

Thinking of how much I love Launchy reminds me that I’ve totally skipped the month of September in my drive to donate $5 per month to a free software product, so I’m going to donate $10 to Launchy — because it is that cool. My donation history to date far is as follows.

Thanks to Josh Karlin for writing such a great utility!

Forgot your Windows product key? It is recoverable…

I frequently rebuild my computer once Windows starts to reach its half-life, formatting the ‘ol hard drive and starting from scratch. Unfortunately, this typically involves a hunt for the Windows XP product key, which typically was written down on a piece of paper and subsequently misplaced. This time, however, I decided not to hunt for that sticky note. Surely, Windows XP knows the product key that was used when it was installed… right?

KeyFinder by Magical Jelly Bean SoftwareApparently, it does, and there’s a little piece of free software that can find it for you. KeyFinder by Magical Jelly Bean Software can identify the product key for Windows 95, 98, ME, NT4, 2000, XP, Server 2003, Windows Vista, Office 97, Office XP, and Office 2003 — on the local computer or on a remote computer (provided you have appropriate security permissions). Very impressive.

FileHelpers: the .Net way to import text files

I am working on a project where I have to import data from thousands of text files. These text files vary in formats: they use different delimiters; they use quoted identifiers never, sometimes, or always; they sometimes have missing end-of-row columns. Importing these took a combination of custom scripts (to clean up and reformat) and XML format files for SQL’s BCP (bulk copy) command… until I found FileHelpers.

FileHelpers by Marcos Meli is a .Net library which provides services to import and export text in delimited and fixed-length file formats. It takes a unique approach to the file import problem:

  • You write a class, giving it properties to store the data in the text file.
  • You apply attributes to the class and properties, describing the format of the file and applying import rules.
  • You import the file using a single command, which creates an array of objects populated with the data from the text file.

With support for custom converters, null types, optional fields, before/after import events, extensive parsing rules, and so much more — not to mention a web site with gobs of examples and documentation — FileHelpers has single-handedly driven me away from the script and batch file approach to a much more powerful .Net application to import my files.

The fact that FileHelpers uses regular .Net classes allows you to use the same class to both import data from a file and persist it to a database. For example, consider the following sample text file:

3,"Mary Jane",Brown

Clearly we have three fields in this comma-delimited file, so we write the following class to hold the data. Attributes provide instructions to FileHelpers — specifying that it is a comma-delimited file, and that the quotes in the first and last name fields are optional. (Note that you can use fields or properties; I use fields below for brevity.)

public class Person
	public int PersonID;
	[FieldQuoted('"', QuoteMode.OptionalForRead)]
	public string FirstName;
	[FieldQuoted('"', QuoteMode.OptionalForRead)]
	public string LastName;

Importing this file now becomes as easy as writing two lines of code.

FileHelperEngine<Person> engine = new FileHelperEngine<Person>();
Person[] records = engine.ReadFile(@"c:\myfile.csv");

You now have an array of Person objects loaded with data from the text file. Now, let’s say you wanted to persist these objects to a database. You can use the same Person object to persist to your database with an O/R mapper. If you were using Paul Wilson’s O/R Mapper and the WilsonORWrapper, you would decorate your class as follows:

[DelimitedRecord(","), IgnoreInheritedClass]
public class Person : WilsonORWrapper.Entities.EntityBase<Person>
	public int PersonID;
	[FieldQuoted('"', QuoteMode.OptionalForRead)]
	public string FirstName;
	[FieldQuoted('"', QuoteMode.OptionalForRead)]
	public string LastName;

Note I added the base class and the IgnoreInheritedClass attribute, which tells FileHelpers to ignore any inherited fields and properties (otherwise, the IsReadOnly property from EntityBase would be included).

With that, I can now persist all the records I read using FileHelpers back to my database using the O/R mapper.

FileHelperEngine<Person> engine = new FileHelperEngine<Person>();
Person[] records = engine.ReadFile(@"c:\myfile.csv");
foreach ( Person p in records )

Incredible! We can even add supporting logic. Let’s say I wanted to only insert new persons into the database. I could do this.

FileHelperEngine<Person> engine = new FileHelperEngine<Person>();
Person[] records = engine.ReadFile(@"c:\myfile.csv");
foreach ( Person p in records )
	Person pers = Data<Person>.Retrieve("PersonID = " + p.PersonID.ToString());
	if (pers == null)

FileHelpers makes this and so much more possible. It’s the backbone of a project I’m writing, and it’s making some heavy data-parsing much easier. To top it all off, FileHelpers is open source — you can download the code from their Subversion repository, and post patches on their support forums. Patches are well-received — I’ve already had two (1, 2) I’ve sent and had applied.

Thanks again to Marcos (and recently-added co-developer, Matt Campbell) for providing this fantastic library. For regular updates, be sure to read the FileHelpers Library Blog.

Supporting free software: TortoiseSVN

It’s a new month, which means it’s time for me to pick a free, open source product to donate to. This month was an easy decision: I picked the product that I use every day to manage my code (and code history): TortoiseSVN.

I’m not the only one who’s ga-ga over TortoiseSVN; they recently were declared the Best Tool or Utility for Developers by the folks at SourceForge. With Subversion being the de-facto source code management standard (even Microsoft is starting to pay attention to it), it’s no surprise that TortoiseSVN is so widely loved.

I’m happy to have joined the list of those who’ve donated to TortoiseSVN!

My donation history to date far is as follows.

Supporting Free Software: FileZilla

Last month, I announced that I’ll start donating $5 per month to a free and/or open source project. The first donation went to OpenOffice. This month, the donation goes to FileZilla, the free, open-source FTP client.

FileZilla is one of those utilities that you take for granted. It works so well that you tend to not think about it. There’s barely a day that goes by when I don’t fire up FileZilla at least once. Granted, there are plenty of FTP clients out there, and I’ve used many, but none satisfied me as much as FileZilla.

Thanks to Tim Kosse for starting and maintaining FileZilla over the years.

A free Offline NT Password and Registry Editor

From time to time, the open source/freeware community comes along with a product so simple and so frightening that it makes me smile. This is one that’s been around since 1997, but somehow I never stumbled across it.

A fine Norseman, Petter Nordahl-Hagen, wrote the first version of his Windows registry and password hacker back in 1997. He’s updated it continually over the years, and today the Offline NT Password & Registry Editor is available as a free download. (It works with Windows 2000 and Windows XP as well as Windows NT, so don’t let the name fool you.) The Web site includes an excellent FAQ and the source code, should you choose to confound yourself further.

Why is this frightening? Because after all the years of Microsoft touting security, there’s still a freelance programmer that can beat the billion dollar behemoth.