Hmm…

Most of computer geeks love Star Wars. At least those that I have seen on the web (Slashdot, etc). Now I am really getting interested if my starting to use pack() and unpack() in Perl yesterday has anything to do with me watching three episodes of Star Wars in like two days…

I should keep an eye on this trend.

Next stage of Perl mastery – pack()/unpack()

I have seen many ways to measure someone’s Perl skills. Most of these ways are based on usage of certain Perl concepts. Today I have stepped on the next level according to some skill measurements. I have used the unpack function very naturally, and without much hussle. Here is the snippet:

#!/usr/bin/perl -w
use strict;
my ($year, $month, $date, $hour, $min, $sec) = unpack("a4a2a2a2a2a2", 20040102200534);
print "$date/$month/$year $hour:$min:$sec";

I could have done it before surely, but today it came to me naturally – without any thinking or manual reference. I will have to expand and polish this skill now. pack and unpack are very powerful functions and can simplify life a lot. It’s time I start using them.

lj2mail

With this script I will terrorize my friends from today onwards. What it does is get all the recent posts from some LiveJournal blog and email them as separate messages to a list of recepients. Subject of the blog entry is used as a subject of the email. Body of the message contains of text and the permalink.

In order to use, first configure few simple variables at the beginning of the script, providing LJ credentials, list of recepients, address to use in the From: field and a file to keep the timestamp of the last syncronization.

Changes: in this version I have fixed encoding fo the body and subject. Body can now be recoded with Text::Iconv module to any encoding from the default UTF-8. Subjects are additionally fixed to be base64-encoded.

lj2mail.pl

Continue reading lj2mail

Fonts for programmers

Via this entry in Joe Grossberg‘s blog, I came across a couple of pages that link to and compare monospace fonts. Programmers spend a lot of time looking at text monospaced text, thus the choice of good font will probably increase the productivity. Apart from the usual requirements of sharp letters and multiple encodings, good differentiation between “o” (lowercase “o”), “O” (uppercase “o”), and “0” (zero) as well as “i” (lowercase “i”), “I” (uppercase “i”), “l” (lowercase “l”), and 1 (one) are greatly appreciated.

These pages are here and here.