Regular Expression for Email Addresses
June 2nd, 2009[-A-Z0-9._%+]+@[-A-Z0-9.]+\.[A-Z]{2,4}
[-A-Z0-9._%+]+@[-A-Z0-9.]+\.[A-Z]{2,4}
This was weird. I lately tried to install Bugzilla on one of my virtual hosts but it’s testserver.pl script failed with:
Use of uninitialized value in pattern match (m//) at ./testserver.pl line 110. Use of uninitialized value in pattern match (m//) at ./testserver.pl line 110. TEST-FAILED Webserver is not executing CGI files.
The Apache error log told nothing more than
Premature end of script headers: testagent.cgi
All Google lookups failed to solve my problem. Although I had the impression that my CGI setup was somehow wrong, I couldn’t find the reason. Then I intensively checked the VirtualHost directive. The server uses a Plesk 8.0 installation for setting up hosts. The default configuration for virtual hosts with CGI there is to include a “SuexecUserGroup” directive. After removing it, the Bugzilla installation succeeded.
So you might wanna give it a try
Dan White wrote a wonderful Qt4 application for creating a personal D*I*Y planner. I like it a lot and it saves my job every single day since I use it. However, there is one flaw in his templates. The week numbers are missing in calendars. Luckily, he published his source code so I could make some fixes. And of course, I publish it to you for personal use as well.
The files you can download below are based on version 2.04. Following adjustments were made:
Windows Executable 2.04 plus Fixes
Please excuse the German wording. I hope this will vanish on English PCs
Old version at the left, new version at the right…




A new minor release of Templating Java Package has just been released. It fixes a major bug when replacing markers with values that itself contain strings looking like regular expressions. All such expressions are masked now to prevent an exception.
Download the release here.
You might remember my Templating post describing a Java class that implements a Typo3-like technique for a templating machine. I made a Java package out of it and you can use it right away. Just download it here. The API documentation is available, too.
You need to extend a filesystem on a RedHat box? Check the filesystems with df -H. You might get something like
Filesystem Size Used Avail Use% Mounted on /dev/mapper/system-root 11G 8.0G 2.0G 81% / /dev/cciss/c0d0p1 104M 18M 81M 19% /boot tmpfs 2.1G 0 2.1G 0% /dev/shm /dev/mapper/system-tmp 4.2G 146M 3.9G 4% /tmp /dev/mapper/system-var 4.2G 873M 3.1G 23% /var /dev/mapper/system-mysqllv 11G 8.1G 1.8G 83% /var/lib/mysql /dev/mapper/system-srvlv 47G 16G 29G 35% /srv
You need to increase the volume capacity first, e.g. for /srv mount:
lvextend -L +15G /dev/system/srvlv
where +15G tells the command to extend the volume by another 15GB.
Last step is to adjust the filesystem to that volume’s new size:
resize2fs /dev/mapper/system-srvlv
That’s it
This is a series of articles covering integration of SpamAssassin with qmail on a Linux box.
Part 1: Installing and Configuring SpamAssassin
Part 2: Marking email as spam
Now, that we setup SpamAssassin to run as a continous process, we are able to change the qmail system to feed all emails into the server daemon. We need the root folder of qmail first. This is usually at /var/qmail. However, you better check with your installation first.
Create a file “qmail-queue.spamd” in subfolder bin that contains a single line:
/usr/bin/spamc -U /tmp/spamd_full.sock| /var/qmail/bin/qmail-queue.orig
Adapt the paths if necessary. Next step is to rename the existing qmail-queue program in subfolder bin. Name it “qmail-queue.orig”, as we have already used that pathname in our script. Make sure that all file permissions of qmail-queue.orig and qmail-queue.spamd match exactly the original qmail-queue binary.
Last step is to replace the existing qmail-queue binary by a link to our qmail-queue.spamd script. That’s it. All your emails do now pass the SpamAssassin daemon. You can check this by viewing all headers of emails passing your system. They should now contain additional SpamAssassin lines.
This is not the end of the story. We just marked email so far as spam or not. The will not get filtered out of the boxes, yet. This however is the topic of part 3 of this series.
This is a series of articles covering integration of SpamAssassin with qmail on a Linux box.
Part 1: Installing and Configuring SpamAssassin
Part 2: Marking email as spam
There are quite a few numbers of HOWTOs at the internet about installing the software itself. So I won’t go very much into details but rather point you to some locations where you can find sufficient information.
You’ll find the latest software package at Apache’s SpamAssassin Homepage. Unpack the archive, preferrably at /usr/local/src. It will produce a directory Mail-SpamAssassin-XXXX. Change into that directory and read the INSTALL file to learn about special features when building the spam recognition tool. Usually you need to issue three commands:
perl Makefile.PL make make install
That’s it. Be aware that you might need to enhance your Perl distribution by additional modules from CPAN.
The last step to perform is to make a tool called spamd running continously on your box. We will first configure the daemon according to your Linux distribution. On latest SuSE editions this is done by a file /etc/sysconfig/spamd:
## Path: Network/Mail/Spamassassin ## Description: Arguments for the spam daemon ## Type: string ## Default: "-d -c -L" ## ServiceRestart: spamd # # The arguments passed to spamd. # See spamd(1) man page. # Default is "-d -c -L" SPAMD_ARGS="-d -c -u spamd -g spamd --socketpath=/tmp/spamd_full.sock"
We introduced a user and group called “spamd” here. You might need to configure them first on your system.
Finally, you can add according startup commands in your /etc/rc.d directory to make spamd starting at system boot. Here is a script that I use.
Part 2 of this series will concentrate on the issue how to pass each mail into SpamAssassin.
You propably got already used to Firefox’ zoom feature. Firefox 3 introduced a new setting that enables it to remember the zoom value when you visit a website. Whenever you re-visit the domain, the previously used zoom level will be re-applied.
If you don’t like this feature, open the about:config page and toggle the boolean setting browser.zoom.siteSpecific to false.
Of course, you can always use Strg-0 to reset the zoom to the default value.
I decided recently to publish my very simple utility classes for reading and writing CSV files. The main project page is now available. The package, published under the GNU Lesser General Public License, allows you to easily integrate CSV functionality into your application. The utilities can be configured to use different column delimiter and separator characters in case you need to adopt some other versions of CSV. The default configuration conforms to the Excel style of CSV.
Since this CSV package uses streams, you are able to read from any stream. And, of course, you can write to any stream. You could even synchronize in your application by applying the reader/writer synchronization described in one of my artices.
You can download the latest stable release at the main project page.
Here is a short example on reading a CSV file using the CSVReader class:
java.io.File f = new java.io.File("csv-test.csv"); csv.CSVReader in = new csv.CSVReader(new java.io.FileReader(f)); while (in.hasNext()) { String columns[] = in.next(); // Do something here } in.close();
Please note that the CSVReader class actually implements the Iterator interface.
Writing a CSV file is even easier. Just create an instance of the CSVWriter class and pass it your rows:
java.io.File f = new java.io.File("csv-test.csv"); CSVWriter out = new CSVWriter(new java.io.FileWriter(f)); out.printRow(new String[] { "0:0", "0:1", "0:2" }); out.printRow(new String[] { "1:0", "1:1", "1:2" }); out.close();
The API documentation tells you all details and configuration parameters that you can use to control the behaviour of the reader and writer classes.