Archive for the 'Code' Category

h1

Learning Objective-C…

Tuesday, June 24th, 2008
Programming in Objective-C
So I picked up Stephen Kochan’s book on Objective-C “Programming in Objective-C” (Unfortunately, 2.0 isn’t out until November.  Sucks.)  pretty much because he taught me C back when I was in high school with his first edition of “Programming in C”.  That and the original K&R book on C were my bibles for the language, as I’m sure they were for a lot of people back in “the day”.  Hell, I still have both of my original books from damn near 20 years ago.

Wow.  That’s sort of fucking scary.  I feel old now =(

Moving on…

Now that I’m interested in learning ObjC for Mac/iPhone stuff, I thought it was great that Kochan had a book out on it.  I always liked his writing style, so this should be a good read.  I haven’t coded in C in ages, so hopefully I can ramp up and get back into it without much effort.

At first glance with the language, it shouldn’t be that tough.  There’s many similarities to Perl, at least for me, that will make it easier for me to pick it up.  I never learned C++ or any other strongly OOP language like Java, but Perls modules and class oriented style look pretty similar.

Anyway, hopefully I’ll have some updates on my progress.  And hopefully I won’t fucking pass out from my brain being overstuffed with code.  Dreams about code are never fun.

h1

Mailing an Excel spreadsheet via Perl

Thursday, May 17th, 2007

I thought I would pass on this little tidbit since it took me awhile to find out the specifics. Using the MIME::Lite module, it’s actually pretty easy. The only problem I had was figuring out the correct MIME type to use for the attachment.


my $SUBJECT = q(Example Spreadsheet Email!);
my $MESSAGE = q(This is the main message text body.);
my $XLSPATH = q(/home/foo/spreadsheets);
my $XLS = q(Example-20070517.xls);

my $msg = MIME::Lite->new(
        From    => $FROM,
        To      => $TO,
        Cc      => $CC,
        Subject => $SUBJECT,
        Type    => q(multipart/mixed)
);

$msg->attach(
        Type     => q(TEXT),
        Data     => $MESSAGE
);

if($XLS) {
        $msg->attach(
                Type     => q(application/msexcel),
                Path     => qq($XLSPATH/$XLS),
                Filename => $XLS,
                Encoding => q(base64)
        );
}

$msg->send;

See, pretty painless =)