MySQL and mSQL

If you’ve never used a UNIX-like system before, or a programming language, you will have some trouble with this book. If you are somewhat familiar with one modern programming language and know at least the rudiments of the UNIX filesystem, this book is a great introduction to databases and these two popular database tools.

The opening chapters outline the basic concepts really clearly, and walk you through the short course in database design. If you are creating a small database with one of these tools (MySQL or mSQL) this book will get you started in fine style. The chapter on installing the tools is comprehensive and very well laid out. The basic style of the prose is easy to read and very comforting if you are new to the topic.

The big problem with the book is that it is organized with the information about the two tools explained in parallel. This is quite simple to understand and easy to read, but once you start trying to flip back through the book you realize that you get hopelessly snarled by the subtle differences between the two software packages. MySQL and mSQL are so close in function, and implement SQL so similarly, that it is easy to get confused by the tiny differences in syntax and structure that that these two systems demand.

SMTP with telnet

One of the things I like best about the TCP/IP from a technical standpoint is that almost all of it happens in ASCII. This means that when your mail is getting refused or your web site isn’t working you can just fire up telnet, hit the right port and start poking around.

Alarmingly often I find that I can confirm and sometimes diagnose a problem with my ISP’s mailserver before they can. I also find it terribly handy for sorting out wonky behavior on my web server, though I just use an O’Reilly book for that (HTTP Pocket Reference).

I think it would be pretty useful if everything could be in Unicode, from OSes to networking protocols, but that seems rather a long way off. Just the ability to hack in telnet in your own language would be pretty neat. As it is, you’ve got to do things by rote or learn English. I’m glad I don’t have to do that again.

picindex.pl

#!/usr/bin/perl -w

# This little program takes a directory as its argument and
# builds an html frame page with all of the image names in one
# frame and a target frame for image viewing.  It leaves the
# three html pages in the argument directory.

print "Enter the directory with the images -- n
make sure it is an absolute path (include a trailing slash):n";
$target_dir = <STDIN>;
chomp $target_dir;

@jpgs = glob("$target_dir*.jpg");
@gifs = glob("$target_dir*.gif");
@both = (@jpgs,@gifs);
@pics = sort(@both);

foreach $pic_name (@pics) {
    $pic_name =~ s/^$target_dir//;
}

open(MAIN, ">$target_dir"."index.html") or die "Can\'t create index.html: $!n";
open(LEFT, ">$target_dir"."left.html") or die "Can\'t create left.html: $!n";
open(RIGHT, ">$target_dir"."rght.html") or die "Can\'t create rght.html: $!n";

$index_html = "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN""DTD/xhtml1-frameset.dtd">n<html xmlns="http://www.w3.org/1999/xhtml">n<head>n<title>Image Index</title>n</head>n<frameset cols="20%,80%" frameborder="1" border="1">n<frame src="left.html" name="left">n<frame src="rght.html" name="right">n</frameset>n</html>n";


$right_html = "<!DOCTYPE html public "-//W3C//dtD XHTML 1.0 Transitional//EN""DTD/xhtml1-transitional.dtd">n<html xmlns="http://www.w3.org/1999/xhtml">n<head>n<title>Right</title>n</head>n<body></body>n</html>n";

$left_top = "<!DOCTYPE html public "-//W3C//dtD XHTML 1.0 Transitional//EN""DTD/xhtml1-transitional.dtd">n<html xmlns="http://www.w3.org/1999/xhtml">n<head>n<title>Left</title>n</head>n<body>n<dl>nn";

foreach $pic_name (@pics) {
    $pic_name = "<dt><a href = "$pic_name" target = "right">" . $pic_name . "</a></dt>n";
}

$list = "@pics";

$left_bottom = "nn</dl>n</head>n<body>n";

$left_html = $left_top . $list . $left_bottom;

print MAIN $index_html;
print RIGHT $right_html;
print LEFT $left_html;

close(MAIN) or die "Can\'t close index.html: $!n";
close(LEFT) or die "Can\'t close left.html: $!n";
close(RIGHT) or die "Can\'t close rght.html: $!n";