Copyright ©1996, Que Corporation. All rights reserved. No part of this book may be used or reproduced in any form or by any means, or stored in a database or retrieval system without prior written permission of the publisher except in the case of brief quotations embodied in critical articles and reviews. Making copies of any part of this book for any purpose other than your own personal use is a violation of United States copyright laws. For information, address Que Corporation, 201 West 103rd Street, Indianapolis, IN 46290 or at support@mcp .com.

Notice: This material is excerpted from Special Edition Using CGI, ISBN: 0-7897-0740-3. The electronic version of this material has not been through the final proof reading stage that the book goes through before being published in printed form. Some errors may exist here that are corrected before the book is published. This material is provided "as is" without any warranty of any kind.

CHAPTER 28-Learning from the Pros

In a world where the objective of writing CGI is to publish it immediately, it makes sense to give you a list of public pages that illustrate some of what we've talked about so far in this book. After all, knowing that something can be accomplished is sometimes all you need to inspire you to do it for yourself.

I picked sites that are outstanding for one or more of several reasons: Either the site demonstrates a superb and elegant use of CGI, the site has good CGI reference materials, or the site has CGI tools you can download or buy. In the search for excellence, I'm not terribly concerned about whether the software you'll find is freeware, shareware, or a commercial application. My only objective is to show you how to do it right. There may be cheaper ways of doing it right; there will certainly always be more expensive ways. But the sites I offer are doing it right, and doing it right now. There's no reason you can't be doing it, too.

Undoubtedly, every reader will be able to tell me that I missed a great site, or that XYZ Corp. gives away as freeware what I featured for $1,800 from ZYX Corp. Save your postage stamps, please. I intentionally skipped some well-known and excellent sites-in most cases, because the sites are too busy to be useful. This is the worst Catch-22 of the Web: If you do something very clever or very popular, your server is likely to be overwhelmed by visitors. WWW should stand for World Wide Web, not World Wide Wait. So I tried to choose sites that offer a reasonable response time, and are solid rather than fashionable. I also probably overlooked some great sites just because the Web changes so fast.

That said, you'll look at the following areas:


This Ever-Changing URL in Which We Live
URLs change. Sites come and go. Some last for years, others for days or hours. Sometimes a popular site becomes temporarily unavailable due excess traffic. Sometimes a router fails between you and the site. Sometimes the site's server goes down. Sometimes a site just...disappears.
Any book that provides current information runs the risk of becoming outdated. A book like this one, though, is almost certain to have expired links-pointers to sites that have either moved or gone on to the Great Bit Bucket in the Sky.
We made every effort to ensure that, as of the date of manuscript preparation, the URLs provided throughout this book were correct and working. By correct, I mean that the site's URL is given accurately, and that the content available at that site roughly correlates with what we said it did. There's no guarantee, especially when we refer to subpages on a site, that the Webmaster hasn't shuffled things around-or even decided to give up CGI information in favor of spotlighting the latest interactive smut fiction. By working, I mean that we tested the link and it seemed both reliable and reasonably responsive.


Programming Tutorials and Sample Code

I'll start off by examining a variety of online tutorials, many of which include sample code. Some of them are meant to be tutorials; others are just such good examples of programming, or such simple code, that they become lead-by-example instruction sheets. I won't bother to list too many, since the book you're holding is one long CGI tutorial in itself. However, even a book as comprehensive as this one can't cover everything, so here are pointers to some fundamental or esoteric tutorials you might find useful.

CGI and SSI Freeware and Shareware

As you wander through the online world looking for samples of scripts for tips on technique, you may run across some ready-to-run scripts that do exactly what you want. In this section, I present some sites that offer freeware or shareware CGI, SSI, and Java scripts. You won't find anything wild or strange here: these are workaday programs you can take home and put right to work doing useful tasks.

Don't forget about the list of publicly available software libraries at the end of Chapter 3, "Designing CGI Applications." You'll find pointers to routines there that can save you hundreds of development hours.

You've probably encountered many of these software offerings without knowing it. If you've visited an NT server with a graphical counter, for instance, chances are good that the site is using Kevin Athey's creation, or at least the GD library component of it. For that matter, you'll find that the GD library is used in most CGI scripts that produce on-the-fly GIFs, regardless of platform. Likewise, most of the programs in this section are proven products in wide-spread use. Fill your coffee cup, clear some space on your hard disk, and get ready to download.

Here are some of the best freeware and shareware tools available to spice up your Web pages and make your site more powerful:

Fun Stuff: Examples of Things Done Right

Here's a collection of sites that demonstrate stylish, informative, creative, or intriguing uses of CGI on the Web. You'll find plain old CGI and SSI mixed in with Java, real-time audio, real-time video, and others.

I'll start small, with a simple page counter, and work my way toward the bizarre and fanciful. I picked sites that illustrate technique and taste. If you don't find any ideas for programs in this section, check your pulse-you may already be dead.

Indexing

In this section, I'll point out sites that do indexing well. For the sake of contrast and instruction, I'll include one that actually makes the content harder to find than if it were buried at sea in a locked cabinet. This kind of egregious irresponsibility is rare, though, and I'm happy to provide you with several of the best and brightest searchable sites on the Internet. I'll start with examples of small sites, and work my way up to the behemoths at Infoseek and Alta Vista.

Connecting SQL Databases

Many Web servers, especially recent entries into the field and those designed for the NT platform, have database connectivity built in to the server. Even those servers that don't talk to databases directly (through ODBC, or Open Database Connectivity) usually include a CGI module of some sort that does. While this allows the advertisers to claim that the server comes packaged with database functionality, often the level of database support is only good enough to demonstrate connectivity, not build a real application. In any case, older servers, especially in the UNIX world, usually have no database support at all.

This section looks at a few third-party products designed from the ground up to help you connect your Web server to a back-end database. While many products are available, the ones I chose are clear leaders in the field-either because of outstanding performance, or general availability and widespread use.

See  "MiniSQL (mSQL) and W3-mSQL," p. xxx, for more information on these two packages. 

Spiders, Worms, Crawlers, and Robots

If you're just looking for information from the Internet, use one of the publicly available search engines. It's unlikely you'll ever have the resources to duplicate the mighty Alta Vista, for example, and even if you do, you'll need more help than this section could possibly give. Besides, all the really good robot code has commercial value, and hence isn't freeware.

On the other hand, if you want to build a small special-purpose spider, worm, crawler, or robot, some code is available to help you get started. More important than how to do it, however, is how not to do it. That's why the first link I'll present is to an article you must read if you're going to build a Web automaton. Also be sure to check out Chapter 14, "Robots and Web Crawlers," for more information about this topic.

CGI Interactive Games

There are thousands of online games to choose from, if you're of a mind to play games on the Internet. In this section, I've selected a few that illustrate CGI techniques particularly well. Some are incredibly complex, others very simple, yet all deal with maintaining state information to provide the illusion of interactivity.

A Brief Case Study: Internet Concepts, LLC

Internet Concepts, LLC, knows that content and presentation are the two things that make one site stand out from another. They have created several award-winning sites you may have already encountered, as follows:

These sites not only are well-designed and visually appealing, but they take an unusual approach to the development of site content: They rely on the user to provide it.

Using a framework of hand-crafted CGI scripts written in Perl 5 and running on a Sun SPARCstation, Internet Concepts lets users submit an entry on a fill-out form. A CGI script then processes that entry, adding it to the database and making it immediately available on the Web.

Stephan Spencer of Internet Concepts says, "Some consider this real-time updating risky, but since December 1994 when we first implemented this practice we have had no notable problems. Nonetheless, we'll probably change this in the near future to a policy of holding submissions in a 'pending' area until we have reviewed them."

The database is based on Perl dbm. The script that processes new entries requires the user to assign a password, too. The user can then make changes to that entry later on. A "root" or master password allows site supervisors to change individual passwords, edit entries, or delete entries. Another script allows browsing. It displays the database sorted by name, organization name (if applicable), category/genre, and location. Most of these sites are also keyword-searchable.

InnSite even offers a geographical search interface that responds to user clicks by zooming in indefinitely on a region, returning images real-time from the (Xerox PARC Map Viewer ).

Internet Concepts provides many of these sites as public service to the Internet community. They also, however, design and implement many commercial sites. One of the most interesting is the Online Catalogue at (Seton Identification Products). This site offers the "Workplace Safety Home Page," and a searchable online catalog of thousands of signs, labels, tags, pipe markers, and other identification products. The site supports online ordering of over 6,000 items.

If you're interested in finding out more about Internet Concepts, their home page is at this site, or you can send them e-mail at .

The wizards at Internet Concepts have used CGI to create their enchantments. With what you've learned in this book, you can invoke the magic of CGI, too.

QUE Home Page

For technical support for our books and software contact support@mcp.com

Copyright ©1996, Que Corporation