Lazy Programmer

tips for open source software

Watermarking with Text

Examples of ImageMagick Usage is an excellent  HOWTO.   It contains a section which describes how to watermark with text.

December 29, 2005 Posted by Wang Liang | ImageMagick | | No Comments Yet

GnuPlot Tutorial

It’s a little bit hard to start learning gnuplot by reading manual. “Introduction to GnuPlot” is a great tutorial for beginner. And here is a shorter one.

December 20, 2005 Posted by Wang Liang | GnuPlot | | No Comments Yet

Two Perl modules to handle table

I’ve been using Text::Table to output data onto screen and HTML::QuickTable into HTML file.

Text::Table can output data in table format with or without border which is composed of special characters. Here is an example:

use Text::Table;
my $sep = ' | ';
my $tb = Text::Table->new (\$sep, "Header", \$sep, "Index", \$sep);
my @data;
# ... fill @data
$tb->load (@data);
print $tb->rule('-', '+');
print $tb->title;
print $tb->rule('-', '+');
print $tb->body;
print $tb->rule('-', '+');

If you haven’t used this module, please try it to see what happens by filling dummy data into @data.

HTML::QuickTable is good at generating HTML table or entire HTML file from special data structure with little efforts. For example,

my @body;
while (<>) {
    chomp;
    my @row = split /,/, $_;
    push @body, \@row;
}
my $qt = HTML::QuickTable->new;
print $qt->render (\@body);

But it gives less control on table layout than HTML::Table. I will not give example since help is written well and its usage is simple.

December 20, 2005 Posted by Wang Liang | Perl | | No Comments Yet