Cave?

What kind of cave is this?

What, you ask, is The Information Cave? The answer is easy. The Information Cave is a large collection of links, 967 at last count, to many sites that I have been collecting since 1991. I read various news groups, comp.infosystems.announce and comp.infosystems.www.announce for example, that are used to let others know about new sites or ones that have changed recently.

So much for what, how about why? There are two main reasons. The first is that I actually use the links myself to surf the internet. I load software from Simtel via the Software page, find out what the weather is going to be like today via the Maps and Weather page, learn how to add that nifty feature to my web site via the Coding in HTML page, and the list goes on. The second reason is that I wanted to learn how to write HTML and this site is a good example of what I have learned. Except for CGI, in this site you will find examples of many aspects of HTML: tables, JavaScript mouseover image handlers, image maps and frames.

How to use The Information Cave

If you like this site be sure to add it to your favorites (Internet Explorer) or bookmarks (Netscape). There are two ways you can find links on this site. If you are using Internet Explorer you will find tool tips on each of the items in my home page that give a summary of the main categories in a subpage. For both Netscape and Internet Explorer users you can find a brief description of each site in the status line at the bottom of your browser window. In each subpage there is a table describing each major category of links and a hyperlink to let you jump to that category quickly. The other way to find links on this site is to go to my Site Map. This is list of all major categories with a hyperlink for you to jump right to it. The Site Map has a list of letters at the top to scroll the site map to a major category that starts with that letter.

No doubt there are some links that you may find interesting and some that are less than interesting (i.e. broken). If you find problems with any of these links please fire off some email to tell me about it. Just click here to send your comments. If you have any questions or links you think I should have I would like to hear about it.

How did he do that?

After thinking about it you may realize that some of the features of this site aren't too much trouble to do once, but keeping them up-to-date would be a real pain. I have learned, over the years, that computers can be pretty good at doing things that people might find really boring. Some of these things are:

All of the code that was used to implement these features is freely available. Much it is Perl, which is available for just about every type of computer. The rest of the code relies on the make program, which is available on just about every Unix computer, and variants, and through DJGPP which runs on PCs.

Updating the date at the bottom of each page.

The text editor I use most often is Emacs. It is a very powerful text editor that has been around at least since 1980. One of its main features is that it allows one to write editor programs to add new features. A feature I added was to look for a date string in a file and updated it whenever the file is saved. Click here to see the Emacs code that implements this.

If you have been writing software as long as I have you will notice that this is Lisp code. Essentially it looks for a special text string and then moves ahead looking for a date string, removing it and then inserting the current time. What I have at the bottom of each page is text that looks like the following.

<!-- Insert modified date here -->
<p>
<small>
Last modified Fri Apr 09 07:04:00 1999.
</small>
</BODY>
</HTML>
<!--
;;; Local Variables:
;;; write-file-hooks: (insert-modified-date)
;;; End:
 -->

This contains the special text string and the Emacs directive to run the insert-modified-date function when the file is being saved. Real easy, eh?

Keeping the site map current.

You may have noticed that there is a button on the home page that is linked to The Information Cave site map page. As new links are added this page needs to be updated. Keeping the site map up-to-date is not an exciting activity which makes it a great candidate for automation. To that end, I wrote a Perl script that scans for the <H3> header lines then sorting and generating HTML code with the details. Both the top frame and the bottom frame were generated with the same script. Whenever one of The Information Cave pages is updated the Perl script is executed to update the site map. Click here to see the Perl script.

Loading updated pages via FTP.

Transferring files via FTP has not been automated. I have done that for some other files so it is technically feasible. What was done was to write yet another Perl script to determine what files need to be transferred. This Perl script looks at the FTP log file to see what has already been transferred and compares the date of the last transfer to the date of the corresponding file. If the date of the file is more recent than the date of the last transfer then the file needs to be transferred again. The Perl script will display the list of files that need to be transferred. Click here to see the Perl script that is used to determine what files need to be uploaded to the web server site.

Updating the tool-tips on my home page.

Another rather boring activity for a person is to keep the tool tips on the home page up to date. These are only visible to Internet Explorer users when the mouse is over one of the selectable items. This was done, again, by scanning selected HTML files for the H3 headers. When one is found it is written to a file. For example, for the email page there are 4 H3 headers. For that page, the Perl script will generate the file email.inc with the following contents:
title="Free Email Servers
Spam
Usenet News Providers
Posting to News Groups"

The home page contains the following line:

#include "email.inc"
The #include command is used to make the lines that make up the email.inc file part of the Email anchor which contains the tool tip description. All of the web pages are sent through the C preprocessor which will replace the #include lines with the contents of the file. When this is done, the anchor for the Email link will look like:
<A HREF="email.htm"
        onmouseover="display_status('free Email, Usenet and SPAM');return true"
        onmouseout="display_status('')"
title="Free Email Servers
Spam
Usenet News Providers
Posting to News Groups"
>
Click here to see the Perl script that manages the tool tips.

Keeping the list of Simtel mirror sites current.

One of the best sites for shareware and freeware software is Simtel. The site is well indexed so that even with with over 16,000 programs for MSDOS and Windows 95 it is easy to find what you are looking for.

In the Software page there is a menu that allows you to pick the Simtel mirror site nearest to you for the best access. A Simtel mirror site is authorized by Simtel to keep a copy of all of their files, using the same organization as Simtel. The list of mirror sites changes periodically which means that the menu also needs to be updated periodically. There is a file at each mirror site that contains a list of the current mirrors. You can click here to see what the file looks like. The file is well structured which makes it suitable for scanning with a Perl script. This script generates the <OPTION VALUE> HTML codes to form a menu. The #include mechanism described earlier is used to pull it into the Software page. The Perl script also adds a date annotation below the menu to give an indication of how current the mirror site list is. Click here to see the Perl script.

Generating the code for the green arrow you see on links.

Most of the pages have links with a blue shaded circle. When the mouse is on the link a green triangle appears, and goes away when the mouse moves away. This was done using the JavaScript programming language. When a page is loaded two images are loaded at the same time: one contains only the blue circle and the other contains the green triangle and the blue circle. Both images are exactly the same size and the backgrounds of the two images blend in with the background nicely so they look like the belong there.

Getting this set up properly was very difficult. There are several parts to this:

Defining the JavaScript was straightforward. It looks like:
if (document.images) {
    redon = new Image(); redon.src ="images/grenon.gif";
    redoff = new Image(); redoff.src ="images/redoff.gif";
}
// Function to activate image.
function imageOn(imageName) {
    if (document.images) {
        document[imageName].src = redon.src;
    }
}
// Function to deactivate image.
function imageOff(imageName) {
    if (document.images) {
        document[imageName].src = redoff.src;
    }
}
The first part loads the two images with and without the green triangle. It doesn't get any simpler than that. The other two parts define functions that, when called, will show the green triangle and the blue circle (imageOn) or only show the blue circle (imageOff).

Defining code to create the anchor for the link and hooking it up with the JavaScript was quite difficult. The problem is that each link is separate and needs to be specifically identified so the JavaScript functions will turn on or off only that link's images. What was done was to have each link contain onmouseover and onmouseout handlers which will call the imageOn and imageOff functions, respectively.

<A HREF="the URL"
 onmouseover="imageOn('image0')"
 onmouseout="imageOff('image0')"
>
 <img src="images/redoff.gif" border="black" name="image0">
The Link
</A>
Note that the imageOn and imageOff functions are called with a string as an argument which matches the name attribute in the <img>. If there are 50 anchors in a page then the above code needs to be generated for image0 through image50. This kind of tedium is an ideal candidate for some automation. To implement this a Perl script was written to scan through a page to generate a unique string for each URL. The difficult part was to have three strings be the same and have the next three strings, for the next link, also be the same but different from this link. To accomplish this a simple language was invented to define a numeric variable, allow one to reference it and allow one to increment it. A Perl script implements this language and will generate unique numbers for each link, to which the word "image" is prepended. Click here to see the Perl script that implements the language.

All of this extra gunk for each link would get to be a pain after a while. With the C preprocessor mentioned earlier one can use macros defined to contain the extra gunk. Referring to the macro will cause the C preprocessor to replace it with the gunk. A macro DO_BALL was defined to make defining new links easy. It contains the difficult part of the anchor, starting with the onmouseover handler and ending at the end of the <img>. This way defining a new link would look like:

<A HREF="the URL"
DO_BALL
        The Link</A>
A nice side-effect of this approach is that it is easy to change the image and have all links pick up the change.

Keeping pages reasonably consistant.

Several other macros were used to keep a reasonably consistant appearance for the pages. One of the first macros written was to define the symbol SITE_NAME to be The Information Cave. Every place you see the words The Information Cave the macro SITE_NAME was used. Another thing you may have noticed is that every page has a copyright notice. This was placed in a file common.inc that also contains the commonly used macros, such as SITE_NAME. and HEADER. The HEADER macro takes a title argument and generates a TITLE tag, and a H2 tag with the title as the NAME and the body of the tag. It also sets up the background image. The macro looks like
#define HEADER(title)
HEADER_NO_H2(title)
<H2><A NAME="title">title</A></H2>

#define HEADER_NO_H2(title) <HTML> <HEAD><TITLE>title</TITLE></HEAD> <BODY BACKGROUND="images/back05.jpg">

This purpose of these macros is to start off a page. The back.inc file contains the following:

<A HREF="index.html">
        <img src="back.gif" border="black"> Back to The Information Cave home page</A>

This is used near the end of a page to allow one to jump back to the home page.

Back to The Information Cave home page

Last modified Thu Feb 10 21:03:26 2000.