Halloween 2008

When I was a kid here in Peru we didn’t celebrate Halloween at all. October 31th is for the day of peruvian folk music and tomorrow is also a holiday but today Halloween time got us inspired at work and got some pumpkins to carve some cool designs on them.

Since we are a Django shop at Aureal we got this Django pumpkin carved:

This is how my desktop looked today for a while at work. I’ve posted this pic to Deskograpy too.

Installing Cherokee 0.9.x on Ubuntu Hardy

The Chrerokee Web Server is an extremely fast modular opensource HTTP daemon written by my good friend Alvaro Lopez Ortega from Spain. The project has recently been making great progress towards the 1.0 release. The product has been very stable for years and since version 0.6 includes a web-based administration interface so you can avoid tweaking text files manually like you still have to do with Apache, Lighttpd or nginx.

Installing the latest Cherokee package in Ubuntu Hardy can be a little tricky. The version that’s included with the distribution is mantained by the MOTU team and based on the Debian version mantained by another good friend Gunnar Wolf from Mexico.

The packages for the latest version of Cherokee are mantained by Leonel Nuñez, also from Mexico, and are found in his PPA apt repo so in order to install them on Hardy you have to follow these steps:

STEP 1) Add the PPA repo to /etc/apt/sources.list

Simple adding this two lines to the files does the trick:

deb http://ppa.launchpad.net/leonelnunez/ubuntu/ hardy main

deb-src http://ppa.launchpad.net/leonelnunez/ubuntu/ hardy main

STEP 2) Configure the prefered version of the packages at /etc/apt/preferences

This is the most tricky part, simply add these lines in this file. If you don’t have it just create it.

Package: cherokee

Pin: version 0.9.4-1*

Pin-Priority: 999
Package: cget

Pin: version 0.9.4-1*

Pin-Priority: 999
Package: libcherokee-base0

Pin: version 0.9.4-1*

Pin-Priority: 999
Package: libcherokee-base0-dev

Pin: version 0.9.4-1*

Pin-Priority: 999
Package: libcherokee-config0

Pin: version 0.9.4-1*

Pin-Priority: 999
Package: libcherokee-config0-dev

Pin: version 0.9.4-1*

Pin-Priority: 999
Package: libcherokee-server0

Pin: version 0.9.4-1*

Pin-Priority: 999
Package: libcherokee-server0-dev

Pin: version 0.9.4-1*

Pin-Priority: 999

When a newer package appears in the PPA repo it will be installed or upgraded. Version 0.9.4-1 is there simple because it was the current packaged version at the time of writing this blog post. The important bit is having Cherokee 0.9.x and not Cherokee 0.5.6 installed in your box.

STEP 3) Update your APT sources and install Cherokee

$ sudo apt-get update

$ sudo apt-get install cherokee

That’s it. Give it a try! I’ll be using it for serving static content here on my blog.

Podcast recommendations

Today it’s a national holliday here in Peru and I just came to the office to catch up with some bit of work and all the way here from home I’ve been enjoying a very interesting interview with Anders Hejlsberg, the creator of C# and Chief Language Strategist for Visual Studio at Microsoft. He talks about many topics but the most interesting bits were about the advantages of dynamically-generated static code like they do with LINQ and ASP.Net as opposed to using dynamic languages.

This podcast is part of a great show I’m now a fan of: Software Engineering Radio. They have been interviewing some big names recently and I’ve been enjoying the episodes with Erlang’s Joe Armstrong or CORBA’s Steve Vinoski. A great show, the interviewer knows very well the software developing field and suggest really nice topics. I have many of this SE Radio podcasts waiting in the pipeline including topics like relational databases, SOA, functional programming, aspect-oriented programming, REST, transactions and many other currently relevant subjects. Free Software fans can find an episode on GNU GCC and UML fans can find one with Grady Booch as the guest.

Other podcast i’m a big fan of are the always great programs at IT Conversations, DotNetRocks and of course FLOSS Weekly and Security Now among others shows from the Leo Laporte’s  TWiT network. Leo is a great radio commentator and the guy who helped podcast become popular.


Leo Laporte

For Linux I used to enjoy The Linux Action Show a lot but haven’t listened to the show in the past few months. Before I tried listening a bit to Jono Bacon’s LUG Radio.

There are certainly a few other podcast I listen to or used to listen in the past. Last year I used to catch up with the major Rails news by listening the Rails Envy podcast and this year I’m complementing my following of Django listening to This Week in Django. If you’re interested in a PHP podcasts you could try PHP Abstract.

So this blog post is all about saying thanks you to the people behind the many podcasts I’m listening again since I got a portable MP3 player again since the one I previously had got the earphone jack broken somehow.

Some guys from these shows tell you to spread the word about their podcasts and it’s something I definitely feel good to do since I really enjoy their work.

Adding en_US.utf8 locale to an Ubuntu Hardy server

Just a few minutes ago I realized the locale configuration of my Ubuntu Hardy 8.04 Linode VPS was not using UTF-8 when I was checking out an SVN repo.

So I checked the current available locales:

locale -a

C
POSIX

As you can see en_US.utf8 was not there. So I had to be added manually:

sudo localedef –no-archive -i en_US -c -f UTF-8 en_US.UTF-8

Now, checking the locales again I got listed:

If you’re an experienced Linux user this is not big deal but in this blogsphere-powered days I figured out this kind of info will be helpful to somebody out there so I’m sharing it here.

locale -a

C
en_US.utf8
POSIX

So the last step is to set this in the environment so it’s configured correctly the next time you log into the server and also if the server gets rebooted.

The following two lines have to vi added to /etc/environment

LANGUAGE=”en_US.utf8″
LANG=”en_US.utf8″

And that it’s. You might one to reboot the server not it’s not really neccesary.

If you’re Ubuntu server is not configured this way I’d recommend tweaking the configuration.

On microblogging or why do I post stuff on Twitter?

I’ve explored this topic some three or four times chatting with geeky friends. The last time was a couple of days ago after a very nice lunch at El Huarique peruvian seafood restaurant in Miraflores. So I want to elaborate a bit about my reasons but, for the impatient, the basic idea is I do like the whole microblogging concept because I think it adds value to the web and Twitter is perhaps the most widely known microblogging tool today.

So why do I post stuff on Twitter? Because I think it lets me share almost immediatly stuff worth sharing with people who might care about it. Yes, as anyone else I might be posting superfluous stuff are some cryptic message that only matters to me but I try to balance the usefulness of the service as a thought sink and a news wire.

I’ve been using twitter since the first days the service went live and have updated my status around 2600 times since then. I admit I have many times shared stuff that is only relevant to my friends that also happen to follow me or to people living in my city or country but I’ve seen new people follow me regularly, at the rate of one and sometimes two need followers per week. I have now 192 followers which seems to prove I’m getting read, at least by some of them :)

Many people quit using Twitter because they feel they have too much stuff to read and too little of it is useful for them. It’s the well known signal/noise ration thing. I’ve somewhat solved that problem by just reading the last few pages of the feeds from people I follow only from time to time, when I have some time to do it. For me, microblogging is much a write-oriented activity than a read-oriented one. It works nicely that way for me so I don’t feel it like a big interruption.

The Web was created to share experience and ideas

The World Wide Web was created on top of previously existing Internet infraestructure by a scientist with the single purpose of instantly sharing papers and the details of very costly experiments so teams in the other side of the world could avoid repeating the work. All other uses including porn are posterior :) I’m sure most web users of today miss this point since they are most likely to have become web surfers for accessing a public service like Hotmail, reading the newspaper for free, get some electronic banking done or sharing pictures with friends and family. So yes, the web should be all about sharing your knowledge and experience with colleages around the world but that didn’t happen for mere mortals until blogging became widespread.

Blogs saved the Web

I can’t trace the phrase to the place I first read it but the idea is this: before blogs and blogging became popular the web was becoming an increasingly boring place where only the corporations were publishing content reflecting their views and opinions. Those days If you were an individual and wanted to push some content to the web you had to be some sort of HTML geek and learn at the very least how to use a web form to upload pages to Geocities if you wanted to avoid the hassle of using FTP. So publishing content was mostly hard to the average Internet user and something only a few geeks knew how to do and the fewer geeks actually were doing. The picture today is very different. Blogging is some sort of viral thing and lots of people have a blog because their friends have a blog or have been inspired to start blogging by reading someone else’s blog. Today the problem does not seem to be the technical details of blogging but finding content worth sharing with the world :)

Blogs save my day. Everyday.

At least in the world of computer geekery I live day to day blogs are generally a key resource for having some task completed. Blog posts are serving many times this days as the drafts for some documentation Before blogs the only sources for technical help were books, the vast majority of them not freely available on the web, magazine articles, also only a very small part available on the web, public archives or mailing lists or news groups, most available but not generally formatted as articles and irc channels, great for interactivity but not useful for long detailed explanations. Yes, I’m not forgetting the technical articles at public knowledge bases that the big IT transnationals usually have but with the advent of opensource a lot of products you use do not come from corporations and don’t have this kind of knowledge bases available. It is true that blogs are not the only tools that helped improve considerably the general availability of technical articles: Wikis serve today a key role in creating and mantaining community-generated content but they are generally community-owned resources and not private property people get to do as they think it’s best like with their own blogs.

People has been sharing short pieces of text for years

People have been posting links together with a very brief explanations of the content on IRC for ages. If you post even a medium-sized chunk of text on an IRC channel you’re most likely piss someone else off since your text will probably take most of the available screen space rendering the other participant’s messages unreadable. When you do IRC you quickly learn to post in the short using services like Pastebin to make bigger pieces of text available to your peers.

IM users learned quickly to alter their status message to reflect their mood or publicize something. MSN Messenger users came to the point of chatting by continously changing their status in the occassion of the service being broken and not letting the users exchange direct messages.

So my point here is before Twitter and the whole microblogging ball got rolling Internet users had been exchanging self-contained short pieces of text effectively.

Microblogging is a valuable subset of blogging

Microblogging is still very new. By definition it’s all about blogging short pieces of text generally short enough as to have one microblogging post pushed to cellphones with just one SMS message. This is precisely what Twitter offered and since then it has quickly become an extremely popular service, at least among Internet geeks surely not the general public.

You can very accurately think of microblogging as the plain posting of very short self-contained text bodies. By self-contained I mean a piece of text that is not dependent on the reading of some other piece of text in order to understand it’s whole meaning. That’s why microblogging is useful for expressing your mood, sharing a remarkable quote, posting a link and answering a question like Twitter’s What are you doing? :)

The whole microblogging thing is not dependent on a service like Twitter. It could have been easily implemented just by creating short blog posts under a certain category in order to have a separate syndication feed and have others aggregate it on any feed reader perhaps ignoring the title. Yes, this would lack the SMS and IM gateways but that’s not something that can’t be solved by adding some extre code to the blog engine as a plug-in.

Blogging and microblogging are not just talking to yourself

Comments are as important in a blog as the post body. When someone blogs something that is hot you’ll see how people will comment and add useful additional information, their own experience, corrections, suggestions and possibly challenge the very idea of the post. This is great for the reader and a great service for the casual community of readers that forms around a blog post. When this happens your feed gets added to people’s feed readers and your posts get linked by people’s post having Google bring more and more readers to your blog as an important effect.

I’ve experienced something alike happens with microblogging. If you post stuff that is only relevant to yourself you’ll get no responses and people will become tired of following you removing your stream from their list. When you post useful stuff, interesting ideas or just amusing thoughts you’ll get responses, conversations started and even more followers.

Yes, since the way current microblogging tools work is essentially a feed reader it’s somewhat close to a popularity contest: you’ll end up following those guys who most of the people you follow (e.g. your friends) are also following and you’ll stop being followed if you don’t do the microblogging thing often or mostly post boring stuff.

Blogging is hard, microblogging is easy

That’s exactly why writting a good blog post is so hard and writing a bad microblogging post is so easy :) Both blogging and microblogging can suck a lot of your time. It’s just they suck it in a completely different way.

Writing a good blog post is not just about having a good idea. You have to match it with a good writing technique and decent style. The length of the article is also key: it must be long enough to engage the user and provide useful details but not that long as to have the user only scan the text or go straight to the conclusions. It sucks your time by writing, reading what you have written, rewriting and correcting and getting the post in good shape. It takes some serious time for most of us. I must be writing this post for at least one hour already.

Writing a good microblogging post instead is much more about picking the right stuff to share. Yes, it also takes skill in writing in a concise way and services like Tinyurl help a lot in fitting long urls in the very reduced space but the good taste on picking what to share perhaps remain the key part of it.

But the thing I find great about microblogging is being able to share something really quickly, almost instantly once you conclude it’s something worth sharing. With microblogging, I have posted links to blog posts, new software or news items just after reading a few lines for friends to pick’em up and have received valuable feedback and comments by the time I had finished reading the piece.

With a blog, you have to invest the time need to round a decent post. Before microblogging became a bit popular I think I was missing sharing many things I wanted to share. I’m the kind of person who takes the time to post something interesting to a forum or mailing list I participate at from time and like to comment with my friends in person stuff I’ve found and I think is useful or noteworthy. For me this microblogging thing is more about accomplishing the same thing but with a new level of efficiency or at least a different dimension.


It says in Spanish “God created the world in six days and in the seventh He twitted.”

Microblogging usage patterns and available tools

In a future post I’d like to explore some microblogging usage patterns including mine and also review some of the available tools. I suspect some of the tools are there only they are not widely known and others simple don’t exist. I’d love to be able to easily read what other microbloggers are saying about Linux, Python or Mac OS X, all of them topics I am interested in but can’t think of a tool helping with that for example.

Conclusions

I find microblogging valuable and it’s benefits worth the price you pay in time. For me, microblogging is just like regular blogging only in a much shorter format so it’s faster and easier to share stuff. The quality of the your posts matters as much as in regular blogging and my advice is to balance the use of the tool for expressing your thoughts, mood and opinions and as a medium to quickly push interesting and valuable stuff to friends and the general public.

Triple Booting Leopard, Hardy and XP on my MacBook

Since I got a Macbook around six months ago I planned a triple-boot setup but didn’t really do it until recently. One of the first things I did when I got the laptop was using Bootcamp to repartition the hard-drive and install Ubuntu. When I then wanted to add Windows to the mix I found out it wasn’t that easy after struggling a bit with partition schemes and installers that don’t mix so well. The result was I just gave up for some time resorting to run Windows from VMware Fusion.

A few friends that own Macs and do Windows and Linux are happy running the OSes inside virtual machines. I was not. Windows under VMware runs nicely and the Unity integration features are quite cool but since I got the laptop with 1 GB or RAM running heavy enterprisey development tools for Windows among other stuff wasn’t working that well. Besides, OS X is fine and before the triple boot setup I got mostly used to run it all of the time but from time to time I run benchmarks, show demos or give talks and I needed the real Linux running on top of the bare metal. So I went for the real thing :)

Since I’ve switched to this machine as my primary computer I needed more RAM and disk space so I upgraded it from 120 GB to 250 GB and from 1 gigs of RAM to 2 gigs. Since I was going to have Leopard installed in a brand new disk this was the chance to finally go for the triple boot setup.

So the story starts with Boot Camp, Apple’s utility tool for resizing the Leopard’s HFS+ partion and have Windows Vista or XP installed aside of Mac OS using the drivers included in the Leopard installation media. As you might guess, given the propietary nature of Apple, Boot Camp is not the most flexible tool around and demands the hard drive to be formatted as a unique HFS+ partition using the whole disk. The good news is the process of installing Windows with Boot Camp is pretty smooth and works correctly almost every time. My experience was not the exception.

There are quite a few guides all over the Internet proposing different strategies for having OSX coexists with Windows and Linux on the same hard-drive and almost all of them are very emphatic on following the instructions to the letter. I read most of them but given my previous experiences and the information I had gathered I went for my own approach with I’ll briefly describe in this post.

GUID Partition Table (GPT)

GPT is a modern partition scheme that is part of the Extentensive Firmware Interface standard proposed by Intel. This is the scheme Apple uses for all Intel-based Macintoshes and Leopard’s installer only agrees to install the OSX on a GPT-partitioned hard drive so that’s one of the first things you must be aware of. GPT is an alternative to the old and well-know MBR partition scheme most of us are used coming from a PC world. EFI is a replacement of the old PC BIOS. EFI uses GPT where BIOS uses MBR. Nonetheless, Boot Camp uses a mixed GPT-MBR partition scheme under EFI in order to simulate the PC BIOS and have BIOS/MBR-only OSes like Windows XP installed in the new Macs. That’s why you CAN’T use Windows partitioning tools you might be used to like fdisk. They’ll simply ruin the setup and you’ll have to start all over again by partitioning the hard drive under GPT.

The current versions of Ubuntu Linux, like Feisty or Hardy, support GPT-partitioned hard drives in the installer, so they are not a problem. Windows Vista being a new OS only seems to support this in some 64-bits versions. That’s why you’ll want to rely on Boot Camp for the Windows installation and then try to mess the less you can with the arrangements the software has made :)

Installing Windows

There are many guides around for this part. I’ll link here to Apple’s official instructions in the 101: Using Windows via Boot Camp with Mac OS X 10.5 Leopard article of their support site. When installing XP don’t even think of creating or deleting the partitions. At most you can switch from NTFS to FAT but I went for NTFS since Linux is already supporting it well and my partition was 60 GBs big. You can opt for the quick formatting option for reformatting the drive C: but don’t try reformating, I repeat, since you’re not installing over an MBR-partitioned standard PC hard drive.

After booting XP you’ll find the look is so lame compared to OSX or Linux with Compiz that you’ll want to make the appearance a little bit more decent so I turned on the ClearType option, the Royale theme, XPize and finally Y’z Shadow for adding extra transparency and drop shadows to the windows.

Since Macs only have one click you’ll find useful the tiny Apple Mouse utility for XP which switches the left and right click options while you’re holding the Ctrl key. Just run it from XP’s start folder adding the /s parameter to the executable path for avoiding the start dialog and you’ll have right-click working the same way as under OSX.

rEFIt

So after Windows install my MacBook was booting straight into Windows. Horrible! :( Yes, I could still choose from which partition to boot by pressing the right Option (Alt) key or setting my choice using the Startup disk dialog under OSX’s System Preferences but I wanted a cool graphical bootleader that soon would be spotting a cute Linux penguin so I went with rEFIT, a superb opensource bootloader for EFI-based hardware that dynamically detects your partitions and even bootable media.

I grabbed rEFIt as a DMG file and run the graphical installer under OSX. When I booted again it wasn’t working so I had to resort to running the manual installation instructions which are a breeze to follow using the OSX terminal app. Rebooted and the nice rEFIT screen was welcoming me featuring both OSX and Windows icons.

Installing Ubuntu

So at this point my Mac was dual-booting Leopard and XP but I need to add Hardy to the mix. Since the biggest partition was Leopard’s I had to shrink it in order to make space for Linux. There are a few options for doing this: I could have used the opensource gParted tool included in the Ubuntu Live CD or OSX’s own diskutil command under the terminal, or even the Disk Utility GUI under Applications/Utilities but I went with iPartition, a commercial product included in a Coriolis Recovery CD a friend had lend me. The partitioning worked nicely and I had 60 gigs for getting Ubuntu installed to the hard drive.

The problem here was the brand new partition for Ubuntu is physically the third one but Boot Camp will only want to boot Windows from the last partition, in this case the third. So the trick comes here: I booted the laptop with Ubuntu’s LiveCD which at disk point is offered as a boot option represented by rEFIT as a Linux penguin with a tiny CD icon and had the new partition formated as NTFS and Boot Camp’s windows installation copied to the third partition. Of course I had to do all of disk manually so I used mkfs.ntfs over /dev/sda4 to create the new partition, then mouted both /dev/sda4 (Boot Camp’s Windows installation) on /bootcamp and /dev/sda4 (new Windows location) on /windows and had all the files copied by simply issuing a “cp -r /bootcamp/* /windows” command and waiting for it to complete before starting the Ubuntu installer.

Then, when perform the actual Ubuntu installation I switched to manually setting the partition in which Ubuntu was to be installed, /dev/sda3 in this case, created no SWAP partition since many guides replaced it by a swapfile inside the main Linux ext3 partition and had GRUB installed not in the MBR but in /dev/sda3 and everything worked nicely.

Due to Ubuntu’s bug #222126 the Ubuntu’s installer clears the MBR and after rebooting you’ll get a “no bootable device” error when selecting the Linux or the Windows icon from rEFIT. I knew about this problem and the fix from my previous attempts so I didn’t panicked :) It only takes to run the eEFIT’s built-in partition tool to resync the GPT and MBR partitions and you’re done. At this point my system had a fully operational triple-boot setup. :)

Configuring Hardy to use the MacBook’s hardware

For this part I mostly followed the instructions at the MacBook Santa Rosa and MacBook Santa Rosa on Hardy pages from the Ubuntu wiki. Sound is working. Wireless is working too. The only thing I’m missing is having the laptop suspend correctly which is currently preventing me from using Ubuntu extensively when relying on the laptop’s battery. I’ll be looking into this issue soon and will be updating the article properly.

Conclusions

Triple-booting Leopard, Hardy and XP wasn’t an easy but a fun journy. Yes, it can take quite a bit of time waiting for the installations to complete and even much more configuring the system so I really helps to know what your’re doing since you risk loosing data or at least a good piece of your precious time. Was the price well worth for my? Definitely, yes. It’s not just all the cool kids who happen to be Linux geeks and own a Mac are doing this but the chance to use all of the system resources running under the proper drivers and being able to forget for the most part what is the hardware platform you’re using what has value to me. Of course, it all depends on your very specific needs. Due to academic reasons I do a lot of team work with other people and at some points we switch laptops or I have mine used by someone else to complete a task. In this situations I’m now booting into Windows and forgetting about any ocassional OSX interferences like switching to a different desktop using OSX’s Expose. It’s also way easier to have Windows run from it’s own partition and not a VM’s disk if you plan to install a ton of software as I’m having to do this days. So for me, it’s working nicely and I can still use Virtual Machines under any of the three OSes to virtualize any of the two others or a different one if that’s what I need. So i’m happy with the end result. :)

I really hope this post is interesting and useful to some of you out there on the internets :) For further reference most links are available from my Delicious account under the tripleboot tag.

Typing Spanish characters in Mac keyboards

I want to share this information with other spanish speaking users of Apple computers. Yes, this can be found in several places all over the web but republishing it once again won’t hurt anyone:

  • á = Opt + e, then a
  • é = Opt + e, then e
  • í = Opt + e, then i
  • ó = Opt + e, then o
  • ú = Opt + e, then u

For the ñ, hold down the Option key while you type the n; release and type n again.

  • ñ = Opt + n, then n

To place the diaeresis over the u, hold down the Option key while pressing the u key; release and type u again.

  • ü = Opt + u, then u

The inverted punctuation marks are achieved as follows:

  • ¡ = Opt + 1
  • ¿ Opt + shift + ?

¡Allí está! Realmente útil, ¿no? :)

Import this

Since i’m still new to the Python culture I wasn’t aware of the “import this” eastern egg. I just heard my friend Gustavo mentioned that IronPython is lacking “import this” and my curiosity was invoked. I quicky tried a few Google searches with no results. Maybe I should had tried something like “import this eastern egg” but I was only suspecting that could be the case so I changed the strategy and fired up a python interpreter on an xterm with this result:

Once the eastern egg had been confirmed I googled a bit to learn more and found it even has a PEP of its own, PEP-20. The text featured is The Zen of Python by Tim Peters. It’s a great teaching! It even appears listed as the first item in this list of python must-read documentation. Nice to know :)

There are some more Python import eastern eggs. Try import __hello__ and from __future__ import braces. Well, for the last one you always have Tim Hatch’s pybraces.