Archive for January, 2008

28
Jan

Portable Gaming

I just bought a Nintendo DS Lite along with 2 games.  The games are The Legend of Zelda, Phantom Hourglass and Picross DS.  I have never owned any sort of portable gaming device before.  I am really impressed with the gaming experience so far and how fun playing games with a stylus and 2 screens can be.   This was actually hard to find right after Christmas but stores have finally been getting these back in stock.

24
Jan

File::Find and a need for a closure

Say you need to recurse through a directory and it’s subdirectories for files. Think File::Find. Say you need to query a database for each file you find during the recursive search. Think closure. The “wanted” function reference that is passed to the “find()” function does not except arguments but you need to access data that is outside the scope of this “wanted” function.

The scope of the database handle makes it invisible to the “process_files” function. A closure seems to be a good solution to providing access to it.

package MyPackage;
use strict;
 use base 'MyAppBase';
 use File::Find;
sub run {
 my $self = shift;
 my $dbh = $self->database(); # active DBI connection handle
 my $conf = $self->conf();
sub get_dbh { return $dbh; } # Closure
my $dir_to_search = $conf->{foo_dir};
find(\&process_files, ($dir_to_search));
}
sub process_files {
 my $in_file = $File::Find::name;return unless -f $in_file;
my $dbh = get_dbh(); # use closure
my $sql = "SELECT * FROM TABLE WHERE FILENAME = ?";
my $sth = $dbh->prepare_cached($sql);
$sth->execute($in_file);
my $dbrec = $sth->fetchrow_hashref();
}
13
Jan

A movie called “Once”

I just watched the movie called “Once” and it is one of the best movies I have seen in a long time. The movie itself is simple but also brilliant at the same time. I really enjoyed the music throughout the film so I jumped onto iTunes and bought the soundtrack. The music reminded me of David Gray or Damien Rice and how clever the lyrics are. This movie is definitely worth watching if you have not seen it.

06
Jan

Harry Potter and the Deathly Hallows

I just finished reading the “dead tree edition” of Harry Potter and the Deathly Hallows.  The last of the seven books was definitely my favorite of the series.  I highly recommend reading the entire series of novels.  Each book in itself is entertaining but the story that progresses throughout the series of novels is an amazing piece of fiction literature.  I do have mixed feelings about the ultimate ending for Harry and Voldemort.  I almost wanted to see Harry and Voldemort both die in the end as the ultimate sacrifice on Harry’s part to conquer evil considering that the last Horcrux was part of Harry himself.  Maybe it seemed too much of a stretch to allow Harry to live but the last Horcrux(piece of Voldemort’s soul) was somehow destroyed.  I really did enjoy the whole turn of events at the end of the novel and how it wrapped up the story as a whole.