The Artima Developer Community
Sponsored Link

Ward Says, Don't Try This at Home
Spoken Log
by Ward Cunningham
November 29, 2004
Summary
Keep close tabs on your server with voice output.

Advertisement

I've been trying to keep closer tabs on my wiki site so that I can understand the ways people act there. This weekend I added voice synthesis. This turns out to be a lot of fun and pretty informative too. I'm writing to other server operators to encourage them to give this a try.

My mac has a command line program that will pronounce text. If I want it to say hello to the world I would type:

say hello world

I can add this to my perl wiki server by adding the line:

system("say $page&");

Place it in wiki.cgi just after where it figured out the requested page. I add the & to the command so that the server doesn't wait for the speaking to finish before serving the page. This could be a lot of fun if you're running a wiki for a group of people who happen to sit near the server. A more useful variation might be to add the speaking to the edit.cgi script. This would announce which pages are being edited so that people can avoid conflicts.

Now I don't actually sit anywhere near my server so I had to monitor its activity remotely. I'm used to using tail -f to watch my server logs. This works fine through secure shell too:

ssh 'tail -f /var/log/httpd/access_log'

So I wrote this into a perl script, something like:

open(L, "ssh c2.com 'tail -f /var/log/httpd/access_log'|");
while() {
  system("say $1&") if /([A-Z][a-z]+([A-Z][a-z]+)+)/;
}

This looks for wiki names in the log and pronounces them as fast as they come. I put the system call into a subroutine and added a sleep to limit the rate to one a second.

sub say {
  system("say $1&");
  sleep(1);
}

Longer names take more than a second to say so the talking can overlap. But this is easy to understand so long as the starts are staggered.

I've added a second voice for more rare events, like posts back to the server for saved pages:

system("say -v Bruce post&") if /POST/;

Bruce is easy to understand even when my default voice, Victora, is gabbing away. I've actually added five or six triggers for Bruce. When he gets going I know someone is doing something weird to my server.

I've also found it useful to ignore the robots. With them crusing through my site the talking gets way too complicated. I added this right inside the while loop:

next if /googlebot.com/;

You will have to tune what you look for and how you say it so that you get a good feel for what is going on moment by moment. Once you have it working, try watching the log the old fashion way in a separate window. You'll find more things you might want to pronounce.

Talk Back!

Have an opinion? Readers have already posted 2 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Ward Cunningham adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Ward Cunningham is a founder of Cunningham & Cunningham, Inc. He has served as Director of R&D at Wyatt Software and as Principle Engineer in the Tektronix Computer Research Laboratory. Ward is well known for his contributions to the developing practice of object-oriented programming, the variation called Extreme Programming, and the communities hosted by his WikiWikiWeb. He is active with the Hillside Group and has served as program chair of the Pattern Languages of Programs conference which it sponsors. Ward created the CRC design method which helps teams find objects. Ward has written for PLoP, JOOP and OOPSLA on Patterns, Objects, CRC and related topics.

This weblog entry is Copyright © 2004 Ward Cunningham. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us