March 2008


I recently ran into a problem where a whole bunch of strange filenames with strange characters appeared in a home directory in linux.  Because the filenames had wildcards in the naming, it was a little tricky to delete them.  For instance say you have a file named   m?v?.   I initially thought I could use perl and stat to get narrow them down and unlink them.  However, the stat did not seem to return any data on these strange files.  My next idea was to use the octal display,   if you run a  ls -b   to display the file in octal you might see something like m\173v\002  to delete this you would type  rm m$’\373′v$’\002′     however, I ran into some filenames that still had strange characters with octal display.  My final solution was a windows / linux mix.  Since they were all created a specific time, the easy solution was to open up the directory in windows via Samba and then just sort by time, select, and delete.  This did the trick.

I recently picked up a creative zen vision w media play from circuit city.  It was on clearance since they were not longer going to carry the item.  This worked out well for me since I wanted this particular model.  I chose it over others because I only wanted to play videos and not surf the web with it.  I am still reviewing the battery performance so I can only say that the reviews mentioned this was one of the better models.  What is great about this unit is the large 4.3″ screen.

The one problem I had with the unit is the formats supported.  It mentions support of a large variety of videos formats where in reality it only supports a small subset.  It relies on a windows based converter to change into the correct format, however this process has yet to succeed for me.   I really do not care as I figured out the format it needs, and I just use linux tools like ffmpeg and mplayer to convert the video to that format.

What is really great, is that I can download all these lectures from online sites and load them right up into the machine.   It has given me something productive to do on the train to work.

I was looking across some perlmonks posting, and I came across a reply to a post that seemed useful. Putting this in a crontab will automatically update the CPAN modules that you have installed in your system.

perl -MCPAN -e ‘CPAN::Shell->install(CPAN::Shell->r)’

I wanted to make a program to scan a particular folder in my outlook 2003 that holds messages placed there by a rule. However, due to outlook security, a pop up appears to confirm access to outlook when you try to access the emails. This is a major roadblock to automating email access on windows xp. I could not find a clear example on the web that used another pst file so I created this example. I hope this helps someone out down the line.

There is a solution called Outlook Redemption that solved the pop-up problem for me. You can install a copy on windows from the site http://www.dimastr.com/redemption/ .

Once you have this installed, make sure you have a copy of strawberry perl http://strawberryperl.com/ . I happen to use version 5.8 but I will switch to 5.10 soon. With this installed, you will also need the module Win32 installed, but this is easy since you can install perl modules with CPAN on windows when you have strawberry perl setup.

Here is the code that scans a different pst file called otherpst and a folder within that pst file called scanme

#!perl # windows notation

use strict;
use Win32::OLE;
use Win32::OLE::Const;
use Win32::OLE::Const ‘Microsoft Outlook’;
my $outlook;
eval {
$outlook = Win32::OLE->GetActiveObject(’Outlook.Application’)
};
if ($@ || !defined($outlook)) {
$outlook = Win32::OLE->new(’Outlook.Application’, sub {$_[0]->Quit;})
or die(”Cannot create outlook\n”);
}

my $namespace = $outlook->GetNamespace(’MAPI’);

# get the proper pst file
my $folder = $namespace->{’Folders’}{’otherpst’};

# now get the folder within the pst file
my $folder2 = $folder->{’Folders’}{”scanme”};

# get all the messages
my $msgs = $folder2->{Items};

# a count of the number of messages in the folder

my $ncon = $msgs->{Count};

# a redemption object that stops the annoying popup

my $tysonmaly = new Win32::OLE(’Redemption.SafeMailItem’);

my $con;

# for each message in the scanme folder print the body out to STDOUT

foreach my $ii (1 .. $ncon) {
$con = $msgs->Item($ii);
$tysonmaly->{’Item’} = $con;

# you can access other things like the subject or sent time or sender but this just shows body access

print $tysonmaly->{Body} . “\n”;

}

I have been meaning to starting updating my site, and I have always wanted to list the restaurants I have come across in my travels. Today I was driving up north street to check out an Indian restaurant that I saw one day. It just happened that they were closed till 5 pm. So I headed back down towards main street. On the way I saw a sign for pho vietnam restaurant and decided to give it a shot. I usually am able to find good places using zagat, but this time, zagat was not up to date. They last rated the place in 2004-2005. The place was small, but the food smelled great. I started out with two orders of spring roles. They were huge and quite filling. For the main course I ordered this chicken dish with pineapple in a sauce with rice. My partner ordered a pork dish with a red curry and coconut milk. Both dishes were excellent, and the place was very reasonably priced. The final bill with tip was $36, but it would have been $10 cheaper without the spring rolls. I left there with a full stomach and half a dish left for a midnight snack. If you are interested in checking this place out, you can get directions off of their website www.phovietnamrestaurant.com