Power Tools Gear
March 24, 2005
By Karen Kenworthy
IN THIS ISSUE
Longtime visitors will remember lovely Monica.
I've known her since she was a precocious child, carefully speaking in elegant, fully-formed sentences when her cohorts communicated using a combination of grunts and shouts. Later, as an accomplished teenager, she made order out of the chaos of the secluded Power Tools workshop. Then, four short years ago, she married her beau, Bill. Monica quickly retired to the contemplative life of motherhood and running a household, while Bill found gainful employment in a peculiar industry known as "computer network administration".
From time to time, someone will ask "how are Monica and Bill?" I'm happy to say they're now the parents of two beautiful children. Little Will turned two last September, and is a typical jet-powered boy. The newest member of their family, precious Heidi, was born just five weeks ago. She looks just like her mother, which is to say she's breathtakingly beautiful.
I'll never forget the first time I held Heidi or Will (or any of my 11 nieces and nephews) in my arms.
Unfortunately, my memory isn't so reliable when it comes to other things. For example, not long ago I forgot an important lesson I learned just four years ago.
You've probably noticed that some programs display "tabs". Arranged across the top of a window, these tabs make windows resemble stacks of file folders. Click a tab, and the contents of the window changes. Programmers use tabs for a very simple reason. Even today, with monitors growing larger and larger, screen real estate is a scarce resource. Tabs let us display more information in less space.
Because tabs are so useful, Microsoft provides tools that help programmers add them to their programs. In fact, for programmers writing in the Visual Basic language (like myself), Microsoft offers two tab tools.
Both tools, called "controls", have their own advantages. And each has its own quirky disadvantages too. For example, one control can create two styles of tabs -- chunky rectangular tabs, or graceful rounded tabs. The other can only displays blocky sharp-cornered tabs.
Another difference isn't visible to users of a program. But it's very apparent to programmers. When a user clicks a tab, one control automatically displays the corresponding information, hiding the on-screen items that belong to other tabs.
The other tab control simply announces "Hey! The user clicked a tab". The work of hiding and displaying the appropriate information, in response to this event, must be carefully hand-coded by a hardworking, under- appreciated programmer.
Weighing all the differences, which control should a programmer use? It might seem to be a coin toss.
But, as reader Michael D. Lawler recently reminded me, there's a very important reason to choose one particular control. Only one control works well with "screen readers", software that blind or visually impaired folks depend on to hear what's on their computer screens.
Screen readers are remarkable programs. They use computer-generated speech to read aloud any text displayed on a computer screen. The also use this voice to disclose the presence, and state, of buttons, icons, and other denizens of our computer displays.
Can't hear? No problem. Some screen readers allow user's to feel the information, by sending the necessary commands to a special Braille display device.
Despite their power, screen readers need a little help. Programs, and the controls they use to draw on-screen gadgets such as buttons, lists, and even tabs, must cooperate. When asked, they must disclose the text they display, and the current state of all their on-screen gadgets.
And that's where one of Microsoft's tab controls comes up short. Only one control shares the information screen readers require. The other tab control ignores requests for its internal details.
Unfortunately, when revising some of my programs, I inexplicably replaced the tab control that works with screen readers, with the one that doesn't. Maybe I was tired of working around one control's eccentricities, and thought it would be fun dealing with the other for a change. Perhaps I was seduced by the deficient control's retro-look tabs. Whatever the reason, I made the wrong decision, and I've spent the last few days reversing it.
The results of my efforts are new versions of my Directory Printer, WhoIs, and URL Discombobulator. Each now minds its manners, getting along well with others -- especially screen readers. :)
[Nerdy Note: The programmers among us may want to know that the tab control that breaks screen readers is the "Microsoft Tabbed Dialog Control", contained in the support file named TABCTL32.OCX. The compatible control is part of the Microsoft Windows Common Controls suite, supported by the file MSCOMCTL.OCX.]
Along the way, I also updated another Power Tool, my Disk Slack Checker. You might remember this little program. It scans disks, measuring space. Among other things, it determines how much space is put to good use storing files, how much is free for future use, and how much space is wasted.
The wasted space, sometimes called slack space, arises from the way Windows assigns disk space to our files. You see, before a program can save our favorite document, picture, or other file to a disk, it must first ask Windows for a bit of its free disk space.
Windows doesn't mind allocating disk space. But Windows is a busy program. It doesn't have time to answer countless requests for more disk space. Windows also has a bookkeeping problem. How do you keep track of billions of bytes of disk space -- which ones are in use, and which file is stored in each?
To help solve both problems, Windows resorts to something called "clusters" (also called an "allocation units"). Put simply, a cluster is the smallest amount of disk space Windows will provide. Ask Windows for just one single byte of disk space, and you'll receive a full cluster -- anywhere from 512 bytes to 32 thousand bytes or more.
Thanks to clusters, a program doesn't have to request more space until it's completely filled the cluster it first received. And Windows has less to remember, only tracking each cluster, instead of each byte of our ever- growing disk drives.
Windows wins big under this scheme. But there is a price to pay. Because programs may be given more space than they need, not all allocated space is being used at any given time. In fact, on average, every file on disk has been allocated one half of a cluster of space that it doesn't currently need or use.
But averages can be deceiving. Sometimes the data in a file fits exactly into one or more clusters. In those cases, no space is wasted. Other files may need only one byte of the last cluster they've been given. In those cases, the wasted space is almost a whole cluster (less the one byte actually used).
Sorting out these real-world details is the job of the Disk Slack Checker. It examines a disk drive, computing the amount of disk slack space assigned to each file. When its search is finished, it displays the total amount of disk space that is currently being wasted.
It also displays lots of other interesting numbers. These include a drive's free space (space not yet allocated), and the total amount of space being used to store real data. The program also reports the average amount of slack space per file, the average size of your files, and more.
Taking Up Slack
Once you've gathered all these bits of disk drive trivia, what's next? Well, that's not an easy question to answer.
Of course, you can show the data to your friends. It's sure to make you the life of their next party. But, if you'd like to reclaim your wasted space, your options are limited and not nearly as much fun.
If your version of Windows supports drive compression (the ability to compress an entire disk drive), you can enable that option and completely eliminate all slack space. That's because drive compression software (such as Microsoft's old DoubleSpace) completely compress slack space, reducing it to nothing.
If drive compression isn't an option, you can still shrink slack space by reducing cluster size. Remember that slack space is caused by clusters, and the size of a cluster varies? Big clusters waste lots of space. The smaller the cluster, the less space will be wasted.
Newer versions of Windows (Windows 2000, Windows XP and Windows 2003) automatically use small clusters (usually 512 bytes). To take advantage of this efficient allocation, just make sure your drives are using "NTFS" (New Technology File System).
It's easy to discover your drive's file system. Just right-click the drive's icon in "My Computer", then select Properties from the context menu that appears. On the Properties dialog's "General" tab, look for the line that begins with "File system:". If the letters that follow are "NTFS", that's good. Windows is probably allocating disk in small, space- saving clusters.
But if the file system is FAT (File Allocation Table) or FAT32, cluster sizes are probably larger and more wasteful. Under this system, clusters are modest (usually 1,024 to 2,048 bytes each) when drives are small. But with today's high-capacity drives, clusters swell to 32,768 bytes or more!
If you're using one of the FAT file systems, and your Windows supports NTFS file systems, you can save space by converting your file system to NTFS. Look for an entry on your Start Menu at Accessories|System Tools for a utility that can make this conversion. You'll get lots of other advantages too, including file encryption, file compression, and increased security.
If you have an older of Windows -- one that doesn't support NTFS -- there are two ways you can reduce your cluster size. Disk utilities such as Partition Manager (Paragon Software Group) and Norton PartitionMagic (Symantec) can, within limits, order Windows to use smaller (or larger) clusters.
They can also divide your drive into two or more "partitions", regions that appear to be separate drives. Since each partition holds only a fraction of the space of the physical drive, the size of the partition's clusters are smaller too.
Wow! I'd hoped to tell you about some changes to my WhoIs program, helping it load more quickly. I've made changes to my Drive Info program too, teaching it to display lots more information. But that will have to wait until later. Hope I don't forget. :)
In the meantime, if you'd like to put the new versions of my URL Discombobulator, WhoIs, Directory Printer, Disk Slack Checker, or Drive Info through their paces, drop by the programs' home pages at:
As always, all programs are free for personal/home use. If you're a programmer, you can download their Visual Basic source code too!
Better yet, get the latest version of every Power Tool on a brand-new, shiny CD. You'll even get three bonus Power Tools, not available anywhere else. The source code of every Power Tool, every issue of my newsletter, and some articles I wrote for Windows Magazine, are also included. And owning the CD grants you a special license to use all my Power Tools at work.
Best of all, buying a CD is the easiest way to support the KarenWare.com web site, Karen's Power Tools, and this newsletter! To find out more, visit:
Until we meet again, remember to hug your babies. And if you see me on the 'net, be sure to wave and say "Hi!"