Archive for the 'Life' 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!

To Australia and Back: OSDC Brisbane 2007

Saturday, December 15th, 2007

Its been a couple of weeks since the Open Source Developers’ Conference in Brisbane, but it was only now that I’ve got the time to blog about it. :) This is due to some work that got piled in my backlog (I haven’t been lazy enough to have this work all automated yet :().

First off, my trip to Brisbane was a long one, due to the UNDP travel agency giving me a route taking me to Bangkok first, because of my exchange grant’s papers made in short notice. No matter: this being my first ever international trip, this meant that I would be visiting two different countries in just one shot.

Bangkok was just an overnight stay though, so I didn’t see much, but their new airport was nevertheless impressive. Arriving there at almost midnight, the only bright places I saw were the big Suvarnabhumi airport and the Novotel where I had my layover. After some sleep, I had a pleasant morning, but only a short one at Bangkok, as my flight to Brisbane followed after:

DSC06879.JPG

The Brisbane flight was long, and I arrived just an hour before midnight. Now, my next problem was getting a place to stay.

I took an airport shuttle to the Royal on the Park, where the conference will be held, first to see if there are any free rooms, or barring that, some recommendation on nearby places to stay, even if only for the night. I was quite anxious because I wasn’t able to arrange for accommodation prior to this trip (short notice, remember?), so I decided to go directly to the venue to be the best way of trying my luck.

And try my luck it was! First, I was greeted by a front desk manager who turned out to be a fellow Filipino, and he helped me get a room in the hotel. At the time though, he could not guarantee that I can stay there for the duration of the trip (only for the night) but he would help me to find alternate accommodation instead on the next day. I thought that was good enough, since it was already midnight by the time I reached the hotel, and just a bed to sleep on for the night would do great for me to worry about moving elsewhere later.

And the next day: Day 1 of OSDC:

DSC06880.JPG

I was up rather too early that day; the worrying about moving elsewhere settled in too early as well, and had made me check out very early so I can hopefully look for that alternate accommodation by lunchtime. One by one, the attendees came, and soon enough more than a couple of hundred people were filling the main conference room, waiting for OSDC to begin. And we began with a keynote from Rusty Russell on C, the humbling language and Ian Clatworthy’s talk on distributed version control systems.

After the keynote, I was notified by the hotel management that instead of moving elsewhere, I can just remain there for the duration of the conference. I was quite relieved!

For the remainder of the day, I listened in on the Perl stream of talks from Kirrily Robert, Josh Heumann, and Jacinta Richardson, on packaging Perl modules, Perl 6, and Perl code optimizations, respectively. Kirrily’s talk was timely since I am writing a couple of Perl modules to be released on the CPAN (one, Tie::Amazon::S3, is now up ;)

On the morning Day 2, I listened in on Mark Rees’ talk on testing web applications using twill and a scripting language, like Python. I then followed Adam Kennedy’s talk on the CPAN 1.5, learning about CPAN::Mini, the CPANPLUS (which IIRC will be standard in Perl 5.10) and the Tiny modules in the process. More on the Perl stream continued with another talk from Josh Heumann on intermediate Perl testing, providing a humorous yet informative strategies not really just for testing Perl scripts or modules but for software testing in general:

DSC06888.JPG

Later in the afternoon was Paul King’s talk on agile developer practices for dynamic languages, covering Groovy and Ruby. That was later followed by Leslie Hawthorn’s talk about the Google Summer of Code and the announcement of the Highly Open Participation contest for the young geeks who are not yet in college or university but would like to work on open source projects just like the SoC-ers.

After the day’s schedule of talks, there was a break before the conference dinner, allowing also for a short keysigning session and CACert identity check.

Then, we had the conference dinner, sponsored by Google. There was also a game held: every table makes up a team who, given some Play-dohs and imagination, are to make up a `bug’; the best `bug’ wins a free book. Unfortunately, my table/team didn’t win any books, but that was beside the point anyway, as the bugs that were made up were quite something:

DSC06898.JPG

DSC06895.JPG

On the last day, the morning talks I attended were all about Ruby and Rails. Nic Williams gave an introductory talk on Rails, then Paul King gave another talk, this time on Grails (the Java version of Rails,) and closing the morning session was Keith Pitty’s talk on Ruby for Java shops. For the afternoon, I followed Adam Kennedy’s talk on optimizing projects for wetware.

DSC06936.JPG

For the closing keynote, Nat Torkington talked about the future of software:

DSC06945.JPG

And with a day left before returning home, I went to sightseeing mode, bought a couple of books, and the mandatory pasalubong for the relatives. At midnight, my flight took me back to Bangkok, another long trip that touched down at the crack of dawn:

DSC07034.JPG

After a few hours’ wait, I took the plane back to Manila, returning home just after lunchtime.

This being my first international trip, making it alone seemed to be quite an adventure. But I wasn’t really alone in this endeavor: kudos goes to the UNDP International Open Source Network for their exchange grant program, to my relatives for their support, to Free and Open Source Software for really making things rock (and free ;), and to $DEITY for being there.

Until the next trip!

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.

Obligatory

Friday, May 4th, 2007

09f911029d74e35bd8415635688c0

Palm to offer Palm Leaves for Palm Sunday

Sunday, April 1st, 2007

In a yet futile attempt to write an April Fools’ Day joke, Palm Inc. will be offering palm leaves to Christian Palm buyers in observance of Palm Sunday.

Palm officials declined to comment.

Smarty enough for Smart Bro, and 3G

Tuesday, January 23rd, 2007

Finally, I’m now on broadband! :D

I made the move today to Smart Bro as they have been touting a promotion offering free installation and a 384 Kbps connection via their Canopy system. As I’ve been mostly offline (or slightly online, counting the occasional GPRS modem connection on a GSM network) I figured that this is the best way at the moment to get broadband connectivity, as the only DSL choices available locally have been either seriously damaged (due to the last supertyphoon) or excessively priced (with unpredictable foreign-currency adjustments.)

So, needless to say, I’m now enjoying myself with this new investment. Adding to this, I also got a new Netgear WGR614v7 wireless router so I can share the connectivity with perlis. While not exactly as flexible as the famous WRT45G from Linksys, it surely does the job to sharing the Net, so I’ve no complaints about it. And I’ve no complaints about the service offered by Smart Bro, either; the installer did an absolutely good job of making sure that the Canopy SM is on the most receptive direction and even gave me some pointers on what to expect with such a connection. Actually, I’ve already made arrangements about the peeves experienced by other Smart Bro users by taking a cue from Joey Hess by setting up the right service caches and by being not too abusive with my expectations.

But, I still have a lot to expect with this new connection. After all, I still have a few more items on my TODO that needs doing, namely writing about what the hell happened to me since last month until now, and my future directions (erm, resolutions) for this new year. Ah well…

… but first, I need to do some monster dist-upgrades… :P

BTW: a UMTS (3G) signal has finally been broadcast in Daet, giving me a reason to also have smart-3g as a backup service in case the Canopy goes down. Yipee!