January 16, 2004

By Karen Kenworthy

IN THIS ISSUE

That settles it. I'm staying put.

The secluded Power Tools workshop seemed a bit less secluded lately. More and more folks are moving nearby. I began to think the time had come to pack my tools and elves, and move to more secluded pastures.

Mars seemed like the ideal spot. Sure, at minus 150 degrees Fahrenheit (about minus 100 Celsius), it is slightly cooler than hereabouts -- even during the recent cold spell. But you couldn't beat Mars for solitude.

Or so I thought. It turns out Mars is crowded! It's become the "Disneyland of the Inner Solar System." Every few days a new spacecraft takes up residence on or around the "Angry Red Planet". First the Japanese flew by. New arrivals from Europe and America are circling overhead. The Brits dropped in the other day. And now the Americans have landed one vehicle, with another trailing just a behind.

Desolate pictures sent back by those tourists don't tell the whole story. If you look closely, you can just make out the Beagle 2 in the distance. Apparently he's slipped his leash, and has gone feral. Run off with the missing Mars Polar Lander, if you ask me.

Learning to Share

I know what you're thinking. How does a computer manage to send output from several programs to a single device, without crossing the data streams? Am I right? I knew it! Talk of space travel always brings this to mind. :)

After all, spacecraft deal with this problem all the time. Even now the Mars rover, Spirit, is taking pictures with its nine cameras. Other onboard instruments are sniffing the Martian atmosphere, measuring its wind speed, temperature, and humidity. All the while its three spectrometers are determining the chemical composition of Martian dust and assorted rocks.

This valuable data must make its way to earth. But how? The rover's dozen instruments can't compete for its three antennae. The result would be a garbled mess. Besides, the antennae aren't able to transmit data most of the time. Only when an orbiting relay station passes overhead, or the dishes of the earth's Deep Space Network come into view, can they be used.

Instead, the collected data sleeps temporarily in the rover's computer memory. When conditions are right, the rover unburdens itself, quickly transmitting its latest discoveries one bit at a time. The rover's memory is then cleared, free to hold the produce of another day of Martian perambulations.

Spooling

If you've been to a State Fair and seen a rodeo, this trick may not impress you. In fact, it probably seems obvious. Just store the competing data streams as they are being created. Then transmit them one at a time. Can you believe engineers get paid good money for thinking this up?

But years ago, when the earth was young and a computer was as big as a house, this technique was dazzling! Computer programmers call it "spooling", probably because, back in those days, data was often temporarily stored on spools of magnetic tape. We use the same name today, even though disk drives and computer memory are more likely to be used for our data's temporary housing.

To see spooling in action, let's see how our computers print. First, enter clever and insightful words -- like those you're reading now -- into your favorite word processing program. Next, select "Print" from the program's File menu, choose a printer, then click the button labeled "OK".

Our work is done. Now it's time for software to take over. The word processing program prepares a series of bits, describing the document about to be printed. It then sends those bits to Windows, with instructions to forward them to the appropriate printer at the first opportunity.

What happens next depends on your printer's spooling settings. To see them, select "Settings" from Windows' Start menu. Then select "Printers and Faxes" from the little context menu that appears.

Wow! There's a window containing one icon for each printer connected to your computer. Right-click on one of those icons, then select "Properties" from the context menu that appears. See the "Printer Properties" dialog? Click its "Advanced" tab.

Getting here sounds more complicated than it is. But now you can see your printer's spooling settings. Look first for two radio buttons, one labeled "Print directly to the printer". The other reads "Spool print documents so program finishes printing faster".

As you've probably guessed, the first choice tells Windows to send data directly to your printer. This option bypasses the "spool", forcing each bit of data to be sent to the printer immediately.

And, depending on your luck, this could take a while. If the printer is already in use, your program must wait its turn in line. If the printer isn't ready to accept data (because it's power off, out of paper, etc.), the program will be suspended until the printer becomes ready.

Once the printer is ready, the wait isn't over. Almost all printers are slower than the computers and programs that feed them. So the program must wait while the printer digests each block of data, before sending the next. As a result, the program is occupied, and unable to do other work, until the document has been completely printed.

These reasons make the other choice -- enabling spooling -- very attractive. Since your document's data is quickly stored on disk, the program doesn't have to wait for the printer to finish.

In fact, it doesn't even have to wait for the printer to start. Documents can be spooled even when a printer is broken or turned off. You and your word processor can move on to other important jobs, while Windows waits patiently for your printer to be revived.

Two other settings affect how documents are spooled. Both appear below the radio button that enables spooling. One reads "Start printing after last page is spooled". This tells Windows to wait until the entire document has been stored in the spool before sending any of its data to the printer.

The other is labeled "Start printing immediately". Select this speedy option, and your printer is put to work as soon as the data describing the document's first full page is spooled. Your printer can then busy itself printing that page, while the rest of the document is prepared and stored.

For the deeply nerdy only: You may hear that SPOOL is an acronym, meaning "Simultaneous Peripheral Operations On Line". As cute as that sounds, most old-timers agree that phrase is a "backronym" -- a meaning devised after the fact.

More for the deeply nerdy: The American space agency NASA has an important place in the history of spooling. In the mid-1960's they helped local IBM employees develop what would become a wildly popular spooling feature for the IBM 360 mainframe computers of the day.

It not only allowed computers to spool printer data, but could also spool data to and from card readers and punchers, paper tape readers and punchers, and more. Because the software was developed at NASA's Johnson Space Center, the program was called the "Houston Automatic Spooling Program" or HASP.

The legendary HASP has even inspired several songs, including such hits as "Real Good Throughput, Here I Come" and "If I Had a HASP (I'd be SPOOL.in' in the Morning)". Now I ask you, who says programmers aren't cool? :)

New Print Logger

Windows' spooling feature makes possible one of the oldest Power Tools, the "Print Logger". Debuting back in 1999, this little program monitors the printer spool, noting each document, or job, as it arrives and departs. These observations are recorded in a disk file, giving us a record of all documents printed.

What can you learn from the Print Logger? Its log file reveals when each document was printed, and the computer and printer where the work was performed. It also discloses the user who ordered the printing, the program they used, and the title of the document. In most cases, you'll also learn the number of pages printed, and the number of bytes actually sent to the printer.

The logger also records each document's "priority". Documents spooled with a high priority are given preference, moved to the top of the queue of documents waiting in the spool. Low priority documents get the opposite treatment, forced to wait until all pending high- and normal-priority documents have finished.

Unfortunately, over the years, the old Print Logger suffered from a bad case of "bit rot". Its original design prevented it from keeping up with newer, faster computers and printers. Increasingly, these speedsters would often print a document before the logger noticed.

But I've just overhauled the logger, teaching it to keep up with times -- and with today's faster hardware. This brand new version, 2.1, also records more information, and even displays the number of documents currently waiting in each printer's queue!

There's more I'd like to tell you about the new Print Logger. But that will have to wait until our next get-together. In the meantime, if you'd like to give the new Print Logger a try, visit its home page at:

https://www.karenware.com/powertools/ptprnlog

As always, the program is free for personal/home use. Programmers can also download the program's Visual Basic source code, to learn how the Print Logger uncovers Windows' spooling secrets.

Better yet, get the latest version of every Power Tool -- including the new Print Logger -- on a shiny CD. The disc also contains three bonus Power Tools, not available anywhere else. The source code of every Power Tool, the text of every back issue of my newsletter, and even some of my original Windows Magazine articles are included too. Owning the CD also grants you a special license to use your Power Tools at work.

Best of all, buying a CD is the easiest way to support the KarenWare.com web site and this newsletter! To find out more, visit:

    https://www.karenware.com/licenseme

Until we meet again, if you see me on the 'net, or in one of those fantastic photos from Mars, be sure to wave and say "Hi!"