Trying out Sim

During the last few days I’ve been trying out Sim. Sim is yet another open source Instant Messaging (IM) client that supports a variety of protocols (ICQ, Jabber, AIM, and MSN). I am currently interested only in ICQ though.

Before Sim I’ve been using Licq for a long time and centericq before that.

I switched from centericq to Licq because I wanted to have annoying notifications on new messages while in graphical mode. Otherwise I was constantly forgetting that centericq was running in one my konsoles and it stayed there abandoned for weeks.

Licq is almost perfect for my needs. And I wasn’t looking forward to jumping of off it. It’s just that a few people suggested that Sim is a better client in general, and that is solves a few of those issues that I have with Licq.

Continue reading Trying out Sim

Upgraded to WordPress 1.5.1.3

I have finally upgraded to this blog to WordPress 1.5.1.3. A couple of security issues with XML RPC are fixed by this release. I was a bit slow, since the fixes were released for over a week now, but not to worry – my PHP installation already had all the fixes for XML RPC installed.

Slashdot is running a story on the issue. One of the comments shows an easy way of upgrading PEAR that not everyone might be familiar with:

pear clear-cache
pear upgrade XML_RPC

Char or trout

Consider the joke told by Richard Stallman that I read in this article:

Once I was eating in Legal Sea Food and ordered arctic char. When it arrived, I looked for a signature, saw none, and complained to my friends, “This is an unsigned char. I wanted a signed char!” I would have complained to the waiter if I had thought he’d get the joke.

Until today, the word “char” had only one meaning to me. It was a computer term, which is used as a declaration of a character or string variable in some programming languages. Such as C, for example.

It turns out, that there is another meaning. Here is a quote from the dictionary for you:

also charr (n. pl. char or chars also charr or charrs)

Any of several fishes of the genus Salvelinus, especially the arctic char, related to the trout and salmon.

Wikipedia entries for those of you who want to learn more on this fishy subject: Salvelinus, Arctic char.

Analysis of two perl lines

Today I saw these two lines in one backup script that was written in perl:

my $d = (localtime())[6];
$d = $d=~/[067]/ ? 0 : $d % 2 + 1;

Does this look cryptic to you? Probably not. But I wanted to write something and thought that these two lines won’t be that obvious for everyone out there. So I decided to explain exactly what goes on.

Before I start, I have to say that these are not just any two random lines of perl code. These are very useful lines that provide a short and elegant solution to a rather common problem. Read on if you interested.

Continue reading Analysis of two perl lines

Profiling perl

After I’ve complained on #perl channel that dprofpp (perl profiler) dies on me, I received a number of suggestions on how to profile the code without using dprofpp. Ideas ranged from elemetary insertion of ‘print “Started”, time,”\n”‘ to all sorts of dynamic subroutine overloading. Here is one elegant solution that was suggested:

sub foo { print "foo (@_)\n" }
sub bar { print "bar (@_)\n" }

for (qw(foo bar)) {
  my $name = "main::" . $_;
  my $old = *$name{CODE};
  *$name = sub {
    print scalar(localtime), " Started $name\n";
    &$old;
    print scalar(localtime), " Finished $name\n";
  };
}

foo(qw(one two));
bar(qw(three four));

Oh, and someone also mentioned that dprofpp is known to be buggy. Here is a quote from the “Profiling Perl” article at perl.com:

The other problem you might face is that Devel::DProf, being somewhat venerable, occasionally has problems keeping up on certain recent Perls, (particularly the 5.6.x series) and may end up segfaulting all over the place.