Archive for the 'Work' Category

Tying Perl hashes to Amazon S3 buckets

Sunday, December 16th, 2007

As mentioned last time, I released my first Perl module to the CPAN, called Tie::Amazon::S3. What it does is rather simple: it allows one to treat an Amazon S3 bucket as a Perl hash, like so:


use Tie::Amazon::S3;
tie my %bucket, 'Tie::Amazon::S3', $my_aws_id, $my_aws_passwd, $my_s3_bucket;
 
# read a remote file to a scalar
my $textfile = $bucket{textfile};
 
# write some text to a key
$bucket{'songs/freesoftwaresong/list'} = <<EOF;
freesoftwaresong.au
jonobacon-freesoftwaresong.ogg
Fenster-FreeSoftwareSong.ogg
EOF

Tie::Amazon::S3 builds on top of Leon Brocard’s Net::Amazon::S3 module, so one can still do other actions such as setting a key’s ACL by accessing the tied(%bucket).

Today I made another version of that module, completing the hash abstraction by implementing some missing methods, allowing one to iterate through the list of available keys in the bucket (e.g. foreach keys %bucket and such.)

As mentioned, it can be found on the CPAN, but I also have a git tree up. Helpful comments & patches are welcome!

Off to OSDC

Saturday, November 24th, 2007

Tomorrow I’ll be off to Brisbane, Australia to attend the Open Source Developers’ Conference. My thanks to the UNDP-APDIP International Open Source Network and the OSDC organizers for selecting me to participate in their Exchange Grants! I thought I wasn’t going to make it, though, as the notice from IOSN came rather late, and I had to get my (first ever) visa at the last minute. (Now, if only I can find a good place to stay for the nights. Can anyone suggest a few? :)

I hope to see some fellow Perl mongers, Debian users, and Ubunteros and learn a lot from this experience. OSDC here I come! :D

Working with Mac-sent attachments in Linux

Wednesday, October 10th, 2007

If you’re reading mails offline on Linux (or if you’re browsing from GMail,) and you have some contacts using a Mac who sends you emails with attachments from Mail.app, you may some of the time get attachments that may seem to be unreadable by the intended application (like, when some Mac guy sends you a mindmap file in FreeMind that you can read in Ubuntu.) I recently hit this snag at work, so I did a little looking around to see why this is so, and how to fix it.

The first thing I did, after downloading the attachment, was to obviously `pager` it. :P What seems to be a single attachment is in fact a couple of MIME objects, one an `application/applefile’ object, and an `application/octet-stream’ object. Since both are Base64-encoded parts, I can run a simple filter (using Perl’s MIME::Base64::decode_base64 routine) on both to get the raw parts. It turns out that the first part is an AppleDouble-encoded resource fork that describes the metadata for the actual file (called the data fork in AppleDouble parlance.) One can read this on Linux via Perl using the Mac::AppleSingleDouble module to get Finder information, among other things.

However, for non-Mac users, what they’re really interested in getting is the the data fork. This can be done by using Email::MIME on the original message to get the data fork subpart, then filtering it through MIME::Base64. (Or you can cheat by using the already-downloaded AppleDouble attachment and extract+decode the octet-stream part as mentioned earlier.)

Weekend Hacks: growl-notify and weeter for WeeChat

Tuesday, August 28th, 2007

This weekend, a rather long one due to the observance of the National Heroes’ day, got me started into doing some little hacks for WeeChat, an IRC client that I have been using in place of Colloquy on the Macbook which I use at work. I have been using WeeChat originally because I’ve been using TOR to connect to the ‘Net, but later on I found out about WeeChat’s extensibility via script plugins that can be written in either Ruby, Lua, or Perl.

And, being the Perl monger that I am, and having lots of idle time (hey, this was a weekend ;) I looked for some way to better integrate my WeeChat to my Mac setup. The first thing I came up with was a way to get the app to send event notifications via the Growl framework (which I got from Adium,) since the WeeChat I have here is a console-only app (there is an ongoing GTK/wxWidgets UI port, but not available yet in MacPorts, where I got WeeChat.) A quick look at the Growl developer documentation, however, got me looking into Mac::Growl, which provides a very simple Perl interface to Growl. And thus, I came up with growl-notify, which now keeps me up to date on what’s going on in IRC while I’m doing something else.

The other thing that I got to work on with was a simple way to do Twitter status updates while on IRC. Of course, I do have the excellent Twitterific for Mac installed, but again I was raring for some quick hack to do at the weekend, so I decided to do this one too. In IRC, one can pretty much indicate his/her status by using the /me command (which is really a shortcut for doing a CTCP ACTION message, but I digress.) This particular command seemed to be a fairly natural command to tie a Twitter updater with, so it only took a while for me to look up Net::Twitter, write a modifier for the /me command, and come up with weeter.

Now, the week’s back, and I look forward to my work and its pending tasks (currently something involving PostgreSQL, GlusterFS, and lots of Amazon EC2 nodes ;) with a renewed zest for tackling problems. And when weekend comes again, its yet another time to recharge, and perhaps hack some more on better integrating the apps that I use in my workflow (and thus helping my productivity.)

First Day Morphs

Monday, July 16th, 2007

I seriously lack originality on that title above.

Nevertheless, that gives some clues on what I’m up to: I rode my first airplane flight ever to Cebu with Jerome last Sunday to meet up with the rest of the pioneering team of Winston’s new startup, Morph Labs. Since it was a Sunday, there wasn’t much talk about work, but we did get to play with some of the new stuff we will be using, like Macbooks, iPhones, Airports, and a Mac Mini. Hint-hint indeed :P

Thus began the first day, on a Monday. We got up to speed (from a 3-to-7 AM hibernate,) configuring the rest of the Macbooks, getting the HSDPA modems to work, laying out an ad-hoc WiFi net for the moment, and starting to plan out the directions the company will take. So far, so good.

More to come, on Second Life Morphs.

(I seriously need to express myself better.)

Getting back to the Action

Tuesday, July 10th, 2007

I’ve been away from blogging. I’ve been away from doing Debian and Ubuntu work (although there has been a few package updates, as well as a new one.) I’ve been away from a lot of happenings (like how the excellent Knightlust got to convince my fellow townsfolk at Lourdes College Foundation to use FOSS,) but that’s fine, since I know there will be others who can keep up the flame burning.

I’ve been away because I’ve been looking at stuff. Lots of stuff. Various stuff. Stuff like Plan 9 from Bell Labs, and Inferno, and dabbling into distributed computing, working on an implementation of Plan 9’s file protocol. Stuff like thinking about programming, meditating upon it as an art, exercising a discipline of simplicity, clarity and frugality. All that stuff.

I first looked at Plan 9 last March, when I was wanting to go another round at the Google Summer of Code. While I was not selected, just getting Plan 9 to run on my machines (first as a qemu terminal, then as standalone CPU server replacing my old Ubuntu dapper install on my desktop) exposed me to `that other side,’ and that got me thinking about how software ought to be good. Of course, I could have just chosen to drop it all (after all, I wasn’t selected, so…) but I knew that if I stick long enough, I might just learn something.

And yes, I am learning something. Like how a lot of software isn’t really simple, just appearing to be. Or how sophisticated software development methodologies rob the clear picture gained from a well-thought, clear, and simple analysis of problems. Or when push comes to shove, I will have to make a choice, between tolerating software complexity and status quo, or facing it and attempt to simplify it.

Well, there’s much to tell, but I’m lazy, and I’d rather tell stories in bits. Anyway, I think I’ll have some time to spare, especially as I have accepted a new job at an up-and-coming company that, I hope and endeavor, will rock the local and international tech scene. And, while doing that, get around to make great tools to get my job done, and other people’s jobs too.

I’m getting back to the action.

Next Steps

Friday, December 1st, 2006

Yesterday marked the last day of my contract with Orange and Bronze Software Labs. I have been previously doing some work with an up-and-coming messaging platform in C++, and at the end, it was a fun and worthy learning experience. Through them, I’ve seen the `other’ side of software engineering, the side where it is done right.

Calen, Dean, Chelle, Rose, and the rest of the gang: thanks for the fish (and Z’s, Rocklets, countless bottles of iced tea and Pepsi, and KFC dinners.) :D Hope to do bigger catches with you guys in the next lifetime. :P

Unexpected

Thursday, October 5th, 2006

There was no power again at the office today (thanks to my boss for sounding me while I was laying in bed ;) so I had a pretty free day today. This is the first of my Unexpected Series of Events (although, in retrospect, this is somewhat expected since we did lose power at the office yesterday, giving credence to Clair’s story…)

Read the rest of this entry »

Ealden, when you’re out…

Saturday, September 9th, 2006

…I’m in.

Well, at least for tonight, that is. :p