August 4, 2005

By Karen Kenworthy

IN THIS ISSUE

We've got some unfinished business.

Recently, I wrote about new versions of my Cookie Viewer and Calculator programs. At the end of each discussion, I said there was more to say about each tool. But time ran out, and those talks had to wait until another time.

Well, that time is now. :)

Cookie Ingredients

A few weeks ago, when we met the newest version of the Cookie Viewer, we were reminded of the important role cookies perform in making the modern web possible.

Cookies -- tiny files stored on our computers -- hold the memories of web sites we've visited. They may remind web sites who we are, what we did during out last visit, and what we're trying to accomplish during our current visit. These bits of data make possible such conveniences as automatic logins and shopping carts.

We saw how the new Cookie Viewer can automatically search our disk drives, looking for cookies stored by most popular web browsers. These browsers include Microsoft's Internet Explorer, Netscape's Navigator, and Mozilla's FireFox. We also chatted a bit about how my program displays each cookie's content, and can delete selected cookies.

Unfortunately, we didn't have time to look closely at the ingredients that make up these mysterious web browser cookies. So if you've got a minute, take off your shoes, have a seat on the sofa, and make yourself comfortable ...

Let's start with the two most important cookie parts: Keys and Values. The Cookie Viewer displays these cookie components beneath tabs appearing on the program's main window.

All cookies contain at least one "Key". It's a short name, chosen by the web server that ordered the cookie. It identifies the data stored in the cookie.

For every key, you'll find a corresponding "Value". As you've guessed, the value is the cookie's nugget of data.

Cookie keys and values always come in pairs. For example, a cookie which holds your login credentials for a particular web site might contain these two pairs:

Key 1: USERNAME Value 1: MyLoginName

Key 2: PASSWORD Value 2: MySecretPassword

When you visit the site that created this cookie, its two Key/Value pairs are automatically sent to the site, allowing you to bypass the usually login procedure.

A Pinch of Spice

Besides one or more Key/Value pairs, cookies contain other important bits. For example, like cookies we buy at a store, all web browser cookies have an expiration date. After this date, both types of cookies are stale, and should be discarded (unless you're really hungry).

Naturally, the Cookie Viewer reveals each cookie's expiration date. But it also discloses how many days, hours, minutes and seconds the cookie has left to live (its lifetime).

If the cookie was stored by Microsoft's Internet Explorer (MSIE), the program also shows the date and time each cookie was created. Unfortunately, because of the way they store cookies, this information is not available for cookies baked by Netscape's Navigator or Mozilla's FireFox browsers. :(

However, those two browsers do record (and the Cookie Viewer displays) one bit of information that MSIE does not. It's called "Scope", and it determines which web servers can see the cookie's contents.

Suppose a web server named www.microsoft.com creates a cookie that's stored on your computer by Netscape's Navigator browser. If that cookie's Scope is "Host", only that one web server can later discover the cookie's data.

But if the cookie's scope is "Domain", servers that are closely related to the original server are allowed to see this cookie too. To qualify, the right-most portions of all server names must match exactly. Only the left- most portion of each name, up to the first period, can differ.

For example, a server named store.microsoft.com would be allowed to peek inside a "Domain" cookie created by a server named www.microsoft.com. That's because the names of both servers end with "microsoft.com".

But even with a "Domain" scope, a cookie created by www.microsoft.com would still be off-limits to servers with names like www.anothercompany.com. Their names are just too different.

The last bit of data found in each web browser cookie is the cookie's "Secure" setting. If this is "Yes", the cookie's keys and values can only be transmitted across encrypted network connections. If the "Secure" setting is "No", the cookie contains no sensitive data, and can be sent along ordinary unencrypted routes.

Calculator Keystrokes

Do you remember my new Calculator program? I had a lot of fun writing that one. One the surface, it's a fairly normal computer desktop calculator,

But one feature sets this program apart. Unlike most calculators, numbers containing thousands of digits don't faze it. They're computed in the blink of an eye. Even adding, subtracting, multiplying and dividing, even squaring and cubing, millions of digits is possible -- if you aren't in a great hurry to see the results.

When the Calculator runs, its main window sports the usual array of buttons, allowing you to enter numbers, order computations, control the calculator's memory, and even recall values of Pi and e (Euler's Number), with just the click of a mouse.

But what if you prefer to calculate using your computer's keyboard? No problem. Every function of the Calculator can be accessed via one or two strokes of your computer's keys!

As you'd expect, the numbers 0 through 9 can be entered by pressing the corresponding keys. To add, subtract, multiply or divide, just press any of your keyboard's "+", "-", "*" or "/" keys. The values of Pi and e can be recalled by pressing the "P" or "e" keys, respectively.

Two keystrokes are needed when asking the Calculator to perform one of its memory functions. Pressing the "M" key, then the "C" key will clear memory. The key sequences "MS" and "MR" store and recall the contents of memory. And "ME" exchanges the contents of the Calculator's memory and display.

The two-key sequences "M+", "M-", "M*" and "M/" do what you'd expect. They cause the calculator to behave exactly as if you'd clicked the on-screen buttons bearing those two-letter labels. Other keyboard sequences include "x2" (square), "x3" (cube) "CL" (Clear) and "CE" (Clear Entry).

When pressing letter keys, such as "M", "C" or "X", there's no need to hold down your keyboard's <Shift> key. The calculator treats upper- and lower-case letters all the same.

It also doesn't matter whether you press number keys that appear across the top of the main portion of the keyboard, or their twins that make up the keyboard's numeric keypad. They're all interchangeable, as far as the Calculator is concerned.

And while you're tickling keys, try pressing your keyboard's "K" key, while holding down its <Ctrl> key (or select "Keyboard Shortcuts" from the program's Help menu). Voila! You'll see the complete list of keyboard shortcuts, found in the Calculator's Help file!

If you'd like to download a copy of the latest Cookie Viewer and Calculator, drop by their home pages at:

    https://www.karenware.com/powertools/ptcookie     https://www.karenware.com/powertools/ptcalc

As always, the programs are free for personal/home use. If you're a programmer, you can download their complete Visual Basic source code too!

You can also get the latest version of every Power Tool, including the new Cookie Viewer and Calculator, on a shiny CD. These include 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 on the CD. And owning the CD grants you a 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:

    https://www.karenware.com/licenseme

Whew! Hope that gets us all caught up. But I'm sure we'll have lots to talk about before long. Until then, if you see me on the 'net, be sure to wave and say "Hi!"