Perl buffer suffering 

Wonder what $| =1 in Perl means? here is a great link to learn Perl buffering

http://perl.plover.com/FAQs/Buffering.html
[ add comment ] permalink ( 3 / 105 )
Debugging SpamAssassin with timestamp 

I just learned from amavisd-new developer Mark I could run command below to check the timestamp of each SA running debugging lines:

su clamav -c 'spamassassin -t -D <test.msg' 2>&1 | perl -MPOSIX -MTime::HiRes -n -e '
BEGIN {$|=1; $dp=0; $t0=Time::HiRes::time};
$t=Time::HiRes::time; $dt=$t-$t0; printf("%s%06.3f %4.3f %4.3f %s",
POSIX::strftime("%H:%M:",localtime($t)), $t-int($t/60)*60,
$dt, $dt-$dp, $_); $dp=$dt' $*


[ add comment ] permalink ( 3.2 / 85 )
Perl one-liner to split mbox 

perl -pe 'BEGIN { $n=1 } open STDOUT, ">$ARGV.$n" and $n++ if /^From /' MailBox

which will split mbox format file MailBox to single email file. there is more one-liner from http://sial.org/howto/perl/one-liner/
[ add comment ] permalink ( 2.9 / 73 )
Running OS X and Windows on Mac Intel 

Just got an Macbook to test run OS X and Windows XP SP2. There is tip which may help other users to install Windows:

1. Boot into Mac OS X.
2. In BootCamp Assistant, remove the Windows partition.
3. Reboot per request.
4. In BootCamp Assistant, repartition for Windows.
5. Reboot into XP Installer.

Always try above if somethings go wrong
[ add comment ] permalink ( 3.1 / 69 )
AWSTATS setup on OS X Tiger Server 

Setup AWSTATS on OS X Tiger Server is plain easy. Check this link for step by step setup
http://www.afp548.com/article.php?story ... 3205258972

But there is one thing bite me - the Apache log format. Apache's default combined log format is like this:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

So I followed the AWSTATS setup instruction to use the combined format for my virtual domain, and watch the log format while browsing the virtual website, the first column of log line always shows the virtual domain server IP instead of visiting IP. Used the same combined log format on OS X Tiger client, no problem at all. After digging around, I found out that Tiger server use "%{PC-Remote-Addr}i" to replace "%h" as the visiting IP. The combined log format on Tiger Server should be like this:

LogFormat "%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

There is no documentation mentioned about this as I search around, Apparently, Tiger is trying to do good thing, but on the contrary bite us.

I did not run the awstats configure script to make changes to apache config file. just manually edit a httpd_awstats.conf and include it in httpd.conf. I also copied awstats.model.conf to awstats.virtualdomain.conf , changed the "LogFile", "SiteDomain", "HostAlias" parameter to match the virtual domain and run the update script:

/Library/WebServer/awstats/tools/awstats_updateall.pl -awstatsprog=/Library/WebServer/awstats/wwwroot/cgi-bin/awstats.pl now

To view the virtual domain awstats, the link should be like this:

http://myhost/awstats/awstats.pl?config=SiteDomain


[ add comment ] permalink ( 3 / 70 )

Back Next