Skip to content
Home ┬╗ CGI ┬╗ Page 2


Just added: More Like This

New feature: More Like This. It took me several hours to implement this one. It should have taken me less than thirty minutes. Hot tip: If you try to run a CGI script and you get Internal Server Error messages, try re-uploading the script in ASCII mode rather than the default binary. Betcha it works after that. When running under Linux or Unix, Perl hates extra carriage returns, and Windows often inserts them.
I think this is the next trend in Weblogs sites. If it’s not, it should be. The idea is this: You assign some keywords to each entry. And at the end of the entry, you put a line that says More Like This and some hyperlinked keywords. So if you like it when I write about baseball or music and you want to see more, click on the baseball or music hyperlink at the end of the entry, and the search engine I stole will go fish around for other entries I gave the same keyword to.

For sites that always write about the same thing, this isn’t very useful. For sites with eclectic content, this is a boon. You can quickly find whatever writings of mine tickle your fancy and skip over the subjects that bore you. How cool is that?

My goal is to put together the best site in the Daynotes circuit. I’ll never have the best content, but if I have reasonably good content and you can quickly find a whole lot of what you’re looking for (be it entertainment, stuff that makes you think, or technical content), I stand a ghost of a chance of reaching that goal.

I actually managed to implement More Like This without modifying any Greymatter code. First, I grabbed Meta Tag Search, a simple CGI script that searches on meta tags, from I followed the installation instructions. Like I said before, upload it in ASCII mode. You’ll save yourself a few hours and a lot of gray hair. Now, whenever I make an entry in Greymatter, I put a keywords meta tag at the very beginning of the entry. I don’t know if other search engines will find the tags there, but Meta Tag Search will, and that’s my primary concern. Then, at the end of the entry, I add collection of hyperlinks that call Meta Tag Search.

So now it takes a couple more minutes’ effort to make each post, but I think it’s worth it.

More like this: Linux Weblogs HTML CGI

How I set up Greymatter for Weblogging

How I set up Greymatter for Weblogging. First things first: I’m sure everyone’s asking how much hardware you need. I’m using a Pentium-120 with 64 megs of RAM, and it’s plenty fast most of the time. It takes a little while to regenerate all the templates, but other than that it’s mostly sitting idle. Any Pentium-class machine should be plenty. I’d be hesitant about using a 486 because the templates will take an awfully long time to rebuild. Remember, Greymatter’s written in Perl, and Perl’s an interpreted language. Interpreters are slow for the same reason emulators are slow–the translation is real-time.
But Greymatter offers advantages. You can control your destiny. You have total control over your site–it’s running on your Linux box. And you’re free from FrontPage’s tyrrany. Did I hear cheers? Most importantly for me, I set the clock. I can set the clock ahead a couple of hours, make my post at 10 p.m., and it’ll be dated the next day. That can only mean… The return of the infamous Farquhar Time Machine. I can start sleeping in again! Or go to work earlier… Hey, I can start sleeping in again!

Anyway, I had the Pentium-120 already configured with Mandrake 7.2, but I discovered Mandrake 7.2 in high security mode doesn’t seem to allow Web traffic from the outside world. So I installed Mandrake 7.2 again in low-security mode. I used a server installation. The only things I really cared about were Apache and Perl, but I didn’t feel like de-selecting everything. Both will be in there by default. I think Perl’s part of the Development group during installation. I’m not sure what group Apache is in. I don’t recommend running XFree86 on your server. Those memory resources are better used for server purposes. Oh, and one last thing: Don’t use DHCP. Give your Web server a local, static IP address.

Once I was up and running, Apache wasn’t running by default, so I dinked around with a cp /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S45httpd so that Apache would start on boot. Then I started Apache by executing /etc/rc.d/rc3.d/S45httpd start. Of course there are plenty of other ways to accomplish the same thing. It was close to midnight and I just wanted the thing open to the world at that point.

Then I pointed my Web browser at the server’s address, and my embryonic Weblog came up.

It won’t happen that way for you, because I already had Greymatter installed and configured before I did all that. In other words, I did things bass-ackwards. You should do it differently. Get Apache working right first. It’s less frustrating that way.

With Apache installed and running, point a Web browser at it. You should see some kind of Apache welcome screen–it’ll vary based on your Linux distro, but it’ll basically be some kind of show-off screen. You see it? Great. You don’t? Get Apache working. How? I dunno. Make sure it’s running, first of all. Type the command pidof httpd. You should get a couple of numbers. Maybe a lot of numbers. If all you get is a blank line, then Apache’s not running. If it’s running but not responding, you’ve probably got a problem with the configuration file. The default configuration file for Apache, unlike the default configuration of a lot of programs, does work reasonably well. The defaults will certainly do for a Weblog. Start with the default config, get it working, then get fancy later.

Working? Great. Open up port 80 on your DSL router and point it to your server’s address. Don’t expose any other ports. This improves security immensely. Now go to and run Shields Up!, then Probe My Ports. Port 80 should be open. If it’s not, either your Linux box is too secure (I wish I could offer some advice there but I don’t know much about un-securing a Linux box) or your router’s not forwarding the port right.

By default, in Mandrake at least, Apache puts its HTML files in /var/www. So, first, clear out /var/www/html. Next, I put all of the Greymatter files in /var/www/cgi-bin. Then I created directories named Archives in both /var/www/cgi-bin and in /var/www/html. The documentation is pretty good about what files need permissions of 755 and what needs 777 (yuck!) and what needs more restrictive settings, like 644 or 666.

As an aside, the archives directory being chmodded to 777 makes me nervous. That means that if I install Greymatter to a server that shares space with someone else, the entire world can see that directory. They can’t manipulate anything inside there as long as the files inside have more restrictive permissions, but I always cringe every time I see anything with 777 permissions. I knew people in college who’d just chmod everything to 777 because then it meant everything just worked all the time. Unfortunately, anyone who had telnet access to the machine could then go into that directory and change anything. I’m not as concerned about that, since I don’t share this PC with anyone. But 777 still doesn’t give me warm fuzzies. Unix ain’t Christianity. In Unix, 666 is ok (but 644 is much better), and 777 is a hacker’s delight, and therefore, pure evil.

After you chmod all your files, assuming your server is at, go to Greymatter should pop up. Go to the configuration screen and run down the line:

Local log: /var/www/html
Local entries: /var/www/html/archives
Local CGI: /var/www/cgi-bin
Website log path: /
Website entries path: /archives
Website CGI path: /cgi-bin

Set the other stuff the way you want it. Now hit Save Configuration. Now, immediately run Diagnostics and Repair. This will ensure that all files are where they need to be and permissions set correctly. If it can’t find something, do what you have to to satisfy it.

Now you’re ready to start editing templates and adding entries. You’ll need to exercise your HTML skills for that, or rip off someone’s templates. I didn’t look too hard, but I’m sure there are people out there offering Greymatter templates. If you have to, use an HTML generator to draw what you want, then take the code and put it in the template. I know HTML, so I coded mine by hand. That’s why they’re still sparse. The basic layout is there; I need to flesh it out. And I haven’t entered every template yet myself.

Now, for backups and stats… Backups are easy. I use the command tar -c /var/www >/home/dave/backup.tar. It only takes a second. You can compress the tar file and throw it on a floppy with the mcopy command. Or if Samba’s also configured and running, backup to a network-accessible directory and pull the file over to another machine.

For stats, I use LiveWebStats, but I don’t like it. Any Apache log analyzer will work.

There’s one other issue with Greymatter. It sends passwords plaintext, and thus, they’ll show up in your logs. So don’t make your stats public, at least not your referrers. If you’ll have remote editors, you need to consider that vulnerability–an editor’s password can potentially be intercepted.

Setting up Greymatter is a lot of work, but it’s a one-shot deal. You make your design, then it’s content-driven. Change your design, and it applies to the whole site. Nice. And when you publish, you only publish your new stuff.

But overall, I like Greymatter an awful lot.


Book question; Linux; Hard drive
Optwin update. I spoke with Glenn Gilmore, a marketing director at O’Reilly, today, and he assured me there are plenty of copies of Optimizing Windows available. He suggested there must be a glitch in Amazon’s database, which he said happens fairly often. Since O’Reilly and Amazon do a lot of business, he’s probably in a position to say that.
So, to reiterate, the book is available, and there are enough copies in Tennessee to last quite a long time. If it’s not available at Amazon, please check Fatbrain or Barnes & Noble or another online reseller.
I crashed my machine and lost my post for today. Good thing that doesn’t happen often. I launched Word in order to start writing up a book proposal (don’t get too excited yet–just because I write a proposal doesn’t mean I do anything with it, and even if I do something with it, it doesn’t mean anyone else will like it) and Word never came up. Winamp fell silent. Mouse movements became as erratic as George Brett’s throwing arm in the 1970s. The mouse cursor changed to a vertical bar and never changed back. The caps-lock light didn’t light when I hit the caps lock key. Ctrl-Alt-Del brought up the task manager but wouldn’t let me do anything else. Yup. We’re hung. I waited five minutes to be sure. Nothing. It never came out of its coma. I hit Ctrl-Atl-Del a couple of times and rebooted.

Like I said, this doesn’t happen often. After I rebooted, I found out there are new critical updates for my computer. I wonder if that had something to do with my crash…? Significantly, Windows Update promptly crashed, but this time it didn’t take the system down. I’ve really gotta learn to just say no…

(And if it seems like I’m being overly dramatic, remember, this doesn’t happen to me often.)

So, what’d I lose? I’m trying to remember.

The rest of the story on memory. Visit for the little tidbits I didn’t tell you last week. I didn’t leave out so much.

Optimizing Windows. It looks like it may be out of print. Amazon is now saying it is. I need to contact O’Reilly to find out for certain. They could do another printing, but the question is, are they willing? With O’Reilly mostly pulling out of the Windows market, I don’t know. My editor said this past fall that this title was safe–for now. But it’s not Fall 2000 anymore, so anything’s possible.

In the meantime, just because Amazon doesn’t have it doesn’t mean it’s unavailable. Check to see who’s got it in stock and at the best price. Borders and Barnes & Noble, of course, are reputable. So are Fatbrain and, all of whom were offering it when I checked.

Back to that proposal. So is finding out my book’s probably out of print related in any way to me writing a book proposal? Maybe. But just as significant, I got a newsletter from my alma mater yesterday, and an old archrival was very obviously showing off in the Class Notes. And the wording, and the details that were included, along with the details that were excluded suggests that the audience was intended to be limited. Maybe just to me.

That archrival needs to be put back in that archrival’s proper place (a legend in my archrival’s own mind), so I’m motivated. I’ll even use NaturallySpeaking to get this project out if I have to. Time to write a book that gets both critical acclaim and sales.

Speaking of publications… The February 2001 issue of Computer Shopper UK should be out now. This issue features the second installment of my “Optimise Your PC” series, this one with a focus on DOS compatibility.

Book question; Linux; Hard drive



IE shortcut; Optimizing WinME; Partition; 10/100 NIC; Mobos

Trimming down Windows 2000.┬áSomeone else observed last week that, among other things, Windows’ included games are now critical system components. That’s messed up. Fortunately, it’s fixable.

Open the file C:WinntInfsysoc.inf in your favorite text editor, after making a backup copy of course. Search for the string “HIDE,” (without quotes, but including the comma). Delete all references to this string. Save the file. Reboot. Now open Control Panel, Add/Remove Programs, and go down to Windows System Components. You can now cleanly uninstall the Windows components that may not be useful to you, such as the Space Cadet Pinball game, or the Accessibility Options. I’m in the habit of just banging on the shift key several times to turn off my screen blanker. Why shift? Because it won’t send weird keystrokes to whatver application I left running in the foreground. Unfortunately, hitting shift five times usually pops up the Accessibility options, much to my annoyance. So I was very glad to finally be able to uninstall that feature.

And a bargain NIC. This week only, Circuit City is selling the D-Link DFE-530TX+ 10/100 NIC for $14.99 with a $9.99 mail-in rebate. While I prefer the DEC Tulip chipset for inexpensive 10/100 NICs, the Realtek chipset in this D-Link works with Linux and Windows, and that’s an absolute giveaway price. I mean, come on, most of us spend that much every week on soda.

I’ve got a D-Link laying around as a spare, but I had a Circuit City gift card with about $7 left on it, so I picked one up. Besides, I needed a stereo miniplug-to-dual-RCA cable, so suddenly I had two semi-compelling reasons to go to the shark-infested cave. It’s good to have some spare parts, and the D-Links have much better compatibility than the NDC card with the obscure Macronix 98715 chipset I still have in at least one of my systems.

I’ve seen some ludicrous claims that D-Link gives you 3Com and Intel quality at a Linksys price. I don’t buy it for a minute. But for a small home-based network, why pay $40-$60 for a NIC if you don’t have to?

And somehow I managed to avoid the sharks as well. I guess I just didn’t have Pentium 4 tattooed across my forehead.

Amazon now seems to be selling Optimizing Windows at its full retail price of $24.95. Obviously sales are slower now than when it was selling at (sometimes deeply) discounted prices, but still much better than November levels. If you’ve bought it, my heartfelt thanks go out to you. If you’ve posted a review, another thank you.

If you’ve read it and like it and feel like writing a review, either at Amazon or another online bookseller such as Barnes & Noble, Borders, Bookpool or Fatbrain, please feel free to do so. I appreciate it greatly. And if you have comments or questions on the book, feel free to e-mail me.

If you’re wanting to do a price compare on Optimizing Windows, visit


IE shortcut; Optimizing WinME; Partition; 10/100 NIC; Mobos