Blog of Leonid Mamchenkov

You just stepped in a pile of posts.

Entries Tagged ‘scripting’

Decimal to binary convertion in Perl

This is a simple thing, but when you need it – you need it. There is no need in implementing a function that does or looking for a module at CPAN. All you are looking for is already there.

#!/usr/bin/perl -w

use strict;

# Get the number from the command line or use default.
my $number = shift || 42;

printf "%b\n", $number;

You might want to refresh you memory of printf or sprintf by flipping though the manual pages.

P.S.: 42 decimal = 101010 binary. Is it cool or what?

Progress with the Gallery2

I am satisfied with the process of my migration to Gallery2. Most of the things work already. Here is a brief round-up:

  • All images and albums are imported, sorted, and thumbnailed.
  • Few albums are tagged for easier searching.
  • Old style of URLs is configured and working. All old links should be fine now.
  • I have familiarized myself with Gallery2 internals a bit. Maybe even more than I intended to.

[Read the rest of this entry...]