Jul 20 2008

Compile a perl script that uses Wx with pp and PAR

Tag: Uncategorizedtengo @ 9:30 am

Compiling scripts with pp, PAR’s helper script, to executable binaries (.exe files on Win32) should be a pretty straightforward process. Anyway, if you are developing GUI applications, probably with Wx, you will surely run into some problems.
Upon execution, the generated execs will complain about missing libraries, DLLs or similar. This is because pp does a […]


Jun 21 2008

Shorthand if-clause

Tag: Uncategorizedtengo @ 7:10 am

There is a handy short version for a classic if-else-statement that is very useful, but everytime I’d like to use it, I just can’t fully remember what its syntax was. And looking it up on google is hard, because “if” is a very common word… It is especially useful on initializing variables in a cgi […]


Jun 17 2008

Working with very large hashes

Tag: Uncategorizedtengo @ 10:59 am

Recently, I had to wrangle a large dataset, with over 3 million key-value pairs. I need to iterate over them in a sorted way and I needed the hash-structure to weed out “already-seen-keys”.
My first approach was to build a hash in memory, with the usual my %hash, then adding keys and values in a giant […]


Jun 01 2008

How to format a string with leading zeros?

Tag: Uncategorizedtengo @ 9:09 am

A quick reminder:
How do I pad a string so that a number or string gets leading zeros?
Answer:
By using sprintf:
my $number = 123;
$number = sprintf(”%07d”, $number);
print $number;
Output: “0000123″
after the %: “0″ is the character to add, <number>d is the amount of digits (that’s why it’s “d”) to add. See the documentation for sprintf.


Apr 24 2008

Converting ANY video with ffmpeg (letterboxing/pillarboxing)

Tag: Uncategorizedtengo @ 5:17 am

When you use ffmpeg to transcode videos from various sources and in various sizes, formats and aspect ratios to a given destination format, you can’t rely on ffmpeg alone to produce the expected results. In this post we will have a look at how we can dynamically letterbox or pillarbox (black bars on the sides […]


Mar 26 2008

What I’ve learned from writing a large scale search engine

Tag: Uncategorizedtengo @ 3:09 pm

Writing a large-scale web-crawling and web-indexing search engine from scratch is a large beast to tame and in many cases a project that is heading for desaster right from the start. As you can read in Alex’s worklog for the ongoing effort to manage the Majestic-12 distributed search engine, writing a crawler alone can cost […]


Mar 20 2008

Install cpan on a server without root access

Tag: setupadmin @ 3:31 am

As you can see from reading this discussion, installing a cpan module, without root access, can be daunting. When you managed to install your own compiled Perl on a non-root account, this is in most cases earlier or later the next step/problem. Do this:
login via ssh
ssh remotehost.com -l myusername
create these directories:
myperl/man
myperl/man/man1
myperl/man/man3

then start your perl and […]


Mar 20 2008

What it is all about

Tag: Uncategorizedadmin @ 3:11 am

In this blog, I’d like to publish trick, tips and hints related to the scripting/programming language Perl, which should not be confused with PEARL.
Although the origin of the name Perl are a more adventurous story, today most agree that Perl stands for Practical Extraction and Report Language, which summarises quite well what it does but […]