More work on widgets

Posted by Esteban Manchado Tue, 30 Jun 2009 21:11:00 GMT

As I had mentioned, I had been working on Opera widgets. Some time ago I had seen a great Javascript plotting library for jQuery called flot, and I really wanted to try it out in some “real world” project. As I was working on the World Loanmeter widget, which incidentally uses jQuery too, it was very easy to figure out some way to use flot for something useful: I decided to add some simple graphs to the widget.

The initial idea of the loanmeter widget was to show where in the world Kiva was offering loans. However, as I used the widget myself, I realised that the location in the world was less important for me, and I was more interested in knowing what the person was going to use the money for. So, I added some options to filter by “sector” and I figured that having some graphs comparing how much money was requested and already funded, for each sector, would be a very quick and visual way to get the information I wanted. I started playing with flot, and I have to say that except for a couple of relatively minor problems, it was quite easy to use. I don’t have screenshots showing the graphs, but feel free to try the widget itself and have a look (hint: you have two buttons at the bottom right corner to switch between “map view” and “graph view”).

The other widget I have been working on is a monitor widget for projects in CruiseControl.rb (a really simple and neat continuous integration server we use at Opera). More than one year ago, my colleague Nico had written a very quick & dirty widget for monitoring the result of the test runs of the My Opera functional testsuite. There were a couple of things I wanted to change, and I also wanted to monitor other projects, so I figured that I’d rewrite the widget to have a more maintainable codebase and then make it generic, so you could configure which CC.rb installation and which project to monitor. I’m moderately happy with the result of the refactoring, and happy enough with the final result. I know it has several issues, and I expect that once anyone outside our team starts using it, there will be things to improve and fix :-) If you use CruiseControl.rb, give it a try!

The ultimate TODO app redux

Posted by Esteban Manchado Mon, 29 Jun 2009 18:59:00 GMT

When writing yesterday about the Perl modules, I realised that I hadn’t written anything about the TODO application since “The ultimate TODO app”. Well, a lot has happened to it actually. I’m glad to announce that:


  • It does have a (lame) name now: Bubug (supposedly stands for “Barely Unconventional Bug Untracking Gizmo”. Whatever).

  • It has improved a lot here and there, and it now has authentication and multi-user support, not to mention a lot of UI bling bling and goodies.

  • The development has moved to BitBucket, an excellent free service built by ex-Opera’s Jesper Noehr, where you can follow it more easily, comment on, check the Wiki, fork, or whatever you want. You even have a screenshot there ;-)

As you can guess from the last point, for this project I’ve been using Mercurial instead of Git. Although I certainly don’t have sophisticated needs, so YMMV (heavily), I find Git more pleasant to use. Which is kind of surprising, because I always thought that Git’s UI was a pain in the ass. Oh, well. That doesn’t mean that Mercurial is hard to use, though. I think it’s more that I’m used to Git now, and there are a couple of things that I find more convenient: the coloured diff (possible in Hg, but you have to install some extension for it, and only thinking about installing some Python extension that is not even packaged for Debian makes me want to switch to Git) and the staging area are the most important ones I can think of.

So, if you thought I had abandoned the TODO application thing, you were wrong ;-) If you’re interested, have a look at the Bubug BitBucket project page, download it, play with it, and tell me what you think.

My first contributions to CPAN

Posted by Esteban Manchado Sun, 28 Jun 2009 19:46:00 GMT

I have been using Perl for many years, but I had never uploaded anything to CPAN. That’s unfortunate, because I’ve probably written several programs or modules that could have been useful for other people. The point is, now I have. Not only that, but it was code I wrote at work, so if I’m not mistaken these are my first contributions to free software from Opera. Yay me!

The two modules I’ve released so far are:

As I feel that Migraine could be useful to a lot of people, but it’s easy to misunderstand what it really does (unless you already know Rails migrations of course), I’ll elaborate a bit. Imagine that you are developing some application that uses a database. You design the schema, write some SQL file with it, and everybody creates their own databases from that file. Now, as your application evolves, your schema will evolve too. What do you do now to update all databases (every developer installation, testing installations, and don’t forget the production database)? One painful way to do it could be documenting which SQL statements you have to execute in order to have the latest version of the schema, and expect people to apply copying-and-pasting from the documentation. However, it’s messy, confusing, and it needs someone to know both which databases to update and when.

Migraine offers a simpler, more reliable way to keep all your databases up to date. Basically, you write all your changes (“migrations”) in some files in a directory, following a simple version number naming convention (e.g. 001-add_users_table.sql, 002-change_passwd_field_type.sql), and migraine will allow you to keep your databases up to date. In the simplest, most common case, you call migraine with a configuration file specifying which database to upgrade, and it will figure out which migrations are pending to apply, if any, and apply them. The system currently only supports raw SQL, but it should be easy to extend with other types.

In principle, you shouldn’t need to write any Perl code to use migraine (it has a Perl module that you can use to integrate with your Perl programs if you like, but also a command-line tool), so you can use it even in non-Perl projects. Of course, some modern ORMs have their own database migration system, but very often you have to maintain legacy code that doesn’t use any fancy ORM, or you don’t like the migration system provided by the ORM, or you prefer keeping a single system for schema and data migrations… I think in those cases Migraine can help a lot reducing chaos and keeping things under control. Try it out and tell me what you think :-)

In a couple of days I’ll blog again about other contributions to free software I’ve made lately, but this time in the form of Opera widgets…

Opera Unite: another milestone

Posted by Esteban Manchado Sat, 20 Jun 2009 22:17:00 GMT

So we finally managed to get some public release of Opera Unite out of the door. That was a really good thing, first because it’s a very cool idea and we had to let others play with it and make it evolve, and second because it was painful keeping a secret for so long ;-)

In case you have been hiding under a rock these days and you don’t know what I’m talking about: Opera Unite is the latest crazy idea from Opera Software. Basically, embedding a web server inside the web browser, so that people can be more than spectators on the web, share their data without having to upload to third party services, and generally change the way they interact with the web. The cool thing is that the system is not limited to sharing files or whatever, you can actually program your own Opera Unite services to do pretty much anything you want (check the documentation in Dev Opera if you’re a developer). However, do note that this is just a Labs release, that is, just a preview of relatively immature software. For a more complete introduction, go to the Labs blog post introducing Opera Unite.

Opera created quite a bit of hype before the release, which seemed to work pretty well. In particular, the teasing in the HTML comments of the preview URL (http://opera.com/freedom), which were being updated every day by adding some more words, was brilliant. There has been a lot of press coverage of Opera Unite this week, and even some Russian fella created the website unitehowto.com the same day Unite was released, and he wrote (collected?) a bunch of information, articles and tutorials about Opera Unite.

I have to say that, although there has been some quite challenging times while developing Opera Unite (it’s a quite ambitious project that involves several departments with massively different backgrounds and values, what did you expect?), I’m quite happy with the result and I think we have made, in general, a good job. As I said, this is just a very rough version, and there’s a lot of work left to do, but I’m sure it will improve a lot before we release the final version. That said, I’m sure that the most exciting things about Unite will, without doubt, start happening once people start writing interesting services, changing the way we see Opera Unite and the way we see the web. I’m so eager to see what people are going to build with this…

Predictably irrational

Posted by Esteban Manchado Mon, 01 Jun 2009 20:28:00 GMT

I haven’t written in some time, I know. I haven’t done much worth blogging about. Just a new release of the Kiva World Loanmeter widget, and also a couple of things at work that I’ll be releasing soon (including a small tool for managing database changes and some Perl module to parse Debian .changes files).

However, recently I watched a really funny and interesting talk at TED, Are we in control of our own decisions?, by Dan Ariely. In the talk he mentions his book, Predictably Irrational, which funnily enough a friend had already mentioned to me.

Well, I just finished the book and I have to say it was very interesting and eye-opening. It’s interesting how it shows our minds are biased for certain kinds of decisions or behaviour, even though they are often not the best for us. Some of the experiments are truly brilliant and they show totally unexpected (at least before starting reading the book ;-P) outcomes. One of the experiments that got me thinking was this:


Research on stereotypes shows [...] that stereotyped people themselves react differently when they are aware of the label that they are forced to wear [...] One stereotype of Asian-Americans, for instance, is that they are especially gifted in mathematics and science. A common stereotype of females is that they are weak in mathematics [...] In a remarkable experiment, [...] asked Asian-American women to take an objective math exam. But first they divided the women into two groups. The women in one group were asked questions related to their gender [...] The women in the second group were asked questions related to their race [...] The performance of the two groups differed in a way that matched the stereotypes of both women and Asian-Americans. Those who had been reminded that they were women performed worse than those who had been reminded that they were Asian-American.

I can’t stop thinking about the implications this has to working conditions and productivity in different countries, and also to project management.

Free software rocks!

Posted by Esteban Manchado Sun, 10 May 2009 16:18:00 GMT

I’ve been working on something lately that I hope I will publish sometime next month: it’s a set of tools to manage an APT package repository. The idea is that, given an upload queue (you can set it up as an anonymous FTP, or some directory accessible via SSH/SCP, or whatever floats your boat in your setup and team), you’ll have a web interface to approve those packages, a set of integrated autobuilders building the approved packages in whatever combination of architectures and distributions you want, and all that integrated with reprepro to keep your repository updated. I’ll write more about it when I have released something.

The point now is that, while working on it, I needed some module to parse command-line options and “subcommands” (like git commit, svn update, etc.). As it’s written in Perl, I had a look at CPAN to see if I could see anything. The most promising module was App::Rad, but it lacked a couple of things that were very important for me: my idea was “declaring” all the possible commands and options and have the module do all the work for me (generating the help pages and the default --help implementation, generate the program help subcommand and so on). App::Rad didn’t have that, and it didn’t seem to me like that was the direction they wanted to go to with the module. But I figured I’d drop the author an e-mail anyway and see if he liked the idea so I could start adding support for all that…

And boy was that a good idea. He replied a couple of days later, and said that they had liked the idea so much that they had implemented it already (that’s why he took a couple of days to reply), and he sent me an example of the new syntax they had introduced and asked if that was what I was thinking. And not only that, but they added me to the list of contributors just for giving the idea! That completely made my day, free software rocks!

Happy Birthday Opera!

Posted by Esteban Manchado Tue, 28 Apr 2009 07:43:00 GMT

Today Opera turns 15! To celebrate it, there is a lot of stuff going on, like a list of Opera’s most popular innovations.

I have to note here that I’m very proud of being part of Opera Link, which is consistently mentioned in the list of innovations.

Happy Birthday Opera!

Recent pet projects + Git + Github

Posted by Esteban Manchado Mon, 06 Apr 2009 21:21:00 GMT

I had mentioned that I was learning Javascript to write a Kiva Opera widget. Some time ago I released the first version of my World Loanmeter widget, and I have uploaded two more since. Not much has happened between the first and the third release from the user POV, but a couple of things were interesting when developing it:


  • I learned QUnit, which I used to write some really useful unit tests. It’s quite nice to be able to write Javascript unit tests easily.

  • I made some heavy refactoring (see above) which made me learn some more Javascript and made the code much more flexible, so now the widget is not limited to a single Kiva API page of results, but to as many pages as needed to fetch whatever number of loans the user wants. Not to mention that the data source need not be a URL.

  • Now the widget actually has some configuration. Namely, the number of loans to show in the map. It also stores it persistently using the preference store, which is quite nice.

As I said, I used Git for it. I don’t “hate” it anymore, but I still find some things annoying, like the horrible, confusing names some options have (I’m thinking about “git checkout ” to revert the local changes, or “git diff—cached” to see the contents of the index/staging area; seriously guys, W-T-F?). I used to be skeptical about the “git add” for changes and then “git commit”, but I actually find it quite nice: it’s easier to plan a commit that way, and if you don’t want to plan it, you can always just “git commit ” directly. Also “git add -p” is really nice to commit just parts of a file (at last, someone copies some of the good stuff Darcs had had for ages!). Apart from Git itself, it’s cool that there is GitHub, so it’s easy to share your repositories without having to rsync to some web server or similar… not to mention that your project is much more visible that way.

But the World Loanmeter wasn’t the only pet project I was working on these past weeks: I also wrote a simple sudoku solver, demisus, in Ruby. The reason? Writing a prototype of a sudoku solver in a language I’m fluent with, to play with the design and get something interesting and easy to maintain… to rewrite it in Haskell. I have been trying to learn some functional language for some years now, but I never find a “project” that is interesting enough to write some “real world program” in the language and I end up not learning anything. After starting reading Real World Haskell, I really felt like trying to learn the language once and for all, and I figured that a sudoku solver was easy enough to write, something I know enough about, and something math-y enough to be reasonably easy to implement in Haskell.

So, if you’re interested in any of them, you can have a look in Github and even contribute ;-)

Watchmen and the annoying ad

Posted by Esteban Manchado Wed, 01 Apr 2009 20:37:00 GMT

Phew! It has been a long time since I wrote. More than once already, hmmm….

I went to the movies to see Watchmen. I don’t want to spoil, but I think it was a very, very good adaptation of the comic book. Actually, I think it’s the best comic adaptation I have ever seen. And I don’t think Watchmen was particularly easy to get right. And I had just finished reading the comic for the second time just before watching the movie. And yet, I was impressed. The adaptation was really close to the book, and very, very good.

I admit I didn’t have huge expectations: after 300 (amazing book, silly-although-fun action movie), the “from the visionary director of 300” in the Watchmen trailer didn’t sound particularly encouraging. But I just love Watchmen-the-comic, so I figured it’d probably be fun to watch. And boy was I right. Not only fun, but very interesting, and even moving at moments (my favourite part of the movie is the story of Jon Osterman).

There are a couple of things I didn’t like (not spoilers, don’t worry!):


  • The fights were a bit too superhero-ish (people “flying” around and such), which made it look a bit silly.

  • It was a bit too crude and bloody.

  • Adrian Veidt didn’t have the massive charisma from the comic. He felt more like an arrogant asshole.

Before actually watching the film, though, there were the typical commercials. One of them really upset me, and I thought it was worth a mention. The commercial showed three young lads waiting in a queue, about to enter the U.S. Someone was checking their passports and whatever. The first of them enters and waves at the other two, happy. The second one enters and looks at the last one. The person checking the passports takes a while with the last one… and finally says some bullshit like:


I’m sorry sir, I can’t let you in


The first two look at him, confused, looking for an explanation, and the unlucky one looks back with a sad face, like regretting something. Then, the grand finale: some stupid text explains that he couldn’t enter because he had done something horrible, namely…. graffiti.

Give. me. a. fucking. break. I’m tired of all that biased bullshit. It’s not like Oslo has big problems or anything, but seriously: even fixing the crappy pavement around Grünnerløkka is like several orders of magnitude more important than the “graffiti problem”. Seriosly, politicians, get a life and do something useful.

Luckily, the film made me forget the ad quickly ;-)

Kiva API, Javascript, Git and my first widget, oh my! 1

Posted by Esteban Manchado Thu, 26 Feb 2009 19:48:00 GMT

About two weeks ago I wrote about Kiva, a cool website that allows people to make microloans. Almost one month ago they had started a developer site, including an easy to use API to access the data (loans, borrowers, lenders, etc).

I couldn’t resist the temptation to have a look at the documentation and start thinking about some application to use it. Soon after I started reading I came up with the idea of writing an Opera widget. There were a couple of reasons for that:


  1. I had never written a widget, so it sounded like a good excuse to learn how to write them.

  2. Widgets use Javascript, and that felt like a natural fit (as the API returns JSON).

  3. I didn’t really know that much Javascript (just enough to write a couple of event handlers), and that seemed a good opportunity to start learning the language “properly”.

  4. A widget in http://widgets.opera.com had more possibilities of actually being used than a random pet project of mine lying in some obscure repository of some obscure version control system (well, actually I ended up using Git for it, so it’s not that obscure in some sense; but you get the point).

So I started by learning a bit of Javascript. After asking around, the best thing I found to learn quickly was a very good series of videos by Douglas Crockford hosted in Yahoo! Video.

Then, I had a look at the excellent articles in Dev Opera about creating widgets and started creating one. As I had the idea of creating something that would show loans around the world, I started looking for HTML and Javascript for building maps, and found a very good article in A List Apart about accessible maps. The sad part is, once I understood how everything worked I destroyed the whole accessibility of the solution, but it was for a widget anyway (you have excellent support for CSS and Javascript in Opera, no need to have a fallback to show textual data in a widget) and my code ended up much much simpler and easier to maintain.

Finally, for Git, I had a look at the screencasts hosted in GitCasts. I already new some basic Git things, but I think I started to feel more comfortable with it after watching a couple of those videos. Still, too many references to the obscure objects and SHA names and whatever, but clear enough to understand your way around it.

In short, I have to say that creating the widget was easy enough, and it was lots of fun to write it. I had some frustrations debugging it, but things worked fairly well in general. When I finished it, I uploaded to widgets.opera.com and after a couple of days it was already approved and public for everyone.

So, if you want to give it a shot, just go to my widgets page and download the World Loanmeter! Enjoy it! :-D