Links
Archives
Random notes from yet another Finnish nerd. This blog reflects mostly my life with computers and stuff, rather than my real life.
May 29, 2004
Did a bit of Perl hacking today. Encrypting/decrypting a file with Blowfish cipher goes like this:
use Crypt::CBC;
use Crypt::Blowfish;
open(IN, "secret.txt") or die "Unable to open for reading, $!\n";
open(OUT, ">message.txt") or die "Unable to open for writing, $!\n";
binmode IN; # for win32
binmode OUT;
my $cipher = Crypt::CBC->new($key, 'Blowfish');
$cipher->start('decrypting');
my $buff;
while (read(IN, $buff, 1024)) {
my $block = $cipher->crypt($buff);
print OUT $block;
}
close IN;
close OUT;
$cipher->finish();
May 25, 2004
gtk2-perl for win32
Decided to try gtk2-perl on win32 today. There were some rough edges but it went something like this:
- Upgraded to ActiveState Perl 5.8 (gtk2-perl doesn't support 5.6 releases)
- Downloaded binary installers for Glib and Gtk+ 2 Perl modules
- I had already installed GTK+ 2 for Windows. I also happened to have an older version of iconv.dll somewhere else in the PATH. Had to remove it to make gtk2-perl work.
- Verified the thing works by hacking together the following simple image viewer utility:
#!/usr/bin/perl
#
# Simple image browser.
# Directory containing images given as command line argument.
use strict;
use warnings;
use Glib qw(FALSE TRUE);
use Gtk2 -init;
use Gtk2::SimpleList;
use File::Spec;
use constant TRUE => 1;
use constant FALSE => 0;
die "Usage: $0 directory\n" unless @ARGV;
my $dir_base = $ARGV[0];
opendir(DIR, $dir_base) or die("Directory open error: $!");
my $window = Gtk2::Window->new;
my $image = Gtk2::Image->new;
my $list = Gtk2::SimpleList->new('Image name' => 'text');
foreach(readdir(DIR)) {
my $file = $_;
if($file =~ /\.jpe?g$/i) {
push @{$list->{data}}, [ $file ];
}
}
$list->set_rules_hint (TRUE);
#$list->signal_connect (row_activated => \&row_clicked); # double click event
$list->signal_connect (cursor_changed => \&row_clicked); # focus change event
my $scroll = Gtk2::ScrolledWindow->new(undef, undef);
$scroll->add($list);
$scroll->set_policy('never','automatic');
my $hbox = Gtk2::HBox->new;
$hbox->pack_start($scroll,FALSE,FALSE,0);
$hbox->pack_start($image,TRUE,TRUE,0);
$window->add ($hbox);
$window->set_default_size(800,600);
$window->show_all;
$window->signal_connect (delete_event => \&delete_event);
$window->signal_connect (destroy => sub {Gtk2->main_quit;});
Gtk2->main;
sub row_clicked {
my ($model,$iter) = $list->get_selection->get_selected;
my $filename = $model->get ($iter, 0);
my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file (File::Spec->catdir($dir_base, $filename));
$image->set_from_pixbuf($pixbuf);
$window->set_title ($filename);
}
sub delete_event
{
return FALSE;
} - Some of the examples and gtk2-demo in gtk2-perl source archive failed to work out of the box. There was also a lot of warnings about TRUE & FALSE being undefined. I simply ignored them or defined constants called TRUE & FALSE.
Blogger software on Slashdot
There was another story on on MovableType 3 licensing changes. Seems like a lot of the open source folk are gonna move on to open source blogger software, such as WordPress, Blosxom, Drupal and LiveJournal.
May 18, 2004
Today I checked GhostScript out of CVS and compiled from source on win32, using Visual Studio .Net 2003. It went like this:
- Get module 'gs' from GhostScript CVS
- Download jpegsr6.zip, lpng125.zip, zlib121.zip & jbig2dec-0.6.zip and extract them into subdirectories jpeg, libpng, zlib & jbig2dec under the gs directory.
- run from DOS box:'nmake -f src\msvc32.mak MSVC_VERSION=7 DEVSTUDIO="C:\Program File
s\Microsoft Visual Studio .NET 2003" - Directories bin, lib, Resource, examples and doc are ready to be copied into the installation directory.
- Create registry keys GS_DLL and GS_LIB under HKEY_LOCAL_MACHINE\SOFTWARE\AFPL Ghostscript\8.30 to finish the installation.
May 14, 2004
In seek of the ultimate archiving system for my digital photos I went through a bunch of image viewer/archiving software.
Many of these applications provided support for email and online printing / album hosting services, such as ShutterFly. While I don't find these features interesting, they might be of great value for some users.
- Adobe Photoshop Album 2.0 seems to be the one best software available. However, it's most usefull features such as calendar view, collections (i.e. virtual albums) and backup to CD are only available in the purchased version ($50).
- ACDSee 6.0, the long time image viewer champion keeps getting better and better. New features of version 6 are backup to CD, browse by calendar or categories and rating. $50.
- Paint Shop Photo Album 5. Jasc Software has a long history on Windows image viewer / editor business. Their album application's features include: CD burn, import from cell phone and panorama stitch.
- Picasa. Feature highlight is Blogger image upload.
- Canon ZoomBrowser EX. The user interface has some nice effects on dynamically zooming the thumb nail size according to the number of images in the folder. This package also includes PhotoStictch software for making panoramo pictures out of multiple shots. Otherwise the software seems buggy, slow and limited in features. Notable shortcomings are lack of backup and no browsing by calendar.
- digikam. This one's only for KDE/Linux but contains a lot of the same features as bleeding edge windows counterparts.
Many of these applications provided support for email and online printing / album hosting services, such as ShutterFly. While I don't find these features interesting, they might be of great value for some users.
May 13, 2004
Did some more fooling around with Suse 9.1 and my K7N420 nforce based mother board. The network interface aws automagically detected and configured using the forcedeth driver. However, there was no way I could make the onboard sound work with ALSA drivers (snd_intel8x0). NForce audio was properly detected, modules loaded and mixer set up, but there was simply no sound from the speakers (and no, the mixer wasn't muted). This seems to be a known problem with Suse 9.1.
May 10, 2004
Today I dowloaded and tried Suse 9.1 Live CD. Some highlights of its contents are kernel 2.6.4, KDE 3.2.1, OpenOffice.org 1.1.1, Gimp 2.0, Java 1.4.2_03, Acrobat Reader 5.0, xmms, Kaffeine (Xine based player). All and all, it really feels the most polished and consistent KDE Linux setup I've tied (at least when comparing to Knoppix 3.4).
When testing on VMWAre 4.5, the system hung during boot (something PCMCIA related) unless I selected verbose mode from the boot options. Go figure....
When testing on VMWAre 4.5, the system hung during boot (something PCMCIA related) unless I selected verbose mode from the boot options. Go figure....
May 06, 2004
I just went through configuring Mozilla on Debian to use MS Arial Unicode (included in e.g. Office) as font for UTF-8 encoded web pages. What I did was something like this:
- Copy file ARIALUNI.TTF from c:\WINNT\Fonts to /tmp/fonts on the Linux side
- Install debian package ttf-commercial and type /tmp/fonts as the font directory
- Your fonts should've ended up in /usr/X11R6/lib/X11/fonts/TrueType
- Gnome:Desktop Preferences->Font->Details->Show directory should provide a list of fonts, including the newly installed ones
- Launch Mozilla and set font for Unicode encoding as 'MS Arial Unicode'
- Remove /tmp/fonts
Today I did a bit of browsing for desktop blog clients and ended up trying w.bloggar. It's win32 freeware and seems quite sweet so far.
May 01, 2004
After reading an article on mobile phone blogging I finally decided to roll my own blog. Expect to find more or less useless thoughts on computers, photography etc. here.
Microsoft Dev Days took place last thursday. The emphasis was on programming secure code. Some hands-on examples were actually quite good stuff. The coverage however could've been more thorough. Examples included standard exploits such as SQL injection (e.g. text ''; drop table address --' typed into a web app's search input field) and cross site scripting (e.g. text <script>location.href='spammer.com'</script> typed when creating a new record in some web app. This gets run by some one else's browser unless the output was properly HTML encoded).
Microsoft Dev Days took place last thursday. The emphasis was on programming secure code. Some hands-on examples were actually quite good stuff. The coverage however could've been more thorough. Examples included standard exploits such as SQL injection (e.g. text ''; drop table address --' typed into a web app's search input field) and cross site scripting (e.g. text <script>location.href='spammer.com'</script> typed when creating a new record in some web app. This gets run by some one else's browser unless the output was properly HTML encoded).