Planet Igalia

January 27, 2012

Mario Sánchez

Accessibility support in WebKit2GTK+

As Piñeiro already mentioned in some posts, last week a bunch of hackers attended the ATK/AT-SPI Hackfest 2012 here at the Igalia offices, in the lovely city of Coruña.

As the guy working on accessibility support for WebKitGTK+, I attended the hackfest to join some other great people representing different projects, such as Mozilla, Orca, AT-SPI, ATK, GTK+ and Qt. So, apart from helping with some “local” organizational details of the hackfest and taking some pictures, I spent some time hacking in WebKitGTK+’s accessibility code and participating in some discussions.

And from that dedication I managed to achieve some interesting things too, being my favorite ones a big refactoring of the a11y code in WebCore (so it’s now better organized and hence more readable and easy to hack on) and pushing my patch for enabling accessibility support in WebKit2GTK+, after going through a meticulous process of review (see the related WK bug), which started with the patch I wrote and attached back when attending to the WebKitGTK+ hackfest, as I mentioned in my previous entry in this blog.

Yeah, I know that some weeks have already passed since then and so perhaps you’re thinking this could have been done faster… but I’ve spent some weeks on holidays in Barcelona in December (pictures here!) and so I wouldn’t have much time before January to devote to this task. However, the patch got integrated faster than what I would expect when I proposed the first version of it, so I’m quite satisfied and happy anyway just by being able to announce this at this moment. Hope you share my joy :-)

So, what does this mean from the point of view of accessibility in GNOME? Well, that’s an easy question to answer: from now on, every browser that uses WebKit2GTK+ will be as much accessible as those using the previous version of WebKitGTK+, and this is definitely a good thing. Of course, I’m certain there will be bugs in this specific part that will need fixing (as it always happens), but for the time being this achievement means “yet another thing less” preventing us from pushing for upgrading some applications to switch to WebKit2GTK+, such as devhelp (some ongoing work already done, as my mate Carlos announced yesterday), yelpliferea… and the mighty Epiphany browser, which is rocking more and more ech day that goes by.

Last, I’d like to share with you an screenshot showing this new stuff, but as I am a little bit tired of always using Minibrowser (that small browser we use for testing WebKit2), so I decided to try instead that new branch Carlos recently pushed for devhelp, so you could check that what I mentioned before is actually true.

So here you have it (along with a couple of additions done with Gimp):

As you can see, devhelp is running and Accerciser is showing the full hierarchy of accessible objects associated to the application, starting in the UI process (GTK+ world) and continuing in the Web process, where all the accessible objects from the WebKitGTK+ world are being exposed. As I explained in a previous post, the magic making possible the connection between the two process is done by means of the AtkSocket and the AtkPlug classes, also represented in the screenshot attached above.

So, that’s it.

by msanchez at January 27, 2012 02:06 PM

January 26, 2012

Carlos García Campos

Porting devhelp to WebKit2

When MiniBrowser was ported to the new WebKit2 GTK+ API, I said we had plans to create a webkit2 branch for epiphany. And we’ll do it as soon as we have enough API, but epiphany uses most of the WebKit API so this is going to take a bit. In the meantime, we have decided to focus on other applications that use a small part of the WebKit API like devhelp, yelp, liferea, etc. Yesterday I pushed a webkit2 branch into the devhelp git repository with some initial commits that allow to use devhelp with WebKit2. Even though WebKit2 is available in the latest WebKit unstable releases, there’s a bug and public headers are not installed, so you need to build WebKit from git to be able to build the devhelp webkit2 branch. The main functionality works, but there are still some features missing that we are currently working on:

  • Policy client: used by devhelp to decide what to do with unknown content and to open links in a new tab with middle click. Martin Robinson is working on Policy Client API for WebKit2, the patches are pretty good and will be pushed soon.
  • Search: We already agreed on the new API and Sergio Villar wrote the patch that will also land soon.
  • Printing: This is not only about adding API, it requires adding support for printing in the Web process too. The main problem is that we need to show the print dialog in the UI process and render pages for printing in the Web process, so we can’t use GtkPrintOperation. We have already patches to implement basic printing support and adding initial API. These patches only work for UNIX, so patches to make it work in win32 would be really appreciated.
  • Editing commands: There’s already a patch to add cut, copy and paste API, but we are discussing the possibility to move to a more generic approach for editing commands.

And here is the mandatory screenshot, although there’s nothing special since WebKit2 changes don’t affect the UI.

Devhelp using WebKit2

Devhelp using WebKit2

We will keep updating the webkit2 branch when new API lands in WebKit until there aren’t regressions. Then we’ll focus on yelp which requires two important challenges: DOM bindings and context menu API.

by Carlos Garcia Campos at January 26, 2012 02:10 PM

January 24, 2012

Alejandro Piñeiro

ATK/AT-SPI2 Hackfest 2012: Days 2,3,4,5

Well, as in the previous hackfest, I planned to make a post per day, but in the end I didn’t. Next time I will not make any plan.

Yesterday we had our last day of the hackfest. It was, in my opinion, a productive Hackfest where each one had the opportunity to work with other people working in the same field, and discuss several topics regarding the current situation. If you want to know all of the details and conclusions, you could read a minutes-like brainstorming document on the wiki. But If you were to ask me to pick just one, I would mention the discussion about enabling the accessibility support by default. The main conclusion was stop to use the atk-bridge as a module, and instead have that feature integrated. Doing that has several advantages, including having it compiled (and thus tested) when someone compiles GTK+ or any GTK+ app, and not only when you want to compile the “accessibility stuff”. The implementation details are still not clear. Convert atk-bridge to a library and add a dependency on GTK+ and others? Integrate it in ATK (making the bridge something like the DBUS backend)? Integrate it in GTK+? Forget ATK, and let GTK+ talk directly with the accessibility tools using GDBUS (an option that I feel is too drastic or non practical, but still in the mind of Benjamin)? Now is the time to debate it, in order to have something decided by 3.4, which we can start to testing properly at the beginning of the 3.6 cycle. Interesting times these days.

As in the previous hackfest, other conclusion is that there is a lot of work to do, but not a lot of people to do it. And this was reflected by the amount of people in attendance (some photos here). Anyway, although we were not a lot of people, we had a lot of different backgrounds represented at the hackfest. People from GTK+, ATK, AT-SPI2, WebkitGTK, Mozilla, assistive tools and QT. For example, in several discussions Frederik Gladhorn explained how the qt-bridge implements certain features, in some cases in an different way than how atk-bridge does the same thing, as Mike noted recently on his blog.

Finally, I want to thank everyone who came to this hackfest, as they made this hackfest possible. I also want to thank Igalia, GNOME Foundation and Mozilla Foundation for their sponsorship.

by API at January 24, 2012 12:41 AM

January 19, 2012

Alejandro Piñeiro

ATK/AT-SPI2 Hackfest 2012: Day 1

Hackfest

Today the ATK/AT-SPI2 Hackfest 2012 started. This time there are fewer people than last year, but we have the addition of Benjamin Otte. During the morning the main topic was global events versus per-object events. Although being simplistic the idea would be just listening to the focused object, things get complex when you start to add some practical examples, like searching. On a web page, or in GNOME Shell overview, the focus is on the text entry. But when you start to search, the content of the search result changes, and you also want to expose that. This could be solved with global-events and filtering, or with direct per-object connection to “relevant” objects. If per-object is used, it is required to decide how and with which objects, to avoid missing notifications. In any case, if we decide to keep global events, the current implementation of the global event listening in ATK seems to not be the most appropriate (as it is based on g_signal add_emission_hook, that has some problems and could be considered overkill).

During the afternoon the main topic was the removal of key grabbing in GTK, or going into more detail, deprecating gtk_key_snooper_install. The controversial part was that the code using that on the accessibility support for GTK was removed. The reason is basically that key event emission shouldn’t be done there for a lot of reasons (as we already concluded during the previous hackfest), so that removal could be justified. *But* at this moment there isn’t any alternative implemented, so several things were broken. So in the end, the conclusion was reverse that change until there is an alternative. Probably this is a good task for this hackfest (anyway, any X expert over here?).

Going to dinner can be hard

Since today was the first day, we decided to keep it simple, and try to have dinner near the hotel where most of the people are staying. So after finding that our first option was closed, and wandering around for a while, we entered a place that seemed ok. Well, typical tascas in Galicia are in general not really vegetarian friendly, and although you can find really nice places (like “Taberna Gaia”), some people can still surprise yourself. Note: it doesn’t matter if macaroni are a kind of pasta. If the sauce includes meat, it is not vegetarian. Additionally, it was a bar with TV. And although it was not too loud at the beginning, it became totally noisy when the soccer match started. Yes, we forgot about the Real Madrid-Barcelona match.

Day 2 is coming

And tomorrow there will be more. We have plenty of things to discuss and bugs to solve, so for sure it will be a busy day. Finally I want to thank Igalia, GNOME Foundation and Mozilla Foundation for sponsoring this event.

GNOME FoundationMozilla Foundation

Igalia

by API at January 19, 2012 12:10 AM

January 18, 2012

Manuel Rego

L’italiano arriva a LibrePlan

First of all, I’d like to announce that in a few days LibrePlan 1.2.1 will be released. This is a minor release including lots of bufixes done since 1.2.0. Thanks to all the users for reporting the different problems you have found in the tool, with the new version you’ll have an improved experience using LibrePlan. For those who still don’t know, you can report us any issue in project bugzilla or directly talk to us in #libreplan IRC channel on Freenode.net, we’ll try to fix it ASAP to be included in the next releases.

But as you can guess from the post title, the main topic I wanted to talk today is about the Italian translation of LibrePlan. Giuseppe Zizza has done a great work during the past weeks and LibrePlan 1.2.1 will be 100% translated into Italian language. He has used Transifex to do the translation and he has translated both UI files and reports files, so Italian is completely supported. I’d like to thank him again for the effort and his collaboration with the project. Grazie Mille! :-)

LibrePlan in Italian

Finally, we’re really glad to see that LibrePlan is available in more and more languages as time passes. So, if you still miss your language in LibrePlan, feel free to go to Transifex and add it by yourself or collaborate with other people in the translation. As you can see it will be included in future versions of the project.

by Manuel Rego Casasnovas at January 18, 2012 11:27 AM

January 17, 2012

Xan López

Epiphany marches on

Previously in this space we saw how the bright future of Epiphany looked like, and vague promises about incremental steps towards it were done. A month later, Epiphany 3.3.4 is out there, so let’s see how well we’ve done.

There’s a lot of new stuff here, so let’s go step by step.

Application menu

The application menu, accessible from its usual location in the Shell, holds actions that affect the entire application as opposed to the currently focused window or tab. You’ll need a fairly recent version of the Shell and gnome-settings-daemon (3.3.4 of both should do, when they are out) to get it working, otherwise the browser will fallback to a lonely “Application” entry in a now deserted menubar.

Also, notice that we now brand ourselves as “Web” in all user visible strings.

New toolbar

The bulk of the changes are here. As you can see the Back and Forward buttons have been visually merged, a fate shared by the location entry and the reload/stop button. The entire menubar is gone, being replaced by a “super menu” triggered by the funny looking button with a gear (more on this later). Everything else that used to be in the default toolbar layout is now gone, as is the ability to edit its contents, making the concept of a default layout more dramatic. Finally, we use a new style for the toolbar, making it seamlessly merge with the window decoration. We think it looks great!

Super menu

In the quest to save as much vertical space as possible in the default layout we have moved all the remaining actions of our menubar into a side “super menu”. Here will live actions related to the current page, although for the moment we have some visitors there en route to their new destination (like the Bookmarks menu, which will live in the new Overview).

The devil is in the details

A lot of other small tweaks and cleanups have happened, too many to mention. From a renewed floating statusbar (now shared with Nautilus), to spacing tweaks, to more thorough use of symbolic icons throughout the UI. Special thanks go to the Design Team, it’s a pleasure to work with them in both the small details and in the big picture re-designs.

Also, one benefit of having a renewed design focus is that it allows you to do this:

135 files changed, 14988 insertions(+), 26958 deletions(-)

Around 12,000 lines of code have been deleted since 3.3.2; the biggest chunk comes from the demise of EphyToolbarEditor and friends, but in other places we have just managed to do the same, or more, with less. This means more energy devoted to make Epiphany really good at what it should be doing, which is what every core GNOME application should aspire to do.

More to come

This is only the beginning, not the end. The Epiphany team will now continue full steam ahead to implement the new Overview, merge the new SQLite history backend, port our extension system to libpeas and many other exciting features, maybe including some surprise gift in the Web Application camp. Stay tuned to this space and, as usual, happy hacking!

by xan at January 17, 2012 03:56 PM

Joaquim Rocha

Augmented Reality at Igalia’s 10 Years Anniversary

This is a long pending post. It should have been written about 3 months ago but only now we found the time to do it.

Some of us in Igalia have been interested in Augmented Reality (AR) and Computer Vision (CV) for a while and we wanted to do something within these fields for the company’s 10th anniversary party which took place in last November.
Since our time was limited (due to our work in a client’s project) we came up with a simple AR installation to show at the party — a fish pond, or aquarium.

So a week before the party Edu and I bought a Kinect device and implemented this fish pond using OpenFrameworks, an Open Source framework for writing interactive applications using C++.
As you might notice from the pictures, we are more programming artists than graphical artists so the fish may look a bit funky but they’re drawn in only 10 lines of code using graphics functions (and I kinda like their looks). Due to limitations of the place where we installed the application, we had to place the projector in a lower angle instead of above the “action area” and this of course resulted in bigger shadows but people could still play with it without many issues.

The fish’s behavior was implemented using Reynolds’s algorithms and the idea is that when a person “touches” the pond, the fish will go there as if there was food being dropped. When the person stops touching the pond, the fish will hang for a little while and then will disperse randomly to other points of the pond.

As you see, the idea is pretty simple but it was a nice entertainment for kids and grown ups around the party.

We will likely be doing more AR and CV for the coming months so stay tuned!

by Joaquim Rocha at January 17, 2012 02:45 PM

Xavier Castaño

Igalia at Open Source World Conference 2012 in Granada

Last week I attended Open Source World Conference 2012 in Granada. I participated in a presentation about products and solutions from several companies. In my case, I was there to talk about LibrePlan and to moderate another round table of presentations.

I met some old friends there and new other ones :) and I hope this kind of events are kept in order to share our experiences around Free Software.

Here you can see some photos of my round table that was held on Friday:


© Xavier Castaño for My blog at Igalia, 2012. | Permalink | No comment

Add to del.icio.us

Search blogs linking this post with Technorati

Want more on these topics ? Browse the archive of posts filed under Free Software.

by Xavier Castaño at January 17, 2012 10:05 AM

January 16, 2012

Víctor Jáquez

GStreamer video decoder for SysLink

This blog post is another one of our series about SysLink (1, 2): finally I came with a usable GStreamer element for video decoding, which talks directly with the SysLink framework in the OMAP4’s kernel.

As we stated before, SysLink is a set of kernel modules that enables the initialization of remote processors, in a multi-core system (which might be heterogeneous), that run their own operating systems in their own memory space, and also, SysLink, enables the communication between the host processor with the remotes ones. This software and hardware setup could be viewed as an Asymmetric Multi-Processing model.

TI provides a user-space library to access the SysLink services, but I find its implementation a bit clumsy, so I took the challenge of rewrite a part of it, in a simple and straightforward fashion, as gst-dsp does for DSP/Bridge. The result is the interface syslink.h.

Simultaneously, I wrote the utility to load and monitor the operating system into the Cortex-M3 processors for the PandaBoard. This board, such as all the OMAP4-based SoCs, has two ARM Core-M3 as remote processors. Hence, this so called daemon.c, is in charge of loading the firmware images, setting the processor in its running state, allocating the interchange memory areas, and monitoring for any error message.

In order to load the images files into the processors memory areas, it is required to parse the ELF header of the files, and that is the reason of why I decided to depend on libelf, rather than write another ELF parser. Yes, one sad dependency for the daemon. The use of libelf is isolated in elf.h.

When I was developing the daemon, for debugging purposes, I needed to trace the messages generated by the images in the remote processors. For that reason I wrote tracer.c, whose only responsibility is to read and to parse the ring buffer used by the images, in the remote processors, for logging.

Now, in OMAP4, the subsystem comprised by the two Cortex-M3 processors is called Ducati. The first processor is used only for the exchange of notification messages among the host processor and the second M3 processor, where all the multimedia processing is done.

There are at least two images for the second Cortex-M3 processor: DOMX, which is closed source and focused, as far as I know, on the OMX IL interface; and, in the other hand, DCE, which is open source, it’s developed by Rob Clark, and it provides a simple interface of buffers interchange.

My work use DCE, obviously.

But, please, let me go back one step in this component description: in order to send and receive commands between the host processor and one remote processor, SysLink uses a packet based protocol, called Remote Command Messaging, or just RCM for the friends. There are two types of interfaces of RCM, the client and the server. The client interface is used by the applications running in the host processor, and they request services to the server interface, exposed by the systems running in the remote processors, it is accepting the requests and it returns results.

The RCM client interface is in rcm.h.

Above the RCM client, sits my dce.h interface, which is in charge of control the state of the video decoders and it is also in charge of handling the buffers.

But these buffers are tricky. They are not memory areas allocated by a simple malloc, instead they are buffers allocated by a mechanism in the kernel called tiler. The purpose of this mechanism is to provide buffers with capacity of 2D operations by hardware (in other words, cheap and quick in computations). These buffers are shared along all the processing pipeline, so the copies of memory areas are not needed. Of course, in order to achieve this paradise, the video renderer must handle this type of buffers too.

In my code, the interface to the tiler mechanism is in tiler.h.

And finally, the all mighty GStreamer element for video decoding: gstsyslinkvdec.c! Following the spirit of gst-dsp, this element is intended to deal with all the available video decoders in the DCE image, although for now, the H264 decoding is the only one handled.

For now, I have only tested the decoder with fakesink, because the element pushes tiled buffers onto the source pad, and, in order to have an efficient video player, it is required a video renderer that handles this type of tiled buffers. TI is developing one, pvrvideosink, but it depends on EGL, and I would like to avoid X whenever is possible.

I have not measured either the performance of this work compared with the TI’s combo (syslink user-space library / memmgr / libdce / gst-ducati), but I suspect that my approach would be little more efficient, faster, and, at least, simpler ;)

The sad news, as in every hard paced development, all these kernel mechanisms are already deprecated: SysLink and DMM-Tiler will never be mainlined into the kernel, but their successors, rproc/rpmsg and omapdrm, have a good chance. And both have a very different approach since their predecessors. Nevertheless, SysLink is already here and it is being used widely, so this effort has an opportunity for being worthy.

My current task is to decide if I should drop the 2D buffers in the video decoders or if I should develop a video renderer for them.

by vjaquez at January 16, 2012 08:53 PM

January 12, 2012

Andy Wingo

javascript eval considered crazy

Peoples. I was hacking recently on JavaScriptCore, and I came to a realization: JavaScript's eval is absolutely crazy.

I mean, I thought I knew this before. But... words fail me, so I'll have to show a few examples.

eval and introduced bindings

This probably isn't worth mentioning, as you probably know it, but eval can introduce lexical bindings:

 > var foo = 10;
 > (function (){ eval('var foo=20;'); return foo; })()
 20
 > foo
 10

I find this to be pretty insane already, but I knew about it. You would think though that var x = 10; and eval('var x = 10;'); would be the same, though, but they're not:

 > (function (){ var x = 10; return delete x; })()
 false
 > (function (){ eval('var x = 10;'); return delete x; })()
 true

eval-introduced bindings do not have the DontDelete property set on them, according to the post-hoc language semantics, so unlike proper lexical variables, they may be deleted.

when is eval really eval?

Imagine you are trying to analyze some JavaScript code. If you see eval(...), is it really eval?

Not necessarily.

eval pretends to be a regular, mutable binding, so it can be rebound:

 > eval = print
 > eval('foo')
 foo // printed

or, shadowed lexically:

 > function () { var eval = print; eval('foo'); }
 foo // printed

or, shadowed dynamically:

 > with({'eval': print}) { eval('foo'); }
 foo // printed

You would think that if you can somehow freeze the eval binding on the global object, and verify that there are no with forms, and no statements of the form var eval = ..., that you could guarantee that eval is eval, but that is not the case:

 > Object.freeze(this);
 > (function (x){ return [eval(x), eval(x)]; })('var eval = print; 10')
 var eval = print; 10 // printed, only once!
 10,

(Here the first eval created a local binding for eval, and evaluated to 10. The second eval was actually a print.)

Crazy!!!!

an eval by any other name

So eval is an identifier that can be bound to another value. OK. One would expect to be able to bind another identifier to eval, then. Does that work? It seems to work:

 > var foo = eval;
 > foo('foo') === eval;
 true

But not really:

 > (function (){ var quux = 10; return foo('quux'); } )()
 Exception: ReferenceError: Can't find variable: quux

eval by any other name isn't eval. (More specifically, eval by any other name doesn't have access to lexical scope.)

Note, however, the mere presence of a shadowed declaration of eval doesn't mean that eval isn't eval:

 > var foo = 10
 > (function(x){ var eval = x; var foo = 20; return [x('foo'), eval('foo')] })(eval)
 10,20

Crazy!!!!

strict mode restrictions

ECMAScript 5 introduces "strict mode", which prevents eval from being rebound:

 > (function(){ "use strict"; var eval = print; })
 Exception: SyntaxError: Cannot declare a variable named 'eval' in strict mode.
 > (function(){ "use strict"; eval = print; })
 Exception: SyntaxError: 'eval' cannot be modified in strict mode
 > (function(){ "use strict"; eval('eval = print;'); })()
 Exception: SyntaxError: 'eval' cannot be modified in strict mode
 > (function(x){"use strict"; x.eval = print; return eval('eval');})(this)
 Exception: TypeError: Attempted to assign to readonly property.

But, since strict mode is embedded in "classic mode", it's perfectly fine to mutate eval from outside strict mode, and strict mode has to follow suit:

 > eval = print;
 > (function(){"use strict"; return eval('eval');})()
 eval // printed

The same is true of non-strict lexical bindings for eval:

 > (function(){ var eval = print; (function(){"use strict"; return eval('eval');})();})();
 eval // printed
 > with({'eval':print}) { (function(){ "use strict"; return eval('eval');})() }
 eval // printed

An engine still has to check at run-time that eval is really eval. This crazy behavior will be with us as long as classic mode, which is to say, forever.

Strict-mode eval does have the one saving grace that it cannot introduce lexical bindings, so implementors do get a break there, but it's a poor consolation prize.

in summary

What can an engine do when it sees eval?

Not much. It can't even prove that it is actually eval unless eval is not bound lexically, there is no with, there is no intervening non-strict call to any identifier eval (regardless of whether it is eval or not), and the global object's eval property is bound to the blessed eval function, and is configured as DontDelete and ReadOnly (not the default in web browsers).

But the very fact that an engine sees a call to an identifier eval poisons optimization: because eval can introduce variables, the scope of free variables is no longer lexically apparent, in many cases.

I'll say it again: crazy!!!

by Andy Wingo at January 12, 2012 04:34 PM

January 07, 2012

Adrián Pérez

DMon 0.4.2 “Three Wise Men” released

Don’t expect lots of surprises this time, but an otherwise smooth maintenance release that includes a couple of minor niceties. Changes since version 0.4.1 mostly affected the logging tools (dlog, dslog and drlog):

  • Logging tools now may accept input from arbitrary file descriptors, using the --input-fd command line option. This enables to do some nice redirection tricks from shell scripts and other programs which use them.
  • Logging tools now support adding an arbitrary string in front of logged lines using the --prefix option. For example, this allows to send the output of several commands to a FIFO, and when reading from it it would be possible to know which command originated the message in the resulting output:
    mkfifo logpipe
    dmon cat logpipe -- dlog -t /var/log/combined
    dmon command1 -- dlog -p command1: logpipe
    dmon command2 -- dlog -p command2: logpipe
    dmon command3 -- dlog -p command3: logpipe
  • Logging tools now handle the INT, TERM and HUP signals. When signalled, they will flush buffers to disk, and in the case of drlog check if log rotation is needed; for INT and TERM the processes will also shut down gracefully.
  • The manual pages now also include the long variant of command line options.
  • A number of small improvements: better error messages, removal of some unused code, updated to a slightly newer version of libwheel, better and more consistent command line parsing, silent Make rules…

Make sure you grab the tarball while it is still fresh, and do not forget that a package for Arch Linux is available in the AUR.

Happy 2012!

by aperez at January 07, 2012 08:13 PM

December 31, 2011

Joaquim Rocha

Another year has passed

Today is the last day of 2011 and it is once again when people look back in time and realize what they have done throughout the year and if they stuck to their promises. I don’t give that much importance to events like new year’s eve or even my birthday but I decided to write a blog post and to think about what happened on 2011.

December is also the month I’ve joined Igalia, I have been in the company for 3 year and the changes seem to have been quite some.
I feel 2011 was not a very productive year from the point of view of side projects. I have been working on the toolkit that powers the MeeGo Harmattan (Nokia N9) for a year and a half and that, together with other tasks in Igalia and in my personal life didn’t leave me much time for creating new projects. Still, I released 5 new versions of OCRFeeder; 4 versions of SeriesFinale and ported it for the Nokia N9. Also I have given once again presentations in some nice events like FOSDEM and LinuxTag.

On the personal side of things the big event this year was my wedding with Helena. After that we had a nice time travelling in Turkey after having cancelled the plans to visit Japan due to the earthquake.
We also spent 10 days in Berlin, we are still in love with the city and we wish one day we’ll experience living in there (could it be 2012?).
After 3 years living in Spain, I feel comfortable here, I recognize its virtues and flaws but I want to know more cultures, more languages and thus more ways of seeing life. As for Portugal, it is part of what defines me but Helena and I are not planning on living in there for the foreseeable future, especially these times when the government(s) is(are) making things difficult for everybody.
Related to this and the economic crisis that is going on, this year I joined a demo and a strike for the first time and I keep hoping that things get better for everyone.
I also realized I am now used to donate to some institutions throughout the year and it is something that makes me feel good.

As book counting is something often present in this kind of year’s review, in 2011 I read 10 books and a short story. The most important ones, in case you’re interested are: The God Delusion (Richard Dawkins), Through the Language Glass (Guy Deutscher) and Citações e Pensamentos de Agostinho da Silva (“Quotes and Thoughts of Agostinho da Silva” by the philosopher).

The future

People often say “next year is gonna be a year of change” but things do change and some situations that happened this year have made me think about my life so I really feel there are going to be changes in 2012. Hopefully they will be good ones.

I wish you all a happy 2012.

by Joaquim Rocha at December 31, 2011 06:07 PM

December 30, 2011

Manuel Rego

New LibrePlan website and other bits

LibrePlan website frontpageI’m sure that you have already notice it, but last LibrePlan version comes with a new website that you can visit at www.libreplan.com. The new website has been designed by Opsou (authors of the new logo) and sponsored by Igalia (the main company behind LibrePlan project).

About the website I’d like to explain the different sections:

  • Frontpage: Where you can find a few short texts explaining the most important features of the project. Together with a list of news (mixed with imported tweets from @libreplan) around the project and several links to other website sections.
  • Info: Is divided in 4 subsections where you can find different information about LibrePlan. From the special features that make it different of other planning tools to project history, documentation and license data.
  • Features: Consists of a comprehensive description of all project features. Features are grouped in different subsections and provide screenshots to understand them better.
  • Services: That section contains the main services provided around LibrePlan and the companies involved. As you can see different services are explained in each subsection: consultancy & training, customization & development, deployment & SaaS and, also, how to join us and get involved in the project. If you are interested in any of them you can contact us in the last section of the website.
  • Contact: A section with information about the different ways to contact us in order to request help, support or whatever you need around LibrePlan.

Apart from the main website there are also other services around the project:

  • LibrePlan Planet: A blog aggregator where you can find all the posts done by the development team about the project.
  • LibrePlan Demo: On-line demo to play with last LibrePlan stable version in order to test it and check its main features.
  • LibrePlan Development Wiki: Wiki with information useful for project developers and contributors. All the development around LibrePlan is coordinated and documented with this wiki.
  • SorceForge.net Page: LibrePlan uses SorceForge.net infrastructure. In this page you can find the different resources around the project: published files, mailing lists, user forums and source code repository.
  • LibrePlan Bugzilla: Bug tracking tool to report and manage issues in the project. Anybody could report any problem, error, bug, issue there and the development team would take care to fix it as soon as possible depending on the different priorities of the moment.
  • LibrePlan Jenkins: We use Jenkins for Continuous Integration (CI). Every night LibrePlan project is built and tests are passing for both PostgreSQL and MySQL databases. If any problem happens, developers are automatically notified in order to fix it.
  • LibrePlan Nightly Builds: Taking advantage of project being built every night, we have an unstable deployment with the last developments done. This is a comfortable way to check the last features implemented in LibrePlan, however it’s not valid for a production environment as it’s not so tested like a stable release.
  • LibrePlan Sonar: Sonar is a tool to check software quality. LibrePlan code is checked in order to detect and fix the most important issues.
  • LibrePlan Maven Repository: LibrePlan depends on some specific packages modified by the development team that are not available in Maven central repositories. For that reason we have our own Maven repository in order to ease users and developers to download modified packages used in the project.

After reading it twice the list is quite bigger and we’re already thinking in other stuff (we’ll keep you informed).

Finally, I’d like to wish you all a happy new leap year!

by Manuel Rego Casasnovas at December 30, 2011 09:21 AM

December 23, 2011

Alejandro Piñeiro

Do you want to hear some news about GNOME and accessibility?

Follow-up hackfest

This year we organized an ATK/AT-SPI hackfest on May at Igalia offices. Almost one year after its time to organize a follow-up hackfest. On January a new ATK/AT-SPI2 will be organized, or more in general, an Accessibility hackfest. You can see the details in the the announcement that I sent today and in the live gnome page about the Hackfest, but the summary is that a Hackfest with the target to improve the free accessibility framework will be organized this January (18-22) on Coruña, at Igalia offices. If you want to come to the hackfest put in contact with the travel committee. I want to thank GNOME Foundation and Igalia for their sponsorship.

Friends of GNOME campaign to support Accessibility

Probably you already read Juanjo Marín announcement, but just in case. GNOME has recently started a Friends of GNOME campaign in order to push the effort to make GNOME really accessible. As the campaign says “Help make 2012 the Year of Accessibility for GNOME”.

Friends of GNOME

by API at December 23, 2011 12:28 AM

December 21, 2011

Andrés Gómez

Extending the life of your N8x0: Automatic Skype Launcher

Leading quickly to the “ham”, just install Applications Fullscreener and Automatic Skype Launcher in your N8x0 and turn it into a Skype phone. Now, the long explanation :)

After working in Maemo and MeeGo for the last 5 years I’ve become the proud owner of a N810, a N900, a N950 (by now) and a N9. Obviosly, my old and beloved first maemo device, the N810, has been pushed into the background.

Thinking about how to still keep doing a good use of it, came to my mind the idea of turning it into a Skype phone. Nokia’s hardware is superb and the sound quality of the N810 makes it a good choice for this.

Still, I didn’t need another Skype phone myself but my parents, who have a lot of troubles for making use of Skype’s software in the computer, were the perfect candidates. Also, placing the N810 24/7 online side by side to their land line phone would let them receive and check at any moment for the availability of their regular Skype contacts. That’s it, my oldest’s brother family, who lives in Germany, and myself, who have already spent the last year and half in Finland and will be there, at least, for another six months.

Therefore, I copied all the remaining data out of the N810, cleaned the internal MMC and re-flashed the device with the latest available image and the needed flasher. Afterwards, and for having an easy way for maintaining the device, I upgraded to the OS2008 Feature upgrade and installed Skype, openssh and x11vnc packages. Also, I set the “Red Pill” mode in the Application Manager and added the following repositories:

~# cat /etc/apt/sources.list.d/hildon-application-manager.list
deb http://repository.maemo.org/extras-devel/ diablo free non-free
deb http://repository.maemo.org/ diablo/tools free
deb http://catalogue.tableteer.nokia.com/certified/ diablo user
deb http://catalogue.tableteer.nokia.com/non-certified/ diablo user
deb http://catalogue.tableteer.nokia.com/updates/diablo-2/ ./

In addition, after being able to ssh into the device, I installed the screen package.

Then, I set the connection manager to be connected to my parents WiFi automatically, without energy saving, with the smallest searching intervals, in case it would lose connection, and with unlimited inactivity time.

I modified the display settings for having the bright level, the bright timeout and the timeout for turning it off to the maximum, unchecked the option for blocking the display and keyboard on turning the display off, and set the display to not being permanently on ever. In the LEDs settings I left everything checked but when the device is on.

Because of the possibility of connecting with a bluetooth headset, I also set the bluetooth to be always on and visible.

Finally, I launched Skype and configured a new account for my parents.

The only thing left was to be able to launch Skype automatically at boot time and in fullscreen mode. As I said before, my parents are not really skilled on technology or gadgets use so the simplest approach would be to have a fully working Skype client just after booting and with no more distractions that the contacts list and the button for calling.

Automatic Skype Launcher Icon

I’ve developed the package skype-autolauncher for this task. This package would launch Skype automatically on boot time through a init script. Yes, I know it is not the cleanest way but it just works™ and other strategies are not much cleaner. The init script makes use of dsmetool to monitor the Skype instance so, if it crashes, or is closed by mistake, the application is relaunched. Also, this package adds a cron.daily task which will restart the service so it will also shut down and re-launch Skype for having fresh memory and a healthier running environment.

Automatic Skype Launcher’s code is kept in gitorious. For downloading the code, just type in a terminal:

$ git clone https://git.gitorious.org/skype-autolauncher/skype-autolauncher.git

Applications Fullscreener Icon

For the matter of automatically turning the launched Skype instance into fullscreen mode, I’ve also developed the package apps-fullscreener. This package sends a fake fullscreen hard key event to a XWindow by its process name.

Applications Fullscreener’s code is also kept in gitorious. For downloading the code, just type in a terminal:

$ git clone https://git.gitorious.org/apps-fullscreener/apps-fullscreener.git

That’s it. Comments and patches are welcomed!

by tanty at December 21, 2011 05:03 PM

Joaquim Rocha

RPM packages of OCRFeeder for Fedora

If you’re one of the people waiting for RPM packages of OCRFeeder for Fedora, rejoice!
Juan, my friend and coworker at Igalia, has cooked an RPM spec and created an OCRFeeder repository for Fedora 15 and 16.

To add this repository to Fedora 16 simply download this file and move it to /etc/yum.repo.list/.
Alternatively you can download the RPMs directly from:
OCRFeeder RPM for Fedora 15
OCRFeeder RPM for Fedora 16

Important: These Fedora packages haven’t been thoroughly tested and there might be tiny issues currently (like the icons not being installed in the right place) and I’m no longer using Fedora myself (I’ve switched to Debian) so please report any issues you might find.

by Joaquim Rocha at December 21, 2011 05:01 PM

December 16, 2011

Víctor Jáquez

devhelp and jhbuild v2

A couple years ago I wrote a small tip about how to integrate the devhelp installed by your distribution with the documentation generated through jhbuild.

Well, that way is plain wrong. I noticed it when I upgraded to GNOME 3: modifying the environment variable XDG_DATA_DIRS, the gnome-session goes crazy.

So, I found a less intrusive way to make your distro-based devhelp reads the jhbuild-generated documentation:

ln -s /opt/jhbuild/share/gtk-doc/ ~/.local/share/

And that is it!

by vjaquez at December 16, 2011 09:31 PM

Carlos García Campos

Preliminary WebKit2 GTK+ API documentation

We have just released WebKitGTK+ 1.7.3, the first release that includes WebKit2 API docs already generated in the tarball. The documentation is also available online now. Take into account that WebKit2 is still under development and the API might change, more specifically WebKitWebLoaderClient is going to be removed soon.

by Carlos Garcia Campos at December 16, 2011 11:31 AM

December 15, 2011

Joaquim Rocha

Supporting Wikipedia again

It is one of the greatest accomplishments of humanity and we should be proud of it:

Support Wikipedia

If Wikipedia is useful for you, click the link above and make a donation to help supporting it.

by Joaquim Rocha at December 15, 2011 10:02 PM

Javier Muñoz

Physical Security & Criptography at MSWL 2012

Great time at Master Software Libre teaching Physical Security and Cryptography contents this year. Two key areas at Information Security and Privacy.

These lessons were the first ones happening before my usual lessons on Networking, Security Networking and Linux Kernel.

On Physical Security time we worked on well-know physical system security methodologies, together with two new relevant topics: environmental design and design and evaluation of physical protection systems.

It was a lesson covering broad and detailed topics; ranging from designing defensible spaces, where you are able to use different elements and aspects to get natural social control and crime prevention, till a full description of technology and sensor availability to protect different facilities. Security standards or some notes to understand social behaviour (The Bronx study case) were worked out too.

On Cryptography, we walked along its history and development in order to understand cryptographic models and current crytographic systems, free/open software tooling, integration and usual use cases. At the end, everybody got their crypto stuff in place, ready to take part in keysigning parties and next social community events.

Ah! I almost forgot. This year, students will elaborate on the right design to build a safe and secure physical protection system for one embassy.

by javier at December 15, 2011 05:14 PM

Manuel Rego

LibrePlan in Transifex.net

Maybe you don’t know Transifex, an open source platform for software projects localization. It supports a great variety of files including the two kind of translation formats that we use in LibrePlan:

  • .po: GNU gettext localization system. The whole LibrePlan application but reports is translated with this kind of files.
  • .properties: Standard Java localization files. We use this kind of files in LibrePlan reports generated with JasperReports.

From now on, LibrePlan translators wouldn’t have to deal with these files if they don’t want to. They can use directly Transifex.net to translate LibrePlan to different languages. The main advantage, is that you just need a browser to translate all these files. We think that this is going to make translators’ life easier.

LibrePlan translation status (main localization file)As you can see in the image, LibrePlan is fully translated into: English, Spanish and Galician. Moreover, it’s almost 100% in Portuguese, and around 80% in Russian.

Finally, I’d like to thank our translators for their hard work, we’re really happy to count with their contributions. And, I’d also like to encourage any other people to help us to have LibrePlan available in more languages (some new languages are already ongoing). Now, it’s going to be easier than ever.

by Manuel Rego Casasnovas at December 15, 2011 04:13 PM

December 10, 2011

Joaquim Rocha

OCRFeeder 0.7.7 released

After more than 4 months, I am finally releasing OCRFeeder‘s new version (its last release was in August, just before the DesktopSummit).
The reason for the delay, apart from some vacation in Berlin and Portugal and being busy in Igalia, was that this release brings deep changes internally.

The big issue

The problem with developing such an application from scratch in just a few months and worrying about writing a thesis is that you don’t care much for design and performance. So from 2008 until now, OCRFeeder has suffered a big problem related to memory consumption: depending on the number of images loaded and their size, it would create a reviewer (this is what I call the place where you do stuff on the images) per image and those would remain in memory, eventually crashing.
I assumed that since nobody complained about that for so long it was probably because people made a simpler usage of the application and didn’t use it for full books but now it seems that some institutions are interested in OCRFeeder and there have a been complaints and bugs filed (gb#637599 and db#646605).

This was fixed by having only up to 5 instances of reviewers. When selecting a new image, it will drop the oldest reviewer and have this one added to the cache. It gets a bit slower to select a new image but the trade-off is worth IMHO. In future changes I’ll probably make the number of reviewers configurable in some way.
Each of the content areas now also shares an editor instance instead of each one having a dedicated one.

I was able to load more than 500 images of ~4.5 Mb each and it was still usable so hopefully this will improve the experience for users who had these problems.

Other changes

Another change is that now OCRFeeder stores all its temporary files in a dedicated temporary folder under the system’s temporary folder (usually /tmp). By deleting this folder when the application quits it’s guaranteed that no temporary files will be left (as happened sometimes). Related to these changes, I’ve also decided to remove the possibility of choosing the temporary folder. Supposedly Python will already know what’s the system’s temporary folder and having such an option would make it look like Windows software from 1998.

As usual, some code cleaning and bug fixing was done and I would like to thank the awesome GNOME i18n team and everyone who sent their contributions.
Thanks to my friend Berto you can also expect an OCRFeeder Debian package on a repository next to you soon.

For a more detailed list of changes, check out the NEWS file.

Source Tarball
Git
Bugzilla

by Joaquim Rocha at December 10, 2011 04:12 PM

December 08, 2011

Martin Robinson

WebKitGTK+ hackfest wrapup: accelerated compositing

I just returned from this year's WebKitGTK+ hackfest. Not only was it the mostproductive hackfest to date, the diversityof the people involved was incredible. Attendees included hackers from Igalia, Collabora, RedHatand Motorola. It's great to be part of a company which can pull this kind ofevent together.

WebKitGTK+ 2011 Hackfest
Planning
 One of the things different about this hackfest were the BoFs, which weremainly planning sessions. The WebKitGTK+ community has shifted from a ragtaggroup of developers unafraid of g_object_ref/g_object_unref furiously hackingon a tiny WebKit port to an integral piece of the Gnome renaissance movingsteadily toward ambitious goals. I'm obviously biased, but I believe theinvestment of small companies with strong ideals like Igalia and Collabora isdirectly responsible. 

Others have already reported on some of the incredible work at the hackfestincluding the bold new Epiphany redesign, accessibility support for WebKit2,and JHBuild-ification. I'd like to talk a bit about something in which I'mpersonally involved: accelerated compositing.

Epiphany's new look
Accelerated compositing was introduced in 2009 with the bulk of the workprovided by Apple and Google. GPUs are quite fast, but because of the overhead of moving bits from main main memory to GPU memory, you need to use them intelligently to see any speedup. Accelerated compositing is the smarts neededto use the GPU intelligently in WebKit. We're also trying to push these smartsdown into painting libraries such as Cairo and Skia, but that's a moredifficult task, with less immediate benefit. The best performance improvementscome from using the GPU at the place that maintains the drawing state.

In the context of WebKit, drawing state is the rendered page itself, with allits layered divs, canvas elements, video tags and WebGL contexts. WebKit storeselements to render in a data structure called the "render tree." Members of thethe render tree which are drawn in main memory must be sent to the GPU to bedisplayed on the screen. Furthermore, some of these elements may be rendered onthe GPU itself, so ideally we want to avoid copying them to main memory only tocopy them back to the GPU at a later stage.

CPUs are very fast, so it's often sufficient to rasterize things into mainmemory. On the other hand, when the entire page is rendered by the CPU, itspends a lot of time doing "boring" tasks that the GPU loves doing, such ascompositing (blending images into each other). Accelerated compositing attacksthis by slicing the page into layers of related content. The way this slicingworks is a heuristic, but generally speaking divs at the same z-index, with thesame CSS transform, WebGL contexts and hardware accelerated video are their ownlayer. It renders each of the non-GPU layers into an image and then uploads allthe images to be composited by the GPU along with layers that are alreadythere.

Collabora, which created the Clutter port of WebKit has an implementation ofaccelerated compositing using Clutter. At the hackfest, Joone Hurr and GustavoNoronha Silva started integrating this version into WebKitGTK+. Thenice thing about the Clutter implementation is that it's almost complete. Theunfortunate thing is that Clutter uses COGL which has very poor support forusing raw OpenGL in the application. Obviously this means that the WebKitGTK+port would need to rewrite it's WebGL backend. Igalia is also workingon two implementations (OpenGL and the Cairo fallback) using No'am Rosenthal'svery nice TextureMapper abstraction.

During the hackfest, we decided to attempt to integrate all three approaches intothe tree. The Clutter version is a nice stopgap for people who want to playwith accelerated compositing or are using Clutter already. The intial parts ofthis implementation should be landing soon. Over the next few months we'll alsobe submitting OpenGL and Cairo versions of accelerated compositing. We alreadymade great progress at the hackfest. If you're interested in following thework, you can follow the accelerated compositing metabug.

by noreply@blogger.com (Martin Robinson) at December 08, 2011 03:32 PM

December 05, 2011

Mario Sánchez

WebKitGTK+ Hackfest: WK2, a11y and Ephiphany’s ad blocker extension

Some posts have been already published about this during the last days, but just in case you missed them I will mention it here again: Last week, a bunch of hackers gathered together in the Igalia office in Coruña for the third edition of the WebKitGTK+ hackfest , and a lot of work has been done, as Juanjo has already summarized in his “WebKitGTK+ hackfest wrap up” post.

WebKitGTK+ 2011 Hackfest

So, as everything has been already said from a more general perspective, I’d like to write my very personal wrap up here, focused on the tasks that I’ve been working on, which can be summarized in three:

  • Enabling accessibility support in WebKit2GTK+.
  • Rewrite of the Ad Blocker extension for Epiphany.
  • Bug fixing in WebKitGTK+’s accessibility related code.

Enabling accessibility support in WebKit2GTK+

This has been, by far, the task I devoted most of the time to during the hackfest, mainly focused on writing a ‘feature complete’ patch that could be applied upstream, and thus that could be reviewed in first place. But, what do I mean by “a ‘feature complete’ patch”? Well, perhaps you are already aware of the initial results already got in the WebKit2GTK+ a11y realm, but those results were obtained with a patch still in a very early state and, among other things, lacking a very important requirement for getting it accepted upstream: tests.

Fortunately, I can now proudly say that I managed to find a good way to write those tests (specially tricky due to the multiprocess architecture of WebKit2) and that there shouldn’t be any problem either with getting them work properly in the buildbots, which was something I was quite concerned about by the begining of the week, to be honest.

Besides the tests, the other obvious problem was that such a patch was not widely tested yet with the Orca screen reader (I use Accerciser for development purposes most of the time), and that would for sure unveil issues that would need fixing before being really able to propose a patch for reviewing, and so that was the other aspect where I put the spotlight during this week.

And regarding to this, I have to say that Joanmarie Diggs was working tirelessly by testing Orca with my WebKit2GTK+ a11y patch, reporting bugs, and helping me a lot to prioritize the tasks that would need to be done. From all those, I mainly worked this week in the following ones:

  • Emitting the AtkDocument’s signals (‘load-complete’, ‘load-stopped’ and ‘reload’), which was working only in WebKitGTK+ but not in WebKit2GTK+. See the bug report and the patch (still pending on review) for this issue in bug 73750. Also, I reported and worked for a while in another bug related to this, which is now already fixed upstream (see bug 73746). Yay!
  • Ensure that the accessibility hierarchy doesn’t break when (re)loading, which was causing that Orca stopped speaking unless it “manually” drilled down the full a11y hierarchy after the (re)load. I finally fixed that issue yesterday and integrated it in the patch for enabling a11y support in WebKit2GTK+, now already attached and pending on review along with bug 72589.

So, the conclusion of this part would be that we have now a patch in WebKit’s bugzilla (see bug 72589) that, once it’s approved, would enable accessibility in WebKit2GTK+ once and for all. Of course, this will probably take some time before it gets accepted upstream, but it’s yet another nice milestone in my opinion, and I personally hope it would happen on time for GNOME 3.4. Time will tell, though.

Rewrite of the Ad Blocker extension for Epiphany

This was another thing I’ve been randomly working on since some time ago (whenever “spare” time permitted), and that I was able to advance quite a lot right after coming back from the parental leave I enjoyed on September (did I say my second child was born on August the 30th?). However, the patch was not finished by any means, and some issues kindly pointed by Xan in bugzilla needed fixing before being able to say aloud something like “hey, the new ad blocker is now in town!”.

Thus, we thought it would be good to devote some time during the hackfest to try to close this task too, so we did: Xan reviewed the new version of the patch (addressing the issues he previously pointed out), I made some last changes based on that new feedback from him and we finally pushed it to the repository, replacing the old ad blocker extension with this new one, which is based in Midori’s ad blocker and so is compatible with Adblock Plus filters, which work very well IMHO.

So, this basically means that the new ad blocker extension will be present from Epiphany 3.4 on. Check out the related bug in GNOME’s bugzilla: bug 660154

Bug fixing in WebKitGTK+’s accessibility related code

Besides working in the WebKit2GTK+ a11y realm and on finishing the new ad blocker extension, I’ve also spent some time (although not as much as I would have wanted) fixing regressions in WebKitGTK+’s a11y code as reported by Joanie (basically bug 72804 and bug 72830).

Compared to the other two points, this has been of course a pretty small contribution, but worth doing anyway since they were very important for Orca to work properly with WebKitGTK+ based browsers (special mention to bug 72830 here).

Conclusion

From the work-related point of view, I’d say this hackfest has been highly productive in general, as we achieved many goals which, as Juanjo pointed out in his wrap up post, “were not mainly about fixing critical and blocker bugs and implementing basic missing features, but about more ambitious and challenging” ones. As for me, I’m pretty happy with the results I got, specially with the WK2 a11y patch, which has now a much better shape, and so I hope we can integrate it soon upstream.

And from a more personal point of view, I’d like to say I had a great time (again!) this year in the hackfest, and not only because of the achiements got, but also because I had quite a lot of fun as well, because I met new people and because I felt, more than ever, part of a community and a project which I love.

To finish, I’d just like to mention that I’ve been taking some pictures during the hackfest, which you can check out in this photo set in flickr (pictures uploaded with Frogr, of course!). Nayan has also taken some pictures as well, check them out here.

WebKitGTK+ 2011 Hackfest (The End)

Of course, thanks a lot to the sponsors that made this possible: Collabora, Motorola, Igalia and the always awesome GNOME Foundation. I hope we’ll be able to repeat it next year, since this hackfest it’s only getting more and more awesome every time it happens.

by msanchez at December 05, 2011 10:01 PM

December 04, 2011

Juan José Sánchez Penas

WebKitGTK+ hackfest wrap up

After more than 5 days of hacking, discussions and some social activities, the 3rd edition of the WebKitGTK+ hackfest, which took place at the Igalia office in A Coruña, is coming to its end. We are about to go for dinner and most people are leaving tomorrow early in the morning, so it is time  for wrapping up.

WebKitGTK+ 2011 Hackfest

In my opinion the hackfest has been a success both in terms of technical progress and consolidating a common vision within the team about the way forward both for WebKitGTK+ and Epiphany. The intense work we have been doing during the past 2 years has given its results, and unlike the previous two editions in 2009 and 2010, the topics defined in the agenda this time were not mainly about fixing critical and blocker bugs and implementing basic missing features, but about more ambitious and challenging goals, aiming to make WebKitGTK+ and Epiphany rock.

Examples of this are the progress achieved this week in several areas, including the Epiphany improvements & new design, a consolidated WebKit2 API (which will improve the performance and stability once used by the browsers and embedders), accelerated compositing support, improved HTML5 video support, better accessibility support, JSC improvements, HTML5 notifications, HTML5 history, better networking, new and more updated bots for the continuous integration, or developer documentation.

Besides taking care of many of the organizational bits, my contributions were focused on participating in the discussions about the new Epiphany UI and mainly on the integration of open web apps and HTML5 technologies within GNOME. I will be blogging very soon about how we see this integration happening and the initial proofs of concept that we have already started to implement.

WebKitGTK+ 2011 Hackfest

Finally, I would like to thank our sponsors (Collabora, Motorola and Igalia) and mainly the GNOME Foundation for their contributions. Without this support, getting together 20 hackers in the same room, taking care of them, and enabling all the progress we have had during the week would have been impossible.

by jjsanchez at December 04, 2011 07:11 PM

Xan López

A new design for Epiphany: Web

As you might have heard in many other places a bunch of GNOME and WebKit hackers have met in rainy Coruña for the 3rd WebKitGTK+ hackfest. Many things have been discussed, but today I’m going to give a sneak preview of the new design for Epiphany and its rebirth as the core GNOME Web application.

The design is still very much a work in progress, but I can try to briefly talk about some of the highlights of the refreshed concept:

  • Focus on the current page content. This means, in general, that we’ll get rid of as much chrome as we can (a trend that we started some time ago already), and in particular and more visibly that we won’t have a visible tab bar by default.
  • The tab bar might be gone, but we’ll still offer a convenient, and we think improved, way of switching between pages. All the currently and recently opened pages are visible in the overview (the new start page), and we’ll provide a way of switching between them with the mouse or keyboard shortcuts. You can see an early animated mockup of this in this video of the gnome design youtube channel (link to the video):
  • We have tried to identify and make easier other tasks that have been historically solved with tabs. One of the most common ones is “I want to read this web later, I’ll save it in a tab”. Epiphany will now provide a specialized mechanism for this, called Queues. The design team is working on the details of its implementation, but we have already some interesting ideas; for instance, when you open links in a Google Search results page with middle click a new queue could be automatically created with the results page as the parent and all the links you open as items in the queue.
  • There’s many more ideas that are either refinements of already existing features, like Web Application integration, or nailing down the last details of long-term developments, like improved stability and performance thanks to the upcoming WebKit2 support. Make sure to follow the GNOME Design team or Epiphany channels to keep in touch with things as they evolve.

The mighty Igalians (namely Claudio and myself) are already busy at work implementing the new design. For now we are focusing on a series of incremental patches that will move us closer to the end goal, that way we’ll have something usable even if the design or the full implementation of the Web application are not ready in time for 3.4. You can check the current Roadmap, and as always if you want to help us just drop by #epiphany @ GimpNet or send an email to the epiphany-devel mailing list.

Until the next time, thanks to all the attendants to this year’s WebKitGTK+ hackfest, and to all the sponsors for their support. Happy hacking!



by xan at December 04, 2011 03:21 PM

December 03, 2011

Juan José Sánchez Penas

Open web apps and device APIs

During the past couple of weeks I have been (together with some other colleagues at Igalia) checking the different solutions that the main actors in the ‘open web’ are proposing to enable the local installation of web apps and the interaction with the underlying platform or device, in some cases going beyond the standard HTML5 interfaces.

I will try to give here a high level overview of the alternatives and also provide a few links that can be useful for those interested in the topic.

  • W3C

In 2006, the W3C started to work in the definition of W3C Widgets. Despite what the name may suggest, those ‘widgets’ are actually complete apps developed using HTML5 technologies (HTML/CSS/JavaScript), packaged as compressed files, which include an XML manifest with metainformation. You can read a more detailed explanation about what ‘widgets’ are and what they are not in this series of blog posts published recently in the W3C community pages.

Three years later, in 2009, the W3C started to work on another complementary standard called DAP (Device API), an extension of the HTML5 APIs that would allow a more complete access from DAP enabled apps to the system where they are running, including interactions with battery, camera, contacts, basic messaging, network, vibrator, sensor and calendar.

These two standards were used by some third parties, sometimes partially modifying them, and in other cases taking them as inspiration for pretty different and incompatible solutions (leading to a well known situation). We will see now the main alternatives that have appeared during the past couple of years.

  • WAC

At Mobile World Congress 2010, in Barcelona, 24 major operators announced WAC (Wholesale Applications Community), an industry consortium to create an open platform for developing and distributing HTML5-based mobile apps.

WAC defines APIs for interaction with the device’s camera, contacts, calendar, tasks, messaging (basic), accelerometer, device status, filesystem, device interaction (lights, vibration), orientation, geolocation. They are similar but not totally compatible with W3C APIs. There is a multiplatform SDK based on Eclipse and the Android emulator which automates the process of creating the package with the XML manifest and the  HTML/JS/CSS files, and testing it.

The consortium is currently working on the 3.0 release of the WAC API spec, which according to the (lack of) information available in their webpage is being defined privately, making participation of those external to the consortium extremely difficult. Also, the channel for application distribution is proprietary, so although WAC is based on open standards, the solution is quite closed and seems not attractive for open source projects.

  • Chrome

A bit later, still in 2010, at the same time they announced the Chrome web store, Google defined two possibilities in order to install web apps in the browser: hosted apps and packaged apps.

Hosted apps are a classical webpage which provides a JSON manifest (similar to the one that had been defined for the W3C widgets) including the launch URL, basic data, autoupdate settings, permission for accessing each of the standard HTML5, and a few other bits. Providing the manifest enables easier installation and
simplifies and speeds up a bit the opening of the webpage, but that’s all.

Packaged apps go a step beyond. They are webapps that are bundled into a .crx file (a Zip file, same format used for Chrome extensions), they can use most of the Chrome extension API (only the creation of page actions and browser actions are not allowed), and are limited to 10MB of total size. Packaged apps include the same kind of manifest than hosted apps (this time describing also permissions for accessing the Chrome extension API modules), so they are similar to (but incompatible with) the W3C Widgets. There are various reasons why this kind of apps make more sense than a hosted app for some use cases.

It is worth noticing, for those less familiar with the terms, that packaged apps, although they use the Chrome extension API, are something totally different. Extensions don’t have their own UI and are complementing the behaviour of the browser, typically for all the webpages, while packaged apps are actual web apps with their own UI, that are designed to run locally. There are  instructions available which clarify when hosted apps, extensions and packaged apps are typically used.

Although Google’s proposals are well documented, they seem to be clearly targeting their own app store, and not the open web. There is not a description of how somebody could install Chrome web applications from their own webpage.

As far as I know, Google hasn’t defined a solution similar to DAP’s or WAC’s device APIs so far, so their proposal for device interaction would be to use just standard HTML5 interfaces.

  • Mozilla

More recently, in February 2011, Mozilla announced that they were working on what they call Open Web Apps. The idea is pretty similar to W3C’s Widgets and Chrome’s hosted apps: ordinary web apps plus a JSON manifest with very similar but yet again slightly incompatible fields. The main two additions are a ‘widget’ field where you can point to an HTML file that would be a simplified version of your standard UI, and a few well documented hooks in order to enable the creation of app stores not controlled by Mozilla (e.g. navigator.mozApps.install, navigator.mozApps.amInstalled JavaScript functions).

Even more recently, in August 2011, they announced WebAPI, an extended HTML5 API specially designed for phones, similar to W3C’s DAP and WAC, but again not compatible. WebAPI includes APIs for telephony&messaging, contacts, battery, contacts, camera, filesystem, device status, settings, accelerometer, mouse lock, vibrator, and more. Although the work has just started,  there are already some examples of applications working on Android using some bits of WebAPI.

This comment in Mozilla’s bugzilla is relevant if you are trying to understand why they are not considering using WAC’s APIs directly. And this email to one W3C mailing list is relevant to understand why they didn’t use W3C’s DAP either.

As far as I know, Mozilla doesn’t have the equivalent to Chrome’s packaged apps, or ‘W3C Widgets’, and they are focusing the work more on open web apps and the extended device APIs.

  • Summary

The W3C, Google, Mozilla, WAC and others have been working for the past three years on defining proposals for the installation of web apps and the interaction with the underlying system/device from them. Although unfortunately the situation is quite fragmented, given that the solutions are quite similar, it is possible to imagine a convergence in the near future, that would benefit (almost) everybody. There have been already positive statements by some of the key players.

by jjsanchez at December 03, 2011 07:19 PM

December 02, 2011

Andy Wingo

webkittens! lexical scoping is in danger!

The GTK+ WebKittens are on the loose here in Coruña. There's folks here from Red Hat, Motorola, Collabora, and of course Igalia. It's good times; beyond the obvious platitudes of "um, the web is important and stuff" it's good to be in a group that is creating the web experience of millions of users.

My part in that is very small, adding support for block-scoped let and const to JavaScriptCore.

I've made some progress, but it could be going more smoothly. I have made the parser do the right thing for const, correctly raising errors for duplicate bindings, including nested var declarations that get hoisted. The parser is fine: it maintains an environment like you would expect. But the AST assumes that all locals get hoisted to function scope, so there's no provision for e.g. two distinct local variables with the same name. So there is still some work to do on the AST, and it's a thicket of templates.

Hopefully I'll end up with a prototype by the end of the hackfest (Sunday). Sooner if I find that sword of omens, which I seem to have misplaced. Sight beyond sight!

by Andy Wingo at December 02, 2011 05:36 PM

November 29, 2011

Víctor Jáquez

OpenMAX: a rant

I used to work with OpenMAX a while ago. I was exploring an approach to wrap OpenMAX components with GStreamer elements. The result was gst-goo. Its purpose was to test the OpenMAX components in complex scenarios and it was only focused for the Texas Instruments’ OpenMAX implementation for the OMAP3 processor.

Some time after we started gst-goo, Felipe Contreras released gst-openmax, which had a more open development, but with a hard set of performance objectives like zero-copy. And also only two implementations were supported at that moment: Bellagio and the TI’s one mentioned before.

Recently, Sebastian Dröge has been working on a redesign of gst-openmax, called gst-omx. He explained the rational behind this new design in his talk in the GStreamer Conference 2011. If you are looking for a good summary of the problems faced when wrapping OpenMAX with GStreamer, because of their semantic impedance mismatch, you should watch his talk.

In my opinion, the key purpose of OpenMAX is to provide a common application interface to a set of different and heterogeneous multimedia components: You could take different implementations, that could offer hardware-accelerated codecs or either any other specialized ones, and build up portable multimedia applications. But this objective has failed utterly: every vendor delivers a incompatible implementation with the others available. One of the causes, as Dröge explained, is because of the specification, it is too ambiguous and open to interpretations.

From my perspective, the problem arises from the need of a library like OpenMAX. It is needed because the implementer wants to hide (or to abstract if you prefer) the control and buffer management of his codification entities. By hiding this, the implementer has the freedom to develop his own stack closely, without any kind of external review.

In order to explain the problem brought by the debauchery in the hind of OpenMAX, let me narrow the scope of the problem: I will not fall on the trap of portability among different operative systems, specially in those of non-Unix. Even more, I will only focus on the ARM architecture of the Linux kernel. Thus, I will not consider the software-based codecs, only the hardware-accelerated ones. The reason upholding these constrains is that, beside the PacketVideo’s OpenCORE, I am not aware of any other successful set of non-Unix / software-based multimedia codecs, interfaced with OpenMAX.

As new and more complex hardware appears, with its own processing units, capable of off-loading the main processor, silicon vendors must deliver also the kernel drivers to operate them. This problem is very recurrent among the ARM vendors, where the seek of added value gives the competitive advantage, and the Linux kernel has the virtues required for a fast time to market.

But these virtues have turned into a ballast: It has been observed excessive churn in the ARM architecture, duplicated code, board-specific data encoded in source files, and conflicts at kernel’s code integration. In other words, every vendor has built up their own software stack without taking care of developing common interfaces among all of them. And this has been particularly true for the hardware-accelerated multimedia components, where OpenMAX promised to the user-space developers what the kernel developers could not achieve.

First we need a clear and unified kernel interface for hardware accelerated multimedia codecs, so the user-space implementations could be straight, lean and clean. Those implementations could be OpenMAX, GStreamer, libav, or whatever we possibly want and need.

But there is hope. Recently there has happened a lot of effort bringing new abstractions and common interfaces for the ARM architecture, so in the future we could expect integrated interfaces for all these new hardware, independently of the vendor.

Though, from my perspective, if we reach this point (and we will), we will have less motivation for a library like OpenMAX, because a high level library, such as GStreamer, it would cover a lot of hardware within a single element. Hence, it is a bit pointless to invest too much in OpenMAX or its wrappers nowadays.

Of course, if you think that I made a mistake along these reasons, I would love to read your comments.

And last but not least, Igalia celebrates its 10th anniversary! Happy igalian is happy :)

by vjaquez at November 29, 2011 03:33 PM

November 28, 2011

Andy Wingo

fscons 2011: free software, free society

Good morning, hackersphere! Time and space are moving, in the egocentric coordinate system at least, but before their trace is gone, I would like to say: FSCONS 2011 was fantastic!

FSCONS is a conference unlike any other I know. I mean, where else can you go from a talk about feminism in free software, to talk about the state of the OpenRISC chip design project, passing through a hallway track conversation on the impact of cryptocurrency on the welfare state, approached from an anarchist perspective?

Like many of you, I make software because I like to hack. But I make Free Software in particular because I value all kinds of freedom, as part of the "more beautiful world our hearts know is possible". We make the material conditions of tomorrow's social relations, and I want a world of sharing and mutual aid.

But when we reflect on what our hands are making, we tend do so in a context of how, not why. That's why I enjoyed FSCONS so much, that it created a space for joining the means of production to their ends: a cons of Free Software, Free Society.

As a GNU hacker, I'm especially honored by the appreciation that FSCONS particpants have for GNU. FSCONS has a tithe, in which a portion of the entry fees is donated to some project, and this year GNU was chosen as the recipient. It's especially humbling, given the other excellent projects that were nominated for the tithe.

So thank you very much, FSCONS organizers and participants. I had a great time!

are you bitter about it?

I gave a talk there at FSCONS, GNU Guile: Free Software Means of Production (slides, notes).

Unlike many of my other talks, this one was aimed at folks that didn't necessarily know very much about Guile. It was also different from other talks in that it emphasized Guile as a general programming environment, not as an extension language. Guile is both things, and as the general-purpose side gets a lot less publicity, I wanted to emphasize it in this talk. Hopefully the videos will be up soon.

In the last 20 minutes or so, we did a live-hack. Inspired by a tweet by mattmight, we built Bitter, a one-bit Twitter. I tried to convey what it's like to hack in Guile, with some success I think. Source code for the live-hack, such as it is, is linked to at the end of the page.

For a slightly more extended example of a web application, check out Peeple, originally presented in a talk at FOSDEM, back in February. Peeple has the advantage of being presented as a development of separate git commits. Slides of that talk, Dynamic Hacking with Guile, are also available, though they are not as developed as the ones from FSCONS.

Finally, for the real documentation, see the Guile manual.

Happy hacking, and hopefully see you at FSCONS next year!

by Andy Wingo at November 28, 2011 11:38 AM

November 19, 2011

Carlos López

IKEA Hackers: LackRack

Among the hundreds of hacks from the fantastic website IKEA Hackers, one is particularly interesting.

How to build a rack with an IKEA lack table worth less than 10 euros?
Well, with this manual:

The best of the LackRack (after its price) is that its construction is modular and you can grow it with your needs:

5x LackRack

The LackRack is the ultimate, low-cost, high shininess solution for your modular datacenter-in-the-living-room. It is said that Google engineers were the first to explore the idea of using lack tables for data centers. The LackRack is so famous that even has its own website: http://lackrack.org/ :D

by clopez at November 19, 2011 10:30 PM

Carlos García Campos

libgxps 0.2.0

More than a month ago I released libgxps 0.1.0, the first release of libgxps, but for several reasons I ended up not announcing it. I’ve just released a new version that includes a small API break and a lot of new features and improvements, see the release notes for further details. I’ll release evince 3.3.2 next week depending on this new libgxps version (when building with –enable-xps).

by Carlos Garcia Campos at November 19, 2011 07:08 PM

November 17, 2011

Joaquim Rocha

SeriesFinale for Harmattan (N9/N950)

As promised before, here is the first release of SeriesFinale for MeeGo Harmattan.

This summer Micke Prag, a fellow programmer from Sweden contacted me because he was starting a port of SF for Harmattan. By then I still didn’t have an N950 because of having missed the deadline for the first developers program. Later, when the second developers program was launched I managed to finally get one. At that point, even though I already had my Samsung Galaxy S (yes, with Android) I still wanted to have a port of SeriesFinale as I had received many emails asking for this port so I started from Micke’s code and finally here it is!

The Harmattan port

SF first version for MeeGo

Maybe it is something obvious but this version is not written in PyGTK/PyMaemo. It uses part of the “old” Python backend that was changed to play well with the new UI code written in QML.

This port’s code is a bit dirty by now and I’m sure there are bugs in this first version but at least it can be used and I didn’t want to make people wait much more. The support and feedback that SeriesFinale’s users have given me is amazing (some people even saying they still use the N900 only for SF!), thank you all for it.
My heart is still filled with GNOME/GTK+ love but QML is really impressive; there are some things I still need to spend some time with to figure out but I like how quick and flexible one can do stuff in QML.

The OVI Store

It was also the first time I published something on Nokia’s Ovi Store and the process took around 2 weeks before it finally got approved (it was rejected twice before due to weird stuff like “they” thinking bugs.maemo.org was not a good place to report issues or the fact that an application that says it works only with English US is eligible only for the USA, not for all the countries…).

The future

I really like the N9/N950. The user experience is something awesome and I believe this was the phone that could really compete with the iPhone and Android. Unfortunately someone at Nokia disagrees and the future of this incredible phone is doomed even though Nokia’s alternative is not better. Due to this mainly, I’m not using the N950 as my main phone. This and the fact that my personal time, in which I develop SF, is very limited, means that unless things change, I don’t know how much more releases I will do but I still wanted to add some cool features. It will probably depend again on the feedback and support.

Anyway here it is at an Ovi Store a few taps/swipes away and for free, as always (although I appreciate when someone buys me a beer :) ):

Get SeriesFinale from Ovi Store

by Joaquim Rocha at November 17, 2011 11:58 PM

Juan José Sánchez Penas

Announcing the WebKitGTK+ hackfest 2011

For the third year in a row, by the end of this month (29th of November – 5th of December) we will be hosting at the igalia office in A Coruña a new edition of the WebKitGTK+ hackfest.

WebKitGTK+ 2010 Hackfest

About 20 GNOME and WebKit hackers will be working in the same place for a week on topics related to WebKitGTK+, Epiphany, JavaScriptCore, accelerated compositing, networking, accessibility, multimedia, GNOME Shell browser integration, web technologies for GNOME apps, and more.

The event is possible thanks to the invaluable support of the GNOME Foundation, being both Collabora and Igalia official sponsors.

The hackfest was a total success in previous years, and we have even higher expectations for this edition. We will blog during the week about the plans and achievements, so stay tuned.

by jjsanchez at November 17, 2011 03:54 PM

November 16, 2011

Juan José Sánchez Penas

10 years of igalia

As you probably have noticed via other sources, this month we are celebrating something very significant for us at igalia: we, the company, the project, the collective, are becoming 10 years old.

It has been an amazingly intense experience. 10 years is a lot of time, and for those of us who have been here since the very beginning, born close to the end of the 70s, it means that about 1/3 of our life, and therefore almost all our adulthood, was professionally devoted to contribute to the construction and evolution of igalia.

Although many things were discussed along several meetings during the first half of 2001, when we started defining our founding principles, two were clearly identified as the pillars of the project:

  • We wanted to develop free software, to participate in the amazing, international network of cooperation where people were then starting to explore new paths towards open innovation. Using and supporting free software, the most common business models back then (and arguably still now) was nice, but we wanted to go further and to humbly devote most of our energy to build new -and to contribute to already existent- software.
  • We wanted to bring direct democracy to the working place, embracing a cooperative internal structure, sharing ownership and making all the members of the project participate in the discussions and decisions that define the future of the company.

Looking back, I honestly think that we did a good job respecting those founding principles. Both us (individually and collectively) and our environment have changed a lot over the years, we have gone from a small local team of people to a much bigger and international team composed by colleagues with many nationalities working from many different locations; we have gone from small and local customers to working internationally with most of the relevant actors which are using or contributing to the different open source platforms/projects; we have gone from being relatively inexperienced but passionate and willing to learn to equally passionate but with already some experiences to learn from; and all this time, without exceptions, the essence has remained untouched: the spirit was the same all the time, and we still do free software, and we still believe in people and keep the flat internal structure.

It is quite difficult for me to write this post. Many memories and feelings cross my head, many good moments and also some more complicated ones, mainly in the first period, when a huge percentage of companies disappear and we managed to resist, learn and grow. If I wanted to be fair I would need to thank here a lot of people, a very big list, all those who in one way or another were part of this project, for all the help and support along the years, but they already know who they are and how grateful I am, so I will keep it private, and just say that I am very proud of what we have achieved:  10 years participating in the free (software) world.

by jjsanchez at November 16, 2011 09:09 PM

November 15, 2011

Adrián Pérez

Recipe: Removing embedded album art from MP3s

Update: I made a Python script that will do the same as the command below, plus it will dump the embedded cover images in those directories which do not contain a cover image file already. It can process ~35GB of music in less than 15 seconds. Who said Python is slow? :-D

This is useful for those situations in which one does not care about embedded album art in MP3 files. For example, when copying them on portable audio players it may be good to avoid the extra payload of the picture so more files can be squeezed in the —probably limited— device memory. Also, each song from the same album has exactly the same picture attached, effectively replicating it and wasting disk space; therefore one may prefer to store cover.jpg file in the same folder instead. Last but not least, most Open Source media players will ignore embedded album art, so it is of little use for those of us using otherwise fine players like Rhythmbox.

Thankfully, it is possible to completely remove those embedded album art images from MP3s in a non-destructive way. To batch-process a music library one can use the mid3v2 tool included with the exhaustive and powerful Mutagen tag editing library:

find ~/Music -iname '*.mp3' -print0 | xargs -0 mid3v2 --delete-frames=PIC,APIC

By the way, change ~/Music to whatever the location of you music library is ;-)

Additional infos

  • Reference of ID3 tag frames.
  • ID3v1 tags are evil, mid3v2 --convert --delete-v1 is your friend and will turn then into nice ID3v2 tags.
  • List of Mutagen-supported frames can be obtained with mid3v2 --list-frames.

by aperez at November 15, 2011 12:01 AM

November 13, 2011

Alberto Garcia

Hello Planet Debian!

Hi all!

My name is Alberto Garcia and this is my first (well, second) post in Planet Debian. So I’ll introduce myself.

I’m a free software developer and enthusiast from Galicia, Spain. I studied computer science at the Corunha University, where I first heard about GNU/Linux and Debian. After leaving university I co-founded Igalia with a group of friends. We’ve been working on lots of different things during all these years, but some projects we’ve been particularly involved in include GNOME, Maemo/MeeGo and WebKit.

Although I’ve been using Debian for more than a decade now (my first -and still running!- installation was in 1997) and I’m quite familiar with the distribution, it wasn’t until a few years ago that I started maintaining packages officially.

Apart from software, my other main hobby is music. When I’m not using my computer you’ll find me at some concert (preferably small bands: I hate long queues, crowded places and being far from the stage). It’s no coincidence that my first Debian package was a Last.fm player ;)

I don’t have much more to add. I’d like to thank Ana for adding me to the planet, and I’m proud to be part of the Debian community!

by berto at November 13, 2011 08:34 PM

November 11, 2011

Mario Sánchez

Orca and WebKit2GTK+: initial results

Last May, I wrote about some initial tests I did back then with AtkSocket and AtkPlug, just to learn a bit about that API that allows connecting accessibility trees in different processes, thanks to the magic of the ATK bridge. I did that in order to prepare for the work that would probably be needed when adding accessibility support in WebKit2GTK+, so browsers using the new version of this web engine could be at least as much accessible as those using the single-process WebKitGTK+ library. Looking back, I think that the effort has definitely payed off…

However, because of one reason or another (and not necessarily work-related), I was not able to devote much time to keep working on this until some weeks ago, but fortunately I’m now again working on this as my primary task in Igalia, as part of our WebKit team, so I expect to have some nice results soon, hopefully also in the form of integrated patches upstream.

And talking about results, I can’t avoid sharing the following at this very same moment, which is actually the trigger that made me write this post: today I was able to make Orca read, for the very first time, web content rendered through WebKit2GTK’s MiniBrowser, which has been not an easy task since the multiprocess architecture of WebKit2 made it a little bit challenging, to say the least.

Of  course there’s still much to do in this regard, so do not think of the current status of the task as it was nearly finished or anything… but still I thought it was a nice milestone to share with the world, and what a better way to do it than using a video for that. After all, Orca’s main job is about speaking, right?. So here it is:

Orca and WebKit2GTK+: initial results
[video in Vimeo] [video in Ogv (Theora / Vorbis)]

By the way, I’d like to make the most of this post by saying I’m really proud and happy to have Joanmarie Diggs aboard in Igalia for a few weeks now, who contributed a lot to making possible that I was writing this post today. Thanks , Joanie!

by msanchez at November 11, 2011 09:38 PM

November 10, 2011

Guillaume Emont

Gstreamer and OpenCV for image stabilisation

I am now back from Prague where I gave a talk on image stabilisation (and my holiday pictures). Hopefully a video of the talk will soon be online. In the meantime, I would like to explain a bit my efforts in written form, with some details slightly updated from the talk (the code progressed a bit since then).

UPDATE: The talk is now online.

I got interested in the issues of image stabilisation through a helium balloon photography project in which I participated. I want to make a nice time lapse video from the pictures I have taken, but they were taken from a camera that was moving, which would make the result very shaky without some kind of postprocessing.

Thankfully, I work at Igalia, which means that on top of my personal time, I could spend on this project some company time (what we call internally our hackfest time, of up to 5 hours per week).

Original problem statement

I have around 4h30 of pictures taken from a balloon 100 metres high. The pictures were taken at a rate of one per minute, which makes around 270 pictures. I want to make a nice time lapse out of it. Simply using the frames as is to build a video does not work well. Partly because I would probably be legally required to include a warning to epileptic people at the beginning of the video, but mostly because people actually watching it would wish they were epileptic to have a good excuse not to watch it.

This is due to the huge differences occurring between two consecutive frames.

Here is an example of two consecutive frames in that series:

http://guij.emont.org/blog/wp-content/uploads/2011/11/IMG_7539-300x225.jpg
http://guij.emont.org/blog/wp-content/uploads/2011/11/IMG_7540-300x225.jpg

As you can see, from one frame to the next, a lot of pixels would change. And that does not look pretty. It is also pretty obvious that they are both pictures of the same thing, and could be made to be pretty similar, mainly by rotating one of them, and maybe reprojecting it a bit so that things align properly even though the point of view changed a bit from one frame to the next.

Standing on the shoulders of giants

There was no question in my mind that I wanted to use GStreamer for the task, by writing an element or set of elements to do the stabilisation. The two big advantages of this approach are:

  • I can benefit from all the other elements of GStreamer, and I can easily do things like decode my pictures, turn them in a video, stabilise it and encode it in a format of my choice, all in one command.
  • Others could easily reuse my work, potentially in ways I could not think of. One idea would be to integrate that in PiTiVi in the future.

Then, after some research, I realised that OpenCV provides a lot of the tools needed for the task as well.

Since I am still in a prototyping/research stage, and I hate to write loads of boilerplate, I am using python for that project, though a later rewrite in C or C++ is not impossible.

First things first

I will not present things exactly in the order I researched them, but rather in the order I should have researched them: starting with a simpler problem, then getting into the complications of my balloon problem.

The simpler problem at hand is presented to you by Joe the Hippo:






Joe the shaky hippo (video)

As you can see, Joe almost looks like he’s on a boat. He isn’t, but the cameraman is, and the video was taken with a lot of zoom. The movement in that video stream has a particularity that can make things simpler: the position of a feature on the screen does not change much from one frame to the next, because a very short amount of time happens between them. We will see that some potentially very useful algorithms take advantage of that particularity.

The steps of image stabilisation

As I see it for the moment, there are two basic steps in image stabilisation:

  1. Find the optical flow (i.e. the movement) between two frames
  2. Apply a transformation that reverts that movement, on a global (frame) scale

Step 2. is made rather easy by OpenCV with the findHomography() and warpPerspective() functions, so we won’t talk much about it here.

Optical flow

For all that matters in this study, we can say that for each frame the optical flow is represented by two lists of point coordinates origins and destinations, such that the feature at the coordinate origins[i] in the previous frame is at the coordinate destinations[i] in the current frame.

Optical flow algorithms can be separated in two classes, depending on whether they provide the flow for all pixels (Dense optical flow algorithms) or only for selected pixels (Sparse optical flow algorithms). Both classes can theoretically provide us with the right data (origins and destinations point lists) to successfully compute the opposite transformation we want to apply using findHomography().

I tried one algorithm of each class, choosing the ones that seemed popular to me after reading a bit of [Bradski2008]. Here is what I managed to do with them.

Dense optical flow

I tried to use OpenCV’s implementation of the Horn-Schunck algorithm [Horn81]. I don’t know if I used it incorrectly, or if the algorithm simply cannot be applied to that situation, but this is all I could do to Joe with that:





Now Joe is shaky and flickery

As you can see, this basically added flickering. Since that, I did not find time to improve this case before I realised that this algorithm is considered as obsolete in OpenCV, and the new python bindings do not include it.

Note that this does not mean that dense optical flow sucks: David Jordan, a Google Summer of Code student, does awesome things with a dense algorithm by Proesmans et al. [Proesmans94].

Sparse optical flow

I played with the Lucas-Kanade algorithm [Lucas81], with the implementation provided by OpenCV. Once I managed to find a good set of parameters (which are now the default in the opticalflowfinder element), I got pretty good results:





Joe enjoys the stability of the river bank, undisturbed by the movements of the water (video)

And it is quite fast too. On my laptop (with an i5 processor), I can stabilise Joe the hippo in real time [1] (it is only a 640×480 video, though).

[1] For those who attended my talk at the Gstreamer Conference 2011: yes, now it is proper real time, I optimised the code a bit.

The balloon problem

As we seen in the previous section, for a shaky hippo video, [Horn81] isn’t any help, but [Lucas81] is pretty efficient. But can they be of any use for my balloon problem?

Unsuccessful results

I won’t show any video here, because there is nothing much to see. Instead, an explanation in pictures that show how the algorithms rate for the balloon time lapse.

This is what Horn-Schunck can do:

http://guij.emont.org/blog/wp-content/uploads/2011/11/balloon-hs-300x112.png

The picture shows two consecutive frames in the time lapse (the older is on the left). Each of the coloured lines goes from a point on the first image to the corresponding point on the second one, according to the algorithm (click on the image to see a larger version where the lines are more visible). Since Horn-Schunck is a dense algorithm, the coloured lines are only displayed for a random subset of points to avoid clutter.

Obviously, these lines show that the algorithm is completely wrong, and could not follow the big rotation happening between the two frames.

Does Lucas-Kanade rate better? Let’s see:

http://guij.emont.org/blog/wp-content/uploads/2011/11/balloon-lk-300x112.png

This is the same kind of visualisation, except that there is no need to chose a subset, since the algorithm already does that.

As for the result, it might be slightly less wrong than Horn-Schunck, but Lucas-Kanade does not seem to be of any help to us either.

The issue here, as said earlier, is that these two algorithms, like most optical flow algorithms, are making the assumption that a given feature will not move more than a few pixels from one frame to the next (for some value of “a few pixels”). This assumption is very clever for typical video streams taken at 25 or 30 frames per second. Unfortunately, it is obviously wrong in the case of our stream, where the camera has the time to move a lot between two frames (which are captured one minute apart).

Is all hope lost? Of course not!

Feature recognition

I found salvation in feature recognition. OpenCV provides a lot of feature recognition algorithms. I have tried only one of them so far, but I hope to find the time to compare it with others in the future.

The one I tried is SURF (for “Speeded Up Robust Features”, [Bay06]). It finds “interesting” features in an image and descriptors associated with them. The descriptors it provides are invariant to rotation and scaling, which means that it is in theory possible to find the same descriptors from frame to frame.

To be able to efficiently compare the sets of frame descriptors I get for two consecutive frames, I use FLANN, which is well integrated in OpenCV.

Here is a visualisation of how this method performs:

http://guij.emont.org/blog/wp-content/uploads/2011/11/balloon-surf-300x112.png

As you can see, this is obviously much better! There might be a few outliers, but OpenCV’s findHomography() can handle them perfectly, and here’s a proof video (I am not including it in the article since it is quite high resolution).

Obviously, the result is not perfect yet (especially in the end), but it is quite promising, and I hope to be able to fix the remaining glitches sooner than later.

Show me the code!

The code as well as a quick introduction on how to use it is available on github. Bugs and patches should be posted here.


[Bradski2008] G. Bradski and A. Kaehler , “Learning OpenCV”, ISBN 978-0-596-51613-0, 2008.
[Horn81] B. K. P. Horn and B. G. Schunck, “Determining optical flow,” Artificial Intelligence 17 (1981): 185–203, 1981. PDF
[Proesmans94] M. Proesmans, L. Van Gool, E. Pauwels, A. Oosterlinck, “Determination of optical flow and its discontinuities using non-linear diffusion”, J.-O. Eklundh (Ed.), Computer vision — ECCV ’94, Lecture Notes in Comp. Science, Vol. 801, Springer, Berlin, 295–2304, 1994. PDF
[Lucas81] B. Lucas and T. Kanade, “An Iterative Image Registration Technique with an Application to Stereo Vision”, Proc. of 7th International Joint Conference on Artificial Intelligence (IJCAI), 674–279 PDF
[Bay06] H. Bay, T. Tuytelaars and L. Van Gool, “SURF: Speeded Up Robust Features”, 9th European Conference on Computer Vision, 2006. PDF

by guijemont at November 10, 2011 10:37 AM

Alberto Garcia

FileTea now available in Debian

In the past few weeks I’ve been preparing the Debian packages of FileTea and its companion EventDance. They’re finally available.

FileTea is a free, web-based file sharing system that just works. It only requires a browser, and no user registration is needed. If you want to know more about it, you can read my previous blog post. For a more detailed description, read Nathan Willis’s excellent article on LWN.net. There have been a few changes since that article (HTTPS support in particular) but it’s still the best one you can find on the net.

Igalia still provides a FileTea server at http://filetea.me/, that you can use to share your files and see how it works. We plan to keep offering this service, but you don’t need to trust it/depend on it anymore: now you can apt-get install filetea and have your own.

by berto at November 10, 2011 10:09 AM

November 09, 2011

Felipe Erias

Use your hands

I have just read Bret Victor’s excellent post on the future of interaction. He accurately describes the current mainstream interaction paradigms (and even many futuristic visions!) as pictures under glass and claims that they don’t really take advantage of most of our natural capabilities, chief among them the huge sensitivity and precision of human hands. He mentions some lines of research that might help pave the way for future interactive technologies that are more aligned with our natural capabilities. I am just going to add pointers to a few of them and a couple of comments.

Haptic technology focuses on providing tactile feedback. A trivial example is vibration in cell phones, but far cooler things are being researched, such as physical buttons that change dynamically, textile-based haptic displays that can be wrapped around surfaces, phones that move their centre of gravity and even touchable holograms.

bubblewrap

Touchable haptic display.

Another aspect is proprioception, the sense that informs us of the positions of our limbs and body; for instance, our use of a computer mouse depends on out ability to know the position of our hand and arm in space. Of great interest is the concept of extended physiological proprioception (original paper from the 70’s): the information obtained via a tool (e.g. the point of a pencil, prosthetic limbs in the original research, etc.) is actually perceived in a very similar way as if it were part of the body. The current thinking is that this capability might have evolved as our species began to use tools, many thousands of years ago.

For instance, this means that we can grab a pen, and use it to touch and successfully identify the characteristics of physical objects. You can even try it now. Haptic pens, such as those created by SensAble,  exploit this idea by providing a device that can be moved tridimensionally, with little engines that simulate the feedback one would get if he was using the pen to touch and interact with a physical object. They have been a very expensive technology for some time, reserved for fields such as advanced engineering and medicine; as the price of this technology goes down over time, we might begin to see more and more applications.

SensAble Haptic Device in use (source).

SensAble haptic device in use.

Tangible interfaces allow the user to interact with digital information by manipulating his physical environment. There are many different directions that are being explored at the moment; one of the favourites for the nerd in me is this implementation of a D&D role-playing game using Microsoft Surface.

Dungeons&Dragons on a Microsoft Surface.

Manipulative and haptic interfaces seem a good fit for dealing with computerised representations of physical objects. However, much of the work that we do on computers has to do with manipulating abstract information and there might not be an immediate way to translate and represent it in a physical interface. Different metaphors will need to be developed and evaluated.

This is linked to multimodal interaction, a branch of HCI research that tries to provide information to different human senses and gather inputs coming from varied sources. The expansion of mobile devices requires us to provide forms of interaction that are more flexible for when keyboard and screen are not readily available. Generally speaking, this is also a more human approach, in that it has the potential to make a better use of our innate abilities, and also more humane, as not all of us have the same senses available or with the same precision.

(Sources for the images: one, two, three)

http://www.sensable.com/products-haptic-devices.htm

by femorandeira at November 09, 2011 07:12 PM

November 04, 2011

Carlos García Campos

WebKit2 GTK+ MiniBrowser ported to GTK+ API!

MiniBrowser is a small web browser application for testing WebKit2. MiniBrowser for the GTK+ port has been working for some time now, but it was implemented using the C-based WebKit2 API. WebKitGTK+ 1.7.1 introduced an initial high level GTK+ API for WebKit2 more similar to the current WebKit1 GTK+ API. This week, Igalia’s WebKit team started to port the MiniBrowser code to use the new GTK+ API.

MiniBrowser running
MiniBrowser running

This new GTK+ API is far from complete compared to the WebKit1 API, but it’s already possible to implement a small application with basic features, and we have plans to create a webkit2 branch for epiphany soon. API is already documented in the code, but the html generation is not available yet. We are already working on it so that WebKitGTK+ 1.7.2 will generate the API documentation when compiled with –enable-gtk-doc and –enable-webkit2 and it will be available on the WebKitGTK+ website too.

Thanks to the multiprocess architecture, WebKit2GTK+ solves the problem of using flash (or any other plugin using GTK+2) with GTK+3. The UI process depends unconditonally on GTK+3 and the plugin process is always built with GTK+2. And of course, flash will never crash or block your web browser. Plugins are broken in WebKitGTK+ 1.7.1 due to a bug that has already been fixed, so in order to try it out you need to either wait until 1.7.2 is released or build WebKit from current git master.

MiniBrowser showing a youtube video
MiniBrowser showing a youtube video

by Carlos Garcia Campos at November 04, 2011 06:05 PM

Xavier Castaño

Igalia at Pecha Kucha Night Vol 5

Tonigh, I am going to talk about Igalia at Pecha Kucha Night as part of the fifht edition. Today, it is going to be held in Playa Club, A Coruña.

More info: http://oi41.tinypic.com/2h2kqjm.jpg

The event is free but capacity is limited, so if you want to be there, go there early to get tickets :) .

See you there!


© Xavier Castaño for My blog at Igalia, 2011. | Permalink | No comment

Add to del.icio.us

Search blogs linking this post with Technorati

Want more on these topics ? Browse the archive of posts filed under Igalia.

by Xavier Castaño at November 04, 2011 04:39 PM

November 01, 2011

Carlos López

Unlocking a LUKS encrypted root partition remotely via SSH

If you are thinking on sending a new server to a remote datacenter for colocation or you have rented one or more servers in the cloud, probably you have thought that you would like to encrypt your server’s hard disk.

The problem is that if you encrypt the whole hard disk (the root partition) you will need some kind of KVM to type the password remotely every time the server is restarted … sure??? No!

Thanks to this nifty trick, you can enter the password remotely during the boot process. The trick involves embedding a small ssh server (dropbear) in the initramfs that allows you to enter the password remotely for the root partition at boot time.

For those who are lucky enough to use Debian, the procedure is so simple and easy as ::

1) Install your server with the root partition encrypted.

2) Install the required packages:

apt-get install openssh-server dropbear busybox

3) Copy the SSH key that has been generated automatically

scp root@my.server.ip.addr:/etc/initramfs-tools/root/.ssh/id_rsa ~/id_rsa.initramfs

4) If your server gets the IP address automatically (DHCP) ignore this step, otherwise you have to specify the IP configuration at the Kernel boot line. To do this edit the file /etc/default/grub and define the line:

GRUB_CMDLINE_LINUX="ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>"

Using the format specified in the file Documentation/nfsroot.txt of the Linux kernel documentation. For example:

GRUB_CMDLINE_LINUX="ip=192.168.122.192::192.168.122.1:255.255.255.0::eth0:none"

Reload the grub configuration

update-grub

5) Reboot

reboot

6) And unlock remotely!

ssh -o "UserKnownHostsFile=~/.ssh/known_hosts.initramfs" \
	-i "~/id_rsa.initramfs" root@my.server.ip.addr \
	"echo -ne \"MyS3cr3tK3y\" >/lib/cryptsetup/passfifo"

And for those not lucky enough to use Debian, and also for those who have such luck, but want more details on this procedure, I am pasting here the archive cryptsetup/README.remote from Debian that I am sure that you will find very useful :)

$ zcat /usr/share/doc/cryptsetup/README.remote.gz

unlocking rootfs via ssh login in initramfs
-------------------------------------------

You can unlock your rootfs on bootup from remote, using ssh to log in to the
booting system while it's running with the initramfs mounted.

Setup
-----

For remote unlocking to work, the following packages have to be installed
before building the initramfs: dropbear busybox

The file /etc/initramfs-tools/initramfs.conf holds the configuration options
used when building the initramfs. It should contain BUSYBOX=y (this is set as
the default when the busybox package is installed) to have busybox installed
into the initramfs, and should not contain DROPBEAR=n, which would disable
installation of dropbear to initramfs. If set to DROPBEAR=y, dropbear will
be installed in any case; if DROPBEAR isn't set at all, then dropbear will only
be installed in case of an existing cryptroot setup.

The host keys used for the initramfs are dropbear_dss_host_key and
dropbear_rsa_host_key, both located in/etc/initramfs-tools/etc/dropbear/.
If they do not exist when the initramfs is compiled, they will be created
automatically. Following are the commands to create them manually:

# dropbearkey -t dss -f /etc/initramfs-tools/etc/dropbear/dropbear_dss_host_key
# dropbearkey -t rsa -f /etc/initramfs-tools/etc/dropbear/dropbear_rsa_host_key

As the initramfs will not be encrypted, publickey authentication is assumed.
The key(s) used for that will be taken from
/etc/initramfs-tools/root/.ssh/authorized_keys.
If this file doesn't exist when the initramfs is compiled, it will be created
and /etc/initramfs-tools/root/.ssh/id_rsa.pub will be added to it.
If the latter file doesn't exist either, it will be generated automatically -
you will find the matching private key which you will later need to log in to
the initramfs under /etc/initramfs-tools/root/.ssh/id_rsa (or id_rsa.dropbear
in case you need it in dropbear format). Following are the commands to do the
respective steps manually:

To create a key (in dropbear format):

# dropbearkey -t rsa -f /etc/initramfs-tools/root/.ssh/id_rsa.dropbear

To convert the key from dropbear format to openssh format:

# /usr/lib/dropbear/dropbearconvert dropbear openssh \
	/etc/initramfs-tools/root/.ssh/id_rsa.dropbear \
	/etc/initramfs-tools/root/.ssh/id_rsa

To extract the public key:

# dropbearkey -y -f /etc/initramfs-tools/root/.ssh/id_rsa.dropbear | \
	grep "^ssh-rsa " > /etc/initramfs-tools/root/.ssh/id_rsa.pub

To add the public key to the authorized_keys file:

# cat /etc/initramfs-tools/root/.ssh/id_rsa.pub >> /etc/initramfs-tools/root/.ssh/authorized_keys

In case you want some interface to get configured using dhcp, setting DEVICE= in
/etc/initramfs-tools/initramfs.conf should be sufficient.  The initramfs should
also honour the ip= kernel parameter.
In case you use grub, you probably might want to set it in /boot/grub/menu.lst,
either in the '# kopt=' line or appended to specific 'kernel' line(s).
The ip= kernel parameter is documented in Documentation/nfsroot.txt in the
kernel source tree.

Issues
------

Don't forget to run update-initramfs when you changed the config to make it
effective!

Collecting enough entropy for the ssh daemon sometimes seems to be an issue.
Startup of the ssh daemon might be delayed until enough entropy has been
retrieved. This is non-blocking for the startup process, so when you are at the
console you won't have to wait for the sshd to complete its startup.

Unlocking procedure
-------------------

To unlock from remote, you could do something like this:

# ssh -o "UserKnownHostsFile=~/.ssh/known_hosts.initramfs" \
	-i "~/id_rsa.initramfs" root@initramfshost.example.com \
	"echo -ne \"secret\" >/lib/cryptsetup/passfifo"

This example assumes that you have an extra known_hosts file
"~/.ssh/known_hosts.initramfs" which holds the cryptroot system's host-key,
that you have a file "~/id_rsa.initramfs" which holds the authorized-key for
the cryptroot system, that the cryptroot system's name is
"initramfshost.example.com", and that the cryptroot passphrase is "secret"

-- <debian@x.ray.net>, Wed, 30 Sep 2009

by clopez at November 01, 2011 02:51 AM

October 31, 2011

Felipe Erias

First ideas for a better GNOME browser

Following up on my last post, I want to share a few ideas that could improve the use of the Web from GNOME. Many of these come from other people and I am trying to combine them into one coherent package.

The first goal would be to offer better support for common Web browsing patterns, revisitation and exploration. Specifically, this means supporting web applications, a more convenient and agile presentation for favourites, better history and bookmarks management, better tab management within the browser window for pages that are related to the same tasks, and better tab management from the Shell to help the user align the different sets of tabs with his current activities and interests.

The second goal would be to do so in a way that is not cumbersome and complex, but light and consistent.

Web apps

Most of the next million apps written will be web applications. The browser should acknowledge this, allowing the user to turn a Web site into an application that can be accessed like any other.

Launcher for GMail app in Gnome Shell

Launcher for a GMail app.

Revisitation: Home and History

As noted in my previous post, there are different kinds of Web revisitation; one of them comprises sites that we visit often because they lead to new information, which is not exactly the same as storing a linking to a page because of the information that it contains at the moment of reading (e.g. an article). In a manner similar to what Firefox does, I propose to have a Home tab as the starting point for browsing. This tab could include a search field, links to recent pages and groups of pages, favourites and Reading List. Being able to define a page as “favourite” and “pin” it to the Home page would ease mid- and long-term revisitation, which makes up for a large percentage of our activity in the Web.

The Home tab would be a way to get to new content, but what about returning to sites that were visited some time ago? Next to the Home tab, we could place a History&Bookmarks tab that offered a rich search interface to retrieve pages that have already been seen.

Home and History tabs

Tabs on top, with Home and History on the top left.

Fine-grain tab management

Modern browsers are placing their tabs on top with good reason. The main advantage is that this helps establish a visual hierarchy inside the browser window that reinforces the proper mental model, so that controls that operate on the same scope are grouped together. To decide which controls should be given priority in the interface, we could use usage data from Firefox as a guide, always keeping in mind that we cannot assume that everybody will know how to use all the available shortcuts (e.g. a similar study found that over 80% of users never used Ctrl+F to search). Browser-level functionality (New Window, Preferences, Quit…) could be moved to the application menu.

Tabs provide a number of benefits that make them a convenient way to organise your Web browsing. However, one of their problems is that as their number grows, it can become difficult to go back to a certain tab; a way to improve this situation could be to show a thumbnail of the tab’s content on mouse-over, allowing for a quick scan of open tabs without having to open them one by one.

Tab thumbnail on mouse-over

Tab thumbnail on mouse-over.

There is a difference between following a link and opening it in a new tab. In the first case, the original page is still visible and readily accessible; in the second, it has disappeared from the UI and has to be kept in the user’s memory, to be accessed again via the Back button. These two different actions can allow the user to create a curated version of their trail through the Web, one that does not contain all the pages that they have visited but just those that have been deemed important. These tab trees are an important feature but tab-focused interfaces (e.g. tree-style tabs, other ideas) might be far too complex. A compromise could be to include a visual hint at the existence of different tab groups, but without making it the main point of the interface.

Tab groups

Without text, can you tell which of these tabs are related?

Coarse-grain tab management

Tabs are a good way of structuring your browsing when their number is low enough (research shows that an usual number of open tabs is around 6). When their number grows, you can have trouble because there are simply too many unrelated tabs in one window. So we have a problem with the organisation of a lot of content that is related to different activities: well, the GNOME Shell is a solution for that. I propose to allow high-level management of Web tabs directly from the Shell Overview (not too different from Panorama with a bit of this), providing an overview of the open tabs and supporting their movement between different browser windows and workspaces.

Epiphany in Shell overview

Epiphany window in the Shell overview, displaying the open tabs.

Wrap-up

I have tried to describe a situation where Web browsing is more tightly integrated with the desktop. There is still a lot of work to do: detailed functionality needs to be refined, assumptions need to be verified, mockups and prototypes need to be created and evaluated…

A browser is a very complex application to design, but luckily there is a lot of knowledge already available that should help us generate ideas and make informed decisions.

by femorandeira at October 31, 2011 02:30 PM

October 29, 2011

Andrés Gómez

Taking back the old scrollbars in Ubuntu

Today I couldn’t take it any more and I had to do it …

I’m a Thinkpad Lenovo X61s owner with which I don’t use nor miss a mouse thanks to the awesome TrackPoint included. Because of that, the new Ubuntu’s scrollbars are, from the user interactivity point of view, just not usable.

Leading quickly to the “ham:) , disabling them is just a matter of writing in a console:

$ sudo echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars

and reboot.

I’m not saying that the new scrollbars aren’t an enhancement. They allow a better usage of the display but, from the functional point of view, they only work as positioning indicator. They will tell you the progress in the scrollable window but, necessarily, you will need a wheel in your mouse or a way to emulate it. If you often have to grab the scrollbar, from a functional point of view, they are just a failure.

Hence, you will miss in Ubuntu a way to tune on or off its usage without having to use these kind of “hacks“.

Of course, another alternative would have been “to emulate” the mouse wheel through the middle button. I my case, this is not an option since last time I walked this path I decided to have a better “select and paste” experience with this button rather than use it as modifier for the vertical/horizontal scrolling.

Anyway, if you want to use the middle button this way, you had to do some changes to the “XOrg” config file before. Now, you just have to install the “gpointing-device-settings” package:

$ sudo aptitude install gpointing-device-settings

and select the proper options after launching its UI from “System -> Preferences -> Pointing devices“.

This and many other tricks can be found at ThinkWiki.

Who knows, maybe, in some time, I will change my mind and retake this functionality (and the new Ubuntu scrollbars) …

by tanty at October 29, 2011 04:28 PM

October 28, 2011

Andy Wingo

JavaScriptCore, the WebKit JS implementation

My readers will know that I have recently had the pleasure of looking into the V8 JavaScript implementation, from Google. I'm part of a small group in Igalia doing compiler work, and it's clear that in addition to being lots of fun, JavaScript implementations are an important part of the compiler market today.

But V8 is not the only JS implementation in town. Besides Mozilla's SpiderMonkey, which you probably know, there is another major Free Software JS implementation that you might not have even heard of, at least not by its proper name: JavaScriptCore.

jsc: js for webkit

JavaScriptCore (JSC) is the JavaScript implementation of the WebKit project.

In the beginning, JavaScriptCore was a simple tree-based interpreter, as Mozilla's SpiderMonkey was. But then in June of 2008, a few intrepid hackers at Apple wrote a compiler and bytecode interpreter for JSC, threw away the tree-based interpreter, and called the thing SquirrelFish. This was eventually marketed as "Nitro" inside Apple's products[0].

JSC's bytecode interpreter was great, and is still pretty interesting. I'll go into some more details later in this article, because its structure conditions the rest of the implementation.

But let me continue here with this historical sketch by noting that later in 2008, the WebKit folks added inline caches, a regular expression JIT, and a simple method JIT, and then called the thing SquirrelFish Extreme. Marketers called this Nitro Extreme. (Still, the proper name of the engine is JavaScriptCore; Wikipedia currently gets this one wrong.)

One thing to note here is that the JSC folks were doing great, well-factored work. It was so good that SpiderMonkey hackers at Mozilla adopted JSC's regexp JIT compiler and their native-code assembler directly.

As far as I can tell, for JSC, 2009 and 2010 were spent in "consolidation". By that I mean that JSC had a JIT and a bytecode interpreter, and they wanted to maintain them both, and so there was a lot of refactoring and tweaking to make them interoperate. This phase consolidated the SFX gains on x86 architectures, while also adding implementations for ARM and other architectures.

But with the release of V8's Crankshaft in late 2010, the JS performance bar had been lowered again (assuming it is a limbo), and so JSC folks started working on what they call their "DFG JIT" (DFG for "data-flow graph"), which aims be more like Crankshaft, basically.

It's possible to configure a JSC with all three engines: the interpreter, the simple method JIT, and the DFG JIT. In that case there is tiered compilation between the three forms: initial parsing and compilation produces bytecode, that can be optimized with the method JIT, that can be optimized by the DFG JIT. In practice, though, on most platforms the interpreter is not included, so that all code runs through the method JIT. As far as I can tell, the DFG JIT is shipping in Mac OS X Lion's Safari browser, but it is not currently enabled on any platform other than 64-bit Mac. (I am working on getting that fixed.)

a register vm

The interpreter has a number of interesting pieces, but it is important mostly for defining the format of bytecode. Bytecode is effectively the high-level intermediate representation (IR) of JSC.

To put that into perspective, in V8, the high-level intermediate representation is the JS source code itself. When V8 first sees a piece of code, it pre-parses it to raise early syntax errors. Later when it needs to analyze the source code, either for the full-codegen compiler or for Hydrogen, it re-parses it to an AST, and then works on the AST.

In contrast, in JSC, when code is first seen, it is fully parsed to an AST and then that AST is compiled to bytecode. After producing the bytecode, the source text isn't needed any more, and so it is forgotten. The interpreter interprets the bytecode directly. The simple method JIT compiles the bytecode directly. The DFG JIT has to re-parse the bytecode into an SSA-style IR before optimizing and producing native code, which is a bit more expensive but worth it for hot code.

As you can see, bytecode is the common language spoken by all of JSC's engines, so it's important to understand it.

Before really getting into things, I should make an aside about terminology here. Traditionally, at least in my limited experience, a virtual machine was considered to be a piece of software that interprets sequences of virtual instructions. This would be in contrast to a "real" machine, that interprets sequences of "machine" or "native" instructions in hardware.

But these days things are more complicated. A common statement a few years ago would be, "is JavaScript interpreted or compiled?" This question is nonsensical, because "interpreted" or "compiled" are properties of implementations, not languages. Furthermore the implementation can compile to bytecode, but then interpret that bytecode, as JSC used to do.

And in the end, if you compile all the bytecode that you see, where is the "virtual machine"? V8 hackers still call themselves "virtual machine engineers", even as there is no interpreter in the V8 sources (not counting the ARM simulator; and what of a program run under qemu?).

All in all though, it is still fair to say that JavaScriptCore's high-level intermediate language is a sequence of virtual instructions for an abstract register machine, of which the interpreter and the simple method JIT are implementations.

When I say "register machine", I mean that in contrast to a "stack machine". The difference is that in a register machine, all temporary values have names, and are stored in slots in the stack frame, whereas in a stack machine, temporary results are typically pushed on the stack, and most instructions take their operands by popping values off the stack.

(Incidentally, V8's full-codegen compiler operates on the AST in a stack-machine-like way. Accurately modelling the state of the stack when switching from full-codegen to Crankshaft has been a source of many bugs in V8.)

Let me say that for an interpreter, I am totally convinced that register machines are the way to go. I say this as a Guile co-maintainer, which has a stack VM. Here are some reasons.

First, stack machines penalize named temporaries. For example, consider the following code:

(lambda (x)
  (* (+ x 2)
     (+ x 2)))

We could do common-subexpression elimination to optimize this:

(lambda (x)
  (let ((y (+ x 2)))
    (* y y)))

But in a stack machine is this really a win? Consider the sequence of instructions in the first case:

; stack machine, unoptimized
0: local-ref 0      ; x
1: make-int8 2
2: add
3: local-ref 0      ; x
4: make-int8 2
5: add
6: mul
7: return

Contrast this to the instructions for the second case:

; stack machine, optimized
0: local-ref 0      ; push x
1: make-int8 2      ; push 2
2: add              ; pop x and 2, add, and push sum
3: local-set 1      ; pop and set y
4: local-ref 1      ; push y
5: local-ref 1      ; push y
6: mul              ; pop y and y, multiply, and push product
7: return           ; pop and return

In this case we really didn't gain anything, because the storing values to locals and loading them back to the stack take up separate instructions, and in general the time spent in a procedure is linear in the number of instructions executed in the procedure.

In a register machine, on the other hand, things are easier, and CSE is definitely a win:

0: add 1 0 0           ; add x to x and store in y
1: mul 2 1 1           ; multiply y and y and store in z
2: return 2            ; return z

In a register machine, there is no penalty to naming a value. Using a register machine reduces the push/pop noise around the instructions that do the real work.

Also, because they include the names (or rather, locations) of their operands within the instruction, register machines also take fewer instructions to do the job. This reduces dispatch cost.

In addition, with a register VM, you know the size of a call frame before going into it, so you can avoid overflow checks when pushing values in the function. (Some stack machines also have this property, like the JVM.)

But the big advantage of targeting a register machine is that you can take advantage of traditional compiler optimizations like CSE and register allocation. In this particular example, we have used three virtual registers, but in reality we only need one. The resulting code is also closer to what real machines expect, and so is easier to JIT.

On the down side, instructions for a register machine typically occupy more memory than instructions for a stack machine. This is particularly the case for JSC, in which the opcode and each of the operands takes up an entire machine word. This was done to implement "direct threading", in which the opcodes are not indexes into jump tables, but actually are the addresses of the corresponding labels. This might be an acceptable strategy for an implementation of JS that doesn't serialize bytecode out to disk, but for anything else the relocations are likely to make it a lose. In fact I'm not sure that it's a win for JSC even, and perhaps the bloat was enough of a lose that the interpreter was turned off by default.

Stack frames for the interpreter consist of a six-word frame, the arguments to the procedure, and then the locals. Calling a procedure reserves space for a stack frame and then pushes the arguments on the stack -- or rather, sets them to the last n + 6 registers in the stack frame -- then slides up the frame pointer. For some reason in JSC the stack is called the "register file", and the frame pointer is the "register window". Go figure; I suppose the names are as inscrutable as the "activation records" of the stack world.

jit: a jit, a method jit

I mention all these details about the interpreter and the stack (I mean, the register file), because they apply directly to the method JIT. The simple method JIT (which has no name) does the exact same things that the bytecode interpreter does, but it does them via emitted machine instructions instead of interpreting virtual instructions.

There's not much to say here; jitting the code has the result you would expect, reducing dispatching overhead, while at the same time allowing some context-specific compilation, like when you add a constant integer to a variable. This JIT is really quick-and-dirty though, so you don't get a lot of the visibility benefits traditionally associated with method JITs like what HotSpot's C1 or C2 currently have. Granted, the register VM bytecode does allow for some important optimizations to happen, but JSC currently doesn't do very much in the way of optimizing bytecode, as far as I can tell.

Thinking more on the subject, I suspect that for Javascript, CSE isn't even possible unless you know the types, as a valueOf() callback could have side effects.

an interlude of snarky footnotes

Hello, reader! This is a long article, and it's a bit dense. I had some snarky footnotes that I enjoyed writing, but it felt wrong to put them at the end, so I thought it better to liven things up in the middle here. The article continues in the next section.

0. In case you didn't know, compilers are approximately 37% composed of marketing, and rebranding is one of the few things you can do to a compiler, marketing-wise, hence the name train: SquirrelFish, Nitro, SFX, Nitro Extreme...[1] As in, in response to "I heard that Nitro is slow.", one hears, "Oh, man they totally fixed that in SquirrelFish Extreme. It's blazingly fast![2]"

1. I don't mean to pick on JSC folks here. V8 definitely has this too, with their "big reveals". Firefox people continue to do this for some reason (SpiderMonkey, TraceMonkey, JaegerMonkey, IonMonkey). I expect that even they have forgotten the reason at this point. In fact the JSC marketing has lately been more notable in its absence, resulting in a dearth of useful communication. At this point, in response to "Oh, man they totally are doing a great job in JavaScriptCore", you're most likely to hear, "JavaScriptCore? Never heard of it. Kids these days hack the darndest things."

2. This is the other implement in the marketer's toolbox: "blazingly fast". It means, "I know that you don't understand anything I'm saying, but I would like for you to repeat this phrase to your colleagues please." As in, "LLVM does advanced TBAA on the SSA IR, allowing CSE and LICM while propagating copies to enable SIMD loop vectorization. It is blazingly fast."

dfg: a new crankshaft for jsc?

JavaScriptCore's data flow graph (DFG) JIT is work by Gavin Barraclough and Filip Pizlo to enable speculative optimizations for JSC. For example, if you see the following code in JS:

a[i++] = 0.7*x;

then a is probably an array of floating-point numbers, and i is probably an integer. To get great performance, you want to use native array and integer operations, so you speculatively compile a version of your code that makes these assumptions. If the assumptions don't work out, then you bail out and try again with the normal method JIT.

The fact that the interpreter and simple method JIT have a clear semantic model in the form of bytecode execution makes it easy to bail out: you just reconstruct the state of the virtual registers and register window, then jump back into the code. (V8 calls this process "deoptimization"; the DFG calls it "speculation failure".)

You can go the other way as well, switching from the simple JIT to the optimized DFG JIT, using on-stack replacement. The DFG JIT does do OSR. I hear that it's needed if you want to win Kraken, which puts you in lots of tight loops that you need to be able to optimize without relying on being able to switch to optimized code only on function re-entry.

When the DFG JIT is enabled, the interpreter (if present) and the simple method JIT are augmented with profiling information, to record what types flow through the various parts of the code. If a loop is executed a lot (currently more than 1000 times), or a function is called a lot (currently about 70 times), the DFG JIT kicks in. It parses the bytecode of a function into an SSA-like representation, doing inlining and collecting type feedback along the way. This probably sounds very familiar to my readers.

The difference between JSC and Crankshaft here is that Crankshaft parses out type feedback from the inline caches directly, instead of relying on in-code instrumentation. I think Crankshaft's approach is a bit more elegant, but it is prone to lossage when GC blows the caches away, and in any case either way gets the job done.

I mentioned inlining before, but I want to make sure that you noticed it: the DFG JIT does do inlining, and does so at parse-time, like HotSpot does. The type profiling (they call it "value profiling") combined with some cheap static analysis also allows the DFG to unbox int32 and double-precision values.

One thing that the DFG JIT doesn't do, currently, is much in the way of code motion. It does do some dead-code elimination and common-subexpression elimination, and as I mentioned before, you need the DFG's value profiles in order to be able to do this correctly. But it does not do loop-invariant code motion.

Also, the DFG's register allocator is not as good as Crankshaft's, yet. It is hampered in this regard by the JSC assembler that I praised earlier; while indeed a well-factored, robust piece of code, JSC's assembler has a two-address interface instead of a three-address interface. This means that instead of having methods like add(dest, op1, op2), it has methods like add(op1, op2), where the operation implicitly stores its result in its first operand. Though it does correspond to the x86 instruction set, this sort of interface is not great for systems where you have more registers (like on x86-64), and forces the compiler to shuffle registers around a lot.

The counter-based optimization triggers do require some code to run that isn't strictly necessary for the computation of the results, but this strategy does have the nice property that the DFG performance is fairly predictable, and measurable. Crankshaft, on the other hand, being triggered by a statistical profiler, has statistically variable performance.

And speaking of performance, AWFY on the mac is really where it's at for JSC right now. Since the DFG is only enabled by default on recent Mac OS 64-bit builds, you need to be sure you're benchmarking the right thing.

Looking at the results, I think we can say that JSC's performance on the V8 benchmark is really good. Also it's interesting to see JSC beat V8 on SunSpider. Of course, there are lots of quibbles to be had as to the validity of the various benchmarks, and it's also clear that V8 is the fastest right now once it has time to warm up. But I think we can say that JSC is doing good work right now, and getting better over time.

future

So that's JavaScriptCore. The team -- three people, really -- is mostly focusing on getting the DFG JIT working well right now, and I suspect they'll be on that for a few months. But we should at least get to the point where the DFG JIT is working and enabled by default on free systems within a week or two.

The one other thing that's in the works for JSC is a new generational garbage collector. This is progressing, but slowly. There are stubs in the code for card-marking write barriers, but currently there is no such GC implementation, as far as I can tell. I suspect that someone has a patch they're cooking in private; we'll see. At least JSC does have a Handle API, unlike SpiderMonkey.

conclusion

So, yes, in summary, JavaScriptCore is a fine JS implementation. Besides being a correct implementation for real-world JS -- something that is already saying quite a lot -- it also has good startup speed, is fairly robust, and is working on getting an optimizing compiler. There's work to do on it, as with all JS implementations, but it's doing fine.

Thanks for reading, if you got this far, though I understand if you skipped some parts in the middle. Comments and corrections are most welcome, from those of you that actually read all the way through, of course :). Happy hacking!

by Andy Wingo at October 28, 2011 03:51 PM

October 24, 2011

Alejandro Piñeiro

Summer is over

The other day I realized that the summer is over. And I realized that only one month late.

This was a really busy summer, so I will try to summarize it as it was busy but without too many posts.

Joanmarie is coming!

This was one of the last news of the summer, but it was the most important one. Although I announced the hiring some time ago, this week became effective. Last week (week 42) was the first week of Joanmarie as a igalian. Welcome to the Jungle!

Desktop summit

Again a Desktop Summit, not “just” a GUADEC. And as usual some people expressed their concerns about how effective is having two communities organizing this kind of events (example here).

In my personal case it was useful. In theory, one of the advantages to port at-spi from CORBA to DBUS (at-spi2) was that in that way at-spi could became a freedesktop technology. And finally this is starting to be true. Qt at-spi2 bridge has improved a lot during the last year. This means that more people will be looking and testing at-spi2. I was able to talk again with Frederik Gladhorn, and also met Simon developer.

GNOME 3.2 is here

Well, nothing new to add to what we all already know. Just saying that this my first GNOME release as ATK maintainer (again, thanks Li Yuan).

Unity accessibiltiy

During this summer I was also working on improving the accessibility support for Unity3D. Unfortunately all the branches with the last additions on the ATK support were not ready before the feature freeze, so Ubuntu Oneiric was released without them. For anyone interested, I created a extra-a11y ppa with a modified version of Unity with those branches integrated.

F123 & Mais Diferenças

During this summer Igalia was contacted by F123. F123 is a Brazilian project which purpose is allow the access to the education and employment opportunities using free software accessibility technologies. They are willing to help on improving the GNOME accessibility stack, and we started to define some first projects in collaboration with them during the summer (as the code already shows). I will like to thanks F123 for this effort, and I hope that this could be the starting point of several accessibility collaborations.

Joining a new band

In addition to my rock band SiVE and my participation as a student on the Jazz Ensemble from Coruña Municipal School (and playing with a GNOME T-Shirt ;) ), this summer I joined a new band, “Los Wattsons”. In this case pop/rock band. Not really complex but really funny. More that 6 concerts now, and a little EP, that you can listen on Jamendo.

by API at October 24, 2011 12:20 AM

October 22, 2011

Guillaume Emont

Prague, we meet again!

The bridge, seen from the Petřín lookout tower

Karlův most (Charles bridge)

 

Tomorrow I will fly to Prague, going to the GStreamer Conference, then to LinuxCon Europe and ELCE.
I’m excited to go back there, after having first visited this beautiful city in my last Eurotrip.
I will give a talk at the GStreamer Conference about my work on image stabilisation, related to that balloon project we did with Ugo.
I will go there sponsored by Igalia, with my friends and colleagues Víctor, Philippe and Javi. Víctor will give a talk as well, about the integration of syslink and GStreamer.

by guijemont at October 22, 2011 10:45 PM

October 19, 2011

Xan López

The next million apps

A few months ago the Apple Store accumulated more than 500,000
approved applications available for download. This is a very
remarkable fact for a relatively new platform using somewhat obscure
technologies
. It is, also, a very profitable situation for Apple.

It is a bit besides the point of this post whether a platform is
popular because it has half a million applications or whether it has
half a million applications because it’s popular; the truth is likely
that popularity and a lot of applications go hand in hand in a
self-reinforcing loop. That being said, the fact remains that any
platform that aims to be relevant needs to both convince developers to
create applications for it and to provide them with the means to do
so. If you start with an eye-popping, years ahead of its competition,
money-making miracle thing like the iPhone you might end up convincing
large amounts of people to target your platform specifically, but
usually having a great platform won’t be enough to do so. Think of
WebOS.

The question for us is, then: how are we going to get from where we
stand today to a vibrant constellation of applications centered around
the GNOME platform? Is there a path from today to 500,000 GNOME
applications in the future?

Developing GNOME and for GNOME.

The way things have worked so far is that we expect people to develop
for GNOME in a similar way to what in which we develop its core
applications. This is not only natural, but also has some great
qualities like making us dogfood our own development processes. It has
also some disadvantages, like expecting (perhaps unreasonably) all
developers to appreciate the perhaps too hacker-like tools we use and
routines we follow. Maybe not everyone wants to use the shell, emacs
and git from the command line? Perhaps we can jump without problems
from C or JavaScript to Vala (the 3 languages currently used in the
core module set), although I have my doubts, but surely offering 5
different language alternatives in developer.gnome.org, with tutorials and API documentation, without really telling newcomers which one is recommended, encouraged or best supported might be too much for most people?

To the extent that our core development practices are reflected in our
third party developer story we need to keep our house in order. Being
able to use any language to target GNOME might be a strength, but the
fact that we cannot decide which language we want users to learn first
might perhaps just be the result of our internal confusion. The core
libraries are still overwhelmingly written in C, but all the new
generation applications and UI modules are being written in higher
level languages (finally?!). Which ones? Well, guess it
depends. Some use JavaScript, some use Vala, others might come in the
future, and it seems that the winner mostly depends on the tastes of
the module owners. Surely not all languages would be tacitly accepted
(sawfish was dropped, among other reasons, because it was written in a
dialect of Lisp), but I can see the situation getting worse before it
gets better.

Even if we sort out the language issue there would be further barriers
for new developers. Our platform has been massively cleaned up in
recent times, but the road to GNOME 3 has created new ambiguities: a
parallel, mostly internal, toolkit built on top of Clutter is used by
the Shell or Sushi, and if certain animations or effects are desired
in GTK+ projects the only choice seems to mix and match a bit of the
old and the new in the same application. Efforts are underway to unify
things
, but again it’s not complicated to see how someone new to
the whole thing might be confused.

I could go on mentioning communication channels, tools, etc, but I
think the point has been made: as far as we expect people to develop
native GNOME applications in a way similar to how we work we need to
spend energy in clarifying our internal procedures, documenting them
and publishing easy to follow and simplified instructions for third
party developers. Otherwise GNOME will likely be perceived as a
platform that is difficult to develop for, best suited for expert
hackers, with few quality applications and not much appeal for the
mainstream. This would have been a reasonable conclusion some years
ago, and has been a repeated call to arms in the past. While I think
it still makes sense to do this, I believe we live in a time that
offers us new strategies that we can combine with this one, perhaps
better suited to our current capabilities and resources.

The Web.

The Web is winning. This horse has been beaten to death, so I won’t
dwell on the details at this point, but web technologies are here to
stay and are only becoming more and more important each day. Those who
repeatedly announce the imminent failure of the web as an application
development platform on the basis that it, well, sucks (and it kinda
does) miss two important points: first, the web is winning not because
it’s a beautiful platform, but because of its reach. Second,
whatever its flaws, the web platform has so much momentum and energy
put into it that it’s quickly overcoming most of the defects that it
had at some point, and things will only improve. Do you want an idea
of how big this is getting? Windows 8 applications will be built
using HTML and JavaScript. You don’t get more mainstream than that.

A new array of solutions designed to build web applications (packaged,
delivered to the user, run locally) is being created as we speak. From
Tizen’s endorsed WAC, to Mozilla’s OpenWebApps, to Chrome’s
Applications
the list keeps growing in expansionary fashion, but
all the specs share the same father: a thin layer on top of HTML5, CSS
and JavaScript, bridging the gap between the W3C standard’s and the
needs of the apps. As the standards grow, those platforms will shrink,
and it is likely that in good time a reasonably standardized solution
will emerge.

Why is this relevant for GNOME? Never mind iOS, never mind Android,
one thing is clear: most of the next million apps written will be web
applications. Some huge players like Microsoft are already moving
there as fast as they can, and the rest will follow sooner or
later. Native apps won’t go anywhere for a long time, but developers
willing to maximize their reach will, increasingly, prefer web
applications over anything else. At least as their first choice. This
brings us a great opportunity. If we jump on this bandwagon, support
web applications as first class citizens on top of world-class
runtimes
, and accept and even encourage people to run their web
apps on our operating system we can maximize our reach with a
fraction of the effort of fighting in the native SDK war against Apple
and Google. I think being smart in how we spend our scarce resources
is important, and I believe this is a fight that we can win if we put
our minds to it: let’s not forget our own platform, but let’s embrace
the web as it is emerging.

Most of this was shared with those present at this year’s GNOME Boston
Summit (in Montreal), and although there was a lively debate my
impression is that most of it was well received by the core hackers
present. We at Igalia believe that this is a promising way forward for
GNOME and we happen to have the skills necessary to make it happen, so
we are committed to keep investing in the foundational platform bits
like WebKit and to bring Web Application support to our OS: our plan
for the next months is to explore all the new technologies I have
mentioned, and start to implement a well integrated runtime to run the
next generation of web goodness at home.

by xan at October 19, 2011 03:18 PM

Andy Wingo

the user in the loop

The videos from this year's GNU Hackers Meeting in Paris are up. All the videos are linked from that page. There were technical problems with a couple of them, and we didn't get BT Templeton's presentation on Emacs Lisp in Guile (using delimited dynamic bindings to implement buffer-local variables!), but all in all it's a good crop.

I gave a talk entitled "The User in the Loop" that argued for the place of extensibility in the GNU project. I also pointed out some ways in which Guile fulfills those needs, but that was not the central point to the talk. I argued that point at more length in a previous article.

Anyway, let's give that newfangled HTML5 video tag a go here. It starts with the cut-off statement, "We all know that code motion is very important to efficiency, so..."

Click to watch

Alternately you can download the video directly (~350MB, 52 minutes). There are notes too, a superset of the slides from the talk.

by Andy Wingo at October 19, 2011 02:32 PM

October 14, 2011

Felipe Erias

First readings on web browsing

Earlier this week I began to look at some of the many available works on the field of Web browsers for the desktop, with the goal of improving the design of the Epiphany browser and taking advantage of the fact that Igalia is one of the main maintainers of WebKitGTK+. The first task, of course, is to correctly understand the problem: in a field as big and complex as this, this means a lot of reading and synthesising. Today I will explore two particular aspects: revisitation and tabbed browsing. In the future I will expand on this and begin to share some design ideas.

Revisitation

Revisitation means to access web sites that have been already seen previously. Although there are discrepancies on how to measure it, for the sake of design we can say that we have already seen roughly half of the pages that we visit. The article by Obendorf et al. mentions three kinds of revisitation:

  • short-term revisits (within the hour): these are the most common, often performed by following links, or using the Back button;
  • mid-term revisits (within the day): the most usual way is to use bookmarks or write the URL (often helped by autocomplete);
  • long-term revisits: this is related to the rediscovery of information that has already been seen; people re-access these pages mainly through links because they need to re-search (enter the same search terms) and/or re-trace (follow the same steps); history and bookmarks are also employed to some extent, but the current interfaces might not be easy or convenient to use.

Previously-unseen pages are usually visited by directly entering a URL or by following links from search pages (e.g. Google) or other information hubs (e.g. reddit, news sites).

A wider research was carried out by Adar, Teevan and Dumais. Their findings are consistent to those above, as they found that Web page revisitations could be clustered in the same three groups plus another one, which they called hybrid and which contained sites that were popular but infrequently used. They went further in trying to analyse the kind of web sites that typically fell on each group. The fast revisitation pattern often corresponded to “hub&spoke” behaviour, where users move back and forth between a set of promising results and each individual item. The mid-term one tended to refer to pages that act as starting points where the user can carry out a task (e.g. communication, banking) or access new information (e.g. news, forums). The infrequently-accessed group comprised pages that provide specialised search (e.g. travel) or related to weekend activities; as in the previous paper, the researchers also note that external search engines are often used for revisitation. There was a fourth, hybrid group of pages that caused “hub&spoke” movement but that were infrequently accessed, such as craigslist, eBay, shopping, games, etc.

With these results, the researches mention a number of implications for design. The most interesting for me is that “there may be value in providing awareness of, and grouping by, a broader range of revisitation patterns. For example, users may want to quickly sort previously visited pages into groups corresponding to a working stack (recently accessed fast pages), a frequent stack (medium and hybrid pages), and a searchable stack (slow pages).”

Research on tabs

During the last years the usage of tabs has made the Back button less prevalent. For instance, a common behaviour is to perform a search and then open different results in their own tabs, attempting to find the desired information through exploration of the candidates without losing track of the result set for further refinement. This often causes problems because the Back button does not work as expected (local history only applies to the current tab) and it might be complicated to find the originating document in the case of large tab trees. Problems with the Back button also arise when entering information through web forms and when using web applications.

A study of tab usage on Firefox showed that tabs are mostly used for immediate revisitation and task-switching. They serve as reminders or short-term bookmarks, they allow users to open links in the background and are a convenient way to keep frequently-accessed pages open. Visually, they are cleaner, less cluttered and easier to access that separate browser windows.

Many participants used tabs for revisitation more often than the back button, up to the point where, for frequent tabs users, tab switching was the second most frequent thing they did in the browser (after following links). The reasons reported were that tabs were more efficient, more convenient and more predictable (you can see the target right away). Another factor that helps to ease multitasking is that tabs leave the page in the same state, which is not always true with the back button.

The study found marked differences between regular and power tab users. The median number of open tabs was reported at around 6, but the maximum number of open tabs at one point in time could get much higher than that, past 20 and beyond for some users. As the participants were using regular Firefox, it could be that for some a limiting factor to the number of open tabs might simply be lack of space.

A bit of personal experience

As a user of the Tree-style Tabs extension for Firefox, I often find myself creating long trees of tabs where the tree itself marks a trail that is coherent and useful. I do not use the Back button often, and I think that the reason might be that opening a new branch in the tree somehow makes that part of the trail useful, clear and important, whereas pages that can only be accessed by going back soon fade out of memory. For a given task, it might well be that there is value in having a clear structure of related sites: the combination of tree-style tabs and the Back button helps create and navigate this structure.

Opening a link in a new tab actually marks the previous one as interesting and worth keeping around for a while, whereas closing a tab or following a link signals that the previous page was not that interesting after all (and it will fade from memory soon). This way of looking for information is probably related to orienteering, an information seeking strategy in which users take small steps towards their target using partial information and contextual knowledge as a guide. Making said set of steps visible and semi-permanent also acts as a very convenient reminder: my tab structure is kept between sessions, which makes it very easy to resume work or reading (for instance, there is a small subtree hanging from my RSS reader tab with articles that I will read later, and another one hanging from Bugzilla with bugs that I am working on).

Longer-term revisits

Regarding mid- and long-term revisits, I propose to contemplate three kinds of sites: web applications, information hubs and the personal archive. Web applications are self-contained and focused mainly on one task; their goal is in most cases to replace local applications for e.g. email, calendar, project planning, music, etc.

It might make sense to separate frequently visited websites that periodically provide new content from concrete and interesting information items; you can think about as the difference between reading the newspaper everyday and cutting out a news item that mentions your amateur football team. Information hubs are pages that are visited often because they lead to the discovery of new information, either on the same site (e.g. guardian.co.uk) or on others (e.g. reddit.com). On the other hand, the personal archive is a collection of information items that are relevant for the user because of the information that they already contain. There are many motivations behind the construction of personal archives: not just simply storing things for later retrieval, but also creating a legacy, making it easier to share resources, reducing fear of loss, self-expression and self-identity.

References

“Web Page Revisitation Revisited: Implications of a Long-term Click-stream Study of Browser Usage”, Obendorf et al., CHI 2007 Proceedings [PDF]

“A Study of Tabbed Browsing Among Mozilla Firefox Users”, Dubroy et al., CHI 2010 [PDF] [Presentation]

“Large Scale Analysis of Web Revisitation Patterns”, Adar et al., CHI 2008 [PDF]

“To have and to hold: exploring the personal archive”, Kaye et al., CHI 2006 [PDF]

“The Perfect Search Engine Is Not Enough:A Study of Orienteering Behavior in Directed Search”, Teevan et al., CHI 2004 [PDF]

Alex Faabor’s blog

Mozilla’s blog of metrics

Design proposals for Epiphany: EpiphanyRedux, hbon’s mockups

by femorandeira at October 14, 2011 10:22 AM

Joaquim Rocha

SeriesFinale 0.6.9

Yup, after some months, here is a new version of SeriesFinale.

This new version doesn’t have many new features but brings an important one related to my previous blog post: the context menu.
When long-pressing a show or a season, a dialog will be shown with some actions. On the show’s context menu (or context dialog?), the user can update it, delete it, view its info or, more importantly, mark the next episode to watch as watched. On the season’s context menu, it can be deleted or, as many users have requested, mark all episodes.

Here are a couple of screenshots:

SF Context Menus Screenshots

SF Context Menus Screenshots

Of course that by only seeing the screenshots you don’t get the same feeling has when you quickly open the dialog and mark the next episode to watch so give it a try.
It it already in Extras Testing and if it works well for you, please vote for it to get into Extras.

The Future

This summer I bought myself an Android phone. That’s right, because of pure curiosity and with the help of Nokia’s decisions regarding MeeGo, I bought a Samsung Galaxy S.
I’ve been using it ever since as my main phone but I didn’t want to leave SF unattended yet. There are a couple of things more that I want to do and I’ll keep an eye on the download statistics to try to guess how many people is still interested in this app.

I haven’t yet found a full replacement for it on Android. I’ve installed a few apps that either don’t work well, require login or are bloated with features making it harder to use so I don’t know if I’ll end up contributing to some FOSS one or developing an official port of SF. Do you think that developing an official version for Android makes sense?
Also, people have asked me for a Symbian and Blackberry versions of it but I just don’t own any phone with these systems.

As for SF on the N9/N950, a release could be out there soon so stay tuned.

by Joaquim Rocha at October 14, 2011 09:38 AM

October 13, 2011

Andy Wingo

what's your C migration plan?

I spend a lot of time in my neighborhood café. It has character. Some of it is generic: like in many other bars, the round tables are marble, the chairs are rickety, the customers and the barmen all shout at each other.

But it has its own thing. The owner inherited it from his father, but he was never sure whether he wanted a record store or a bar, so it's half and half. In practice the CDs in the changer don't change very often, and the rest are all in a side room that is otherwise packed full of junk.

In the morning, everyone gets tallats. Old ladies get theirs with pastries. Old men get theirs amb gotes, with liquor. Morning workers rush in, slam one back, slap coins on the counter and get out. Adéu!

Those with more time, like myself, get a cafè amb llet. Most read the paper. I hack. I spend a couple mornings a week there. It's right pleasant to work there, without internet. My most productive hours of the week are there in the bar.

I do chitchat a bit, though: with designers, mothers, the barmen, retirees, random folk. There's one fellow in particular I like talking with, a designer. Turns out he wants to learn how to program. He told me yesterday that he wanted to learn C.

on c

Now, I spend a lot of time in C. I've written loads of it. I continue to write it at times. I'm fond of it, and it has served me well.

But I have come to believe that writing new programs in C is the hacker equivalent of malpractice. C is just too dangerous to use. The risks are not worth the benefits.

Let's be clear about the benefits of writing in C, before looking at its flaws. I want to be really fair here. C is fast. It has great compilers, everywhere. And they are everywhere: C is ubiquitous. It is very flexible, also. You can do anything in C. It is great for programming drivers. It is possible to write big e-mail clients in it. It has great low-level bit operations (though C++ is getting better at it, with its value types). It is a power tool, and it puts you in control. There are loads of libraries written in it, and for it. It encourages minimalism.

In short, C has been a wild success, and with good reason.

But it's time to stop using it.

The essence of the problem with C is that the behavior of erroneous programs is not specified. This doesn't sound like a big deal, but it is. Let's make an example. What is the meaning of this Python program?

def array_set(a, n, x):
  a[n] = x

I think we would all say that it sets the nth element of a to x. But what about this one in C:

void array_set (void **a, size_t n, void *x) {
  a[n] = x;
}

This one, you really can't tell. You can't use Python's definition, because there are no guarantees about the valid indices to set in the array. In fact there is no array, just a pointer.

In the Python case, if you pass an out-of-bounds array index, you will get an exception. In the C case, you get undefined behavior. Lately what "undefined behavior" means is that the state or organized crime gets to take control of your computer: read your email, log your keystrokes, take pictures of you.

I'm deadly serious. Let's take a better example. Last year Liu Xiaobo won the Nobel Peace Prize for "his long and non-violent struggle for fundamental human rights in China." A couple weeks later, it was found that someone cracked the Nobel Prize website and was serving a Firefox zero-day that took over users' machines.

Apparently, someone was interested in what was on the computers of visitors to the Nobel prize site -- interested enough to use a fresh zero-day, something that probably sells on the black market for some $20,000 or more.

Lately I've been quoting Eben Moglen a lot, especially from the talk he gave at this year's FOSDEM conference. One thing he said there is that "software is the steel of the 21st century". As steel shaped the social relations of the last century, what we hack now forms the material conditions of tomorrow: the next Arab Spring, or the next Green Scare.

Almost all software is connected to the net these days, and so it is all under attack. If you write software in C these days -- software with bugs, like any software -- you are writing software with undefined behavior, and thus, software that enables powerful state and organized crime actors to take advantage of your users.

That sounds a bit exaggerated, no? It is true, though. Look at what is happening with browser vulnerabilities, or what is the same, PDF or Flash vulnerabilities, or PNG or MP4, or what-have-you. The commonality here is that powerful interests exploit unsuspecting users due to flaws in the C and C++ language. Writing more C these days is malpractice.

migration

I still write C. I work on implementations of safe languages -- languages that don't have the same kinds of fundamental vulnerabilities that C and C++ have. Eventually the amount of C in the world will stop growing, and decline as pieces that are now written in C will be written in Python, in JavaScript, in Guile: in short, in languages that don't launch the missiles when you try to write beyond the end of an array.

C has had a great run; we should celebrate it. But its time has passed. What is your migration strategy? How are you going to stop writing C?

by Andy Wingo at October 13, 2011 08:44 PM

Joaquim Rocha

Long press GTK+ TreeView on Maemo

Yesterday was a holiday so I got some time to hack a bit in SeriesFinale.
One of the things I wanted to do was to have a context menu for shows and seasons. Something to apply individual actions like deleting, updating, viewing information, etc when there is a long press on a tree view’s item.

In Maemo the way to do this is to use the TreeView’s tap_and_hold_setup method but the problem is that I hate how this context menu is implemented: I have accidentally deleted stuff because of this menu. Can you think of a less intuitive widget for a touch screen? One that shows below your thumbs, only while you’re touching the screen and triggers some action when you lift it.
Instead, I wanted to show a dialog with the different actions so users could easily know what their doing.
Also, the fact that the API only allows me to use this long-press action to trigger a menu widget doesn’t seem like the best design…

Because of this I decided to implement a TreeView’s subclass that makes it better!
In my opinion, the way to implement this in the TreeView is to treat it like any other functionality: emit a signal when it occurs.

Though it wasn’t difficult, I thought the job would be easier. I had already implemented the “long-press” signal emission but the “row-activated” signal kept being emitted as well. Contrary to what I thought, re-implementing do_row_activated didn’t do it so I had to take a look at the GTK+’s source and though the row_activated method is indeed the one that emits the signal, there is also a “hildon-row-tapped” signal being emitted from the button_release_event. I don’t know if this signal is related or if it is the Python bindings fault but I had to prevent the “row-activated” signal from the mouse_released_event method in a hackish way

Finally, when running the dialog, the application would freeze and not respond after this.
It was related to the emission being done from the timeout callback which, without having the time to look further, smelled like some race condition so I had to wrap the signal emission with the threads_enter/leave.
After this, everything worked well.

Like the “row-activated”, the “long-press” signal gives the tree path and the column that was pressed. It is emitted after pressing for 0.5 seconds and is cancelled if meanwhile the user moves the finger more than 25 pixels. These values are completely arbitrary and have just worked good enough for me. Of course you can easily change them.

And that’s it. I’ve called it EnhancedTreeView and if you want to use it in your Maemo application go ahead and copy/tweak the file (it has less than 60 lines).

by Joaquim Rocha at October 13, 2011 06:05 PM

Diego Pino

Configuring different JDKs with alternatives

If you’re a Java developer and are using a Linux system, probably you’ve had to deal with the alternatives program. I’m going to be honest, I hate ‘alternatives‘ (with a passion). I use the command-line all the time, but I just think the interface of this command is counterintuitive. I will try in this post to explain how the ‘alternatives‘ program works, specifically for configuring Java,  and how I think its interface could be improved.

When there are several programs that response to the same command in a system, the ‘alternatives‘ command let us set which will be the real program that will be executed when that command is called. This is very clear to see in the case of Java. There are several JDK implementations: OpenJDK, GNU, JDK from Oracle, etc. All these JDKs come with a ‘java‘ executable. Supposing we got several JDKs from different vendors installed, which will be the one executed in our system when the ‘java‘ program runs?

Firstly, I’ll check what are the Java alternatives configured in my system:

$ alternatives --config java
 
+  1        /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
*  2        /etc/alternatives/java_sdk/bin/java
3           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
4           /usr/java/latest/bin/java
5           /usr/java/jdk1.7.0/bin/java

It seems I got several :) If you just installed Fedora and run the command above, probably you’ll see nothing, as you haven’t added an alternative yet. So, how to add a new alternative? I run the help first:

$ alternatives --help

Says that: ‘alternatives –install <link> <name> <path> <priority>‘, adds a new alternative. Now, the million-dollar question. What the hell means each parameter? This is pretty obscure if you don’t really understand what’s the purpose of the ‘alternatives‘ program.

  • <name> is the name under which the alternative will be grouped. If we set <name> as ‘java’, then when later we do: ‘alternatives –config java‘, the alternatives for ‘java‘ will be listed.
  • <link> is the full path to the command that will be executed. If we set <link> as ‘/usr/bin/java’, this means that when the ‘/usr/bin/java‘ command is executed in our system, the default alternative for ‘java‘ will be run.
  • <path> is the full path to the command of the alternative. The program which will be actually run.
  • <priority> a priority number. The highest the number, the higher the priority. That means that the alternative with the highest number will be executed by default, unless we manually set which is the default.

So, imagine I’m doing a fresh installation, downloaded the latest version of Oracle JDK 1.6 and would like to add it as an alternative. We should run the following command:

$ sudo alternatives --install /usr/bin/java java  /usr/java/jdk1.6.0_25/bin/java 1000

Now if we list the alternatives for ‘java‘.

$ sudo alternatives --config java
 
Selection    Command
-----------------------------------------------
*+ 1           /usr/java/jdk1.6.0_25/bin/java

When you run this command the prompt asks you which alternative will be the default.

Enter to keep the current selection[+], or type selection number:

The ‘+‘ symbol indicates the manual default, the ‘*‘ indicates the automatic default (the one with the highest number). In this case as there is only one alternative both signs point to the same alternative.

Let’s execute the ‘java‘ command and see what happens:

$ java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode)

You may think this is a pretty stupid example as there is only one alternative. Let’s add OpenJDK as an alternative (imagine I just downloaded and have successfully installed in my system). I should run the following:

$ sudo alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2000

As we have set OpenJDK with a priority of 2000, higher that Oracle JDK (which was 1000), that means that now OpenJDK is the default alternative for ‘java‘.

$ alternatives --config java
There are 2 programs which provide 'java'.

Selection    Command
-----------------------------------------------
1           /usr/java/jdk1.6.0_25/bin/java
*+ 2        /usr/lib/jvm/jre-1.6.0-openjdk/bin/java

Let’s see what happens if we run ‘java‘ now.

$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.3) (fedora-59.1.10.3.fc15-i386)
OpenJDK Server VM (build 20.0-b11, mixed mode)

As the OpenJDK is now the default alternative, OpenJDK is executed.

What if we would like to remove an alternative. The help says:

alternatives --remove &lt;name&gt; &lt;path&gt;

Remember that <path> is actually <command> as it’s listed in the list of alternatives. So, if we would like to remove OpenJDK we should type the following:

$ sudo alternatives --remove java /usr/lib/jvm/jre-1.6.0-openjdk/bin/java

Now  Oracle JDK should be the only alternative available:

$ alternatives --config java
 
There is 1 program that provides 'java'.
 
Selection    Command
-----------------------------------------------
*+ 1           /usr/java/jdk1.6.0_25/bin/java

Another interesting parameter is the ‘–display’ option, which show information about the available alternatives.

$ sudo alternatives --display java
java - status is auto.
link currently points to /usr/java/jdk1.6.0_25/bin/java
/usr/java/jdk1.6.0_25/bin/java - priority 1000
Current `best' version is /usr/java/jdk1.6.0_25/bin/java.

And that’s basically all you need to know about alternatives with regard to Java configuration.

Now, why I think the interface of alternatives is somehow counterintuitive?

Well, the first thing is that when you list the alternatives there are two headers: <selection> and <command>. The help, however tells you that for installing or removing and alternative you need to provide a <name> and a <path>. What is called <command> is in fact <path>, so if they mean the same thing, they should have the same name. Another thing is that unless you really got a good grasp of what the ‘alternatives‘ program does, it’s difficult to understand at first sight what’s the meaning of <name>. Perhaps an example in the man pages could help (an EXAMPLE section should be mandatory in every man page IMHO, but that’s another story). Lastly, I wonder what’s the purpose of providing <path> for removing an alternative? If the way the user knows about alternatives is by listing them and there’s an identifier for each alternative (the <selection> column), wouldn’t be much easier to remove an alternative in this way ‘alternatives –remove java 1‘ (meaning “remove the first alternative for java“), which definitively is much easier and intuitive than typing ‘alternatives –remove java /usr/java/jdk1.6.0_25/bin/java’. Just my two cents.

by Diego Pino at October 13, 2011 07:30 AM

October 11, 2011

Andy Wingo

partial evaluation in guile

Friends, something awesome just happened: Guile just got itself a respectable inliner.

I have said before on this blog, quoting commenter Rémi Forax, that "inlining is the mother of all optimizations". It is true that inlining opens up space for code motion, constant folding, dead code elimination, and loop optimizations. However, credit might be better laid at the feet of partial evaluation, the mother of all inlining algorithms.

Partial evaluation is a source-to-source transformation that takes your program and produces a better one: one in which any computation that can be done at compile-time is already made, leaving only those computations that need to happen at run-time.

For example, the application

(+ 2 3)

can clearly be evaluated at compile-time. We say that the source expression (+ 2 3) reduces to 5 via constant folding. The result, 5 in this case, is the residual expression.

A more complicated example would look like:

(let ((string->chars
       (lambda (s)
         (define char-at
           (lambda (n) (string-ref s n)))
         (define len
           (lambda () (string-length s)))
         (let loop ((i 0))
           (if (< i (len))
               (cons (char-at i)
                     (loop (1+ i)))
               '())))))
  (string->chars "yo"))
=> (list #\y #\o)

Here when I write =>, you should read it as, "residualizes at compile-time to". In this case our input program residualized, at compile-time, to a simple list construction. The loop was totally unrolled, the string-refs folded, and all leaf procedures were inlined.

Neat, eh?

optimization enables expressiveness

If the partial evaluator does its job right, the residual program will run faster. However this isn't the real reason that I'm so pleased with it; rather, it's that it lets me write different programs.

You see, I hack on Guile's compiler and VM and all that. When I write code, I know what Guile is going to do with it. Unfortunately, this caused my programs to be uglier than necessary, because I knew that Guile wasn't going to inline some important things for me. I wrote at a lower level of abstraction, because I couldn't trust the compiler.

Now, with the partial evaluator, I'm happy to use helper functions, even higher-order helpers, with the knowledge that Guile will mostly do the right thing. This is particularly important in the context of languages that support syntactic abstraction, like Scheme. If you're a Schemer and haven't seen Kent Dybvig's Macro Writers' Bill of Rights talk (slides), do check it out.

Incidentally, there was a sad moment in JSConf.eu a couple weekends ago when Andreas Gal (of all people!) indicated that he had to manually inline some functions in PDF.js in order to get adequate speed. More on JavaScript a little later, though.

about partial evaluation

A partial evaluator looks a lot like a regular meta-circular evaluator. It's a recursive function that takes an expression and an environment and yields a value. Guile's partial evaluator, peval, builds up lexical environments when it sees let and other binding constructs, and tries to propagate copies when it sees lexical references.

Inlining is facilitated by copy-propagation of lambda expressions. Just as the initial value 0 in the example above propagates through the lexical variable i to reach (< i (len)), (lambda () (string-length s)) propagates to len. Application of a lambda expression reduces to the equivalent of a let binding. So for the first iteration of loop above, we have:

(< i (len))
;; copy propagation
=> (< 0 ((lambda () (string-length s))))
;; beta-reduction
=> (< 0 (string-length s))
;; copy-propagation
=> (< 0 (string-length "yo"))
;; constant-folding
=> (< 0 2)
;; constant-folding
=> #t

In this case the condition folded to a constant, so we know at compile-time which branch to take. The second branch is dead, so we eliminate it. The process continues until we finally produce the resulting list.

down the rabbit hole

Up to here things are easy: we have a simple, well-typed example that terminates. But to be part of a real-world compiler, a partial evaluator needs to handle real-world code: accessors for mutable data, access to mutable bindings (lexical and global), indefinite recursion, unbound variables, and poorly-typed programs. In addition, a real-world inliner needs to run quickly and avoid producing bloated residual code.

I should take a moment and note that statically-typed, functional languages can avoid a number of these problems, simply by defining them away. It is no wonder that compiler people tend towards early binding. Scheme does exhibit a fair amount of early binding through its use of lexical scope, but it is not a pure functional language. Working on this peval was the first time that I wished for immutable pairs in Scheme, as promoted by Racket and R6RS.

Anyway, having mutability in your language isn't so bad. You do miss some optimization opportunities, but that is OK. What is not OK in a production peval is spending too much time on an expression.

Guile's solution, following Waddell and Dybvig's excellent Fast and Effective Procedure Inlining, is to simply count the number of times through the inliner. Each inlining attempt gets a fresh counter, and any work performed within an inlining attempt decrements the counter. When the counter reaches zero, the inlining attempt is aborted, and a call is residualized instead. Since the number of call sites in the program is fixed, and there is a maximum amount of work that will be done at each call site, the resulting algorithm is O(N) in the size of the source program.

Guile's partial evaluator also uses the on-demand, online strategy of Waddell and Dybvig, to allow definitions to be processed in their use contexts. For example, (cons 1 2) may be reduced to #t when processed as a test, in a conditional. If, after processing the body of a let, a binding is unreferenced, then it is processed for effect. Et cetera.

With the effort counter in place, Guile simply tries to inline every call site in the program, knowing that it will bail out if things don't work. It sounds a little crazy, but it works, as Waddell and Dybvig show. The effort counter also serves to limit code growth, though it is a bit crude. In any case I got less than a percent of code growth when optimizing the psyntax expander that Guile uses, which is a win in my book.

caveats

Partial evaluation can only propagate bindings whose definitions are known. In the case of Guile, then, that restricts inlining to lexical references and primitive references, and notably excludes global references and module imports, or fields of mutable objects. So this does not yet give us cross-module inlining, beyond the hacks that abuse the macro expander.

This observation has a correlary, in that some languages promote a style of programming that is difficult to analyze. I'm really talking about object-oriented languages here, and the dynamic ones in particular. When you see o.foo() in Java, there is at least the possibility that foo is a final method, so you know you can inline it if you choose to. But in JavaScript if you see o.foo(), you don't know anything: the set of properties of o can and does vary at runtime as people monkey-patch the object o, its prototype, or Object.prototype. You can even change o.__proto__ in most JS implementations. Even if you can see that your o.foo() call is dominated by a o.foo = ... assignment, you still don't know anything in ES5, as o could have a setter for the foo property.

This situation is mitigated in the JavaScript world by a couple of things.

First of all, you don't have to program this way: you can use lexical scoping in a more functional style. Coupled with strict mode, this allows a compiler to see that a call to foo can be inlined, as long as foo isn't mutated in the source program. That is a property that is cheap to prove statically.

However, as Andreas Gal found out, this isn't something that the mainstream JS implementations do. It is really a shame, and it has a lasting impact on the programs we write.

I even heard a couple people say that in JS, you should avoid deep lexical bindings, because the access time depends on the binding depth. While this is true for current implementations, it is a property of the implementations and not of the language. Absent with and eval-introduced bindings, a property that is true in strict-mode code, it is possible to quickly compute the set of free variables for every function expression. When the closure is made, instead of grabbing a handle on some sort of nested scope object, a JS implementation can just copy the values of the free variables, and store them in a vector associated with the function code. (You see, a closure is code with data.) Then any accesses to those variables go through the vector instead of the scope.

For assigned variables -- again, a property that can be proven statically -- you put the variables in a fresh "box", and rewrite accesses to those variables to go through that box. Capturing a free variable copies the box instead of its value.

There is nothing new about this technique; Cardelli and Dybvig (and probably others) discovered it independently in the 80s.

This point about closure implementation is related to partial evaluation: people don't complain much about the poor static inliners of JS, because the generally poor closure implementations penalize lexical abstraction. Truly a shame!

* * *

It seems I have digressed. Sorry about that!

I spoke about closures and lexical scope, properties of the JS language that can enable static inlining. The second (and more important) way that JS implementations can support inlining is dynamically. I trolled about that some months ago. Dynamic inlining is fantastic, when it works, though there are limiting heuristics (scroll down to "inlining", and note that the exact set of heuristics have changed in the intervening months).

So my last point was about something that Guile does well that JS implementations do poorly, and it's fair that this point should be the reverse. I would like to be able to dynamically inline, but this would mean associating the intermediate representation with Scheme functions. As Guile can compile code ahead-of-time, this means we would have to serialize the IR out to disk, in much the same way as GCC's new link-time optimizer (LTO) does. But I would like to put that off until we change the format of compiled Guile code to be ELF. Otherwise we run the risk of bloating our runtime memory size.

try it out

Guile's partial evaluator was joint work between myself and my fellow Guile maintainer Ludovic Courtès, and was inspired by a presentation by William Cook at DSL 2011, along with the Waddell and Dybvig's Fast and Effective Procedure Inlining.

This code is currently only in the development Guile tree, built from git. Barring problems, it will be part of Guile 2.0.3, which should be out in a couple weeks.

You can check out what the optimizer does at the command prompt:

>,optimize (let ((x 13)) (* x x))
$1 = 169
>,optimize (let ((x 13)) (* x foo))
$2 = (* 13 foo)

Have fun, and send bugs to bug-guile@gnu.org.

by Andy Wingo at October 11, 2011 10:01 AM

October 10, 2011

Simón Pena

Mixing QML and MeeGoTouch

When trying to invoke a MeeGoTouch application's MSheet from a QML app, I was getting the following error:

There is no instance of MDeviceProfile. Please create MComponentData first.

Using MApplication instead of QApplication would solve that, but still a MApplicationWindow would be needed to make the MSheet appear.

After searching on Google for a while (see after the snippet for the sources) and talking to gri in #harmattan, I've come up with the following solution:

#include <MApplication>
#include <MApplicationWindow>
#include <MApplicationPage>
#include <QDeclarativeEngine>
#include <QGraphicsObject>
#include <QDeclarativeComponent>
#include <QDeclarativeContext>

int main(int argc, char *argv[])
{
    MApplication app(argc, argv);
    QDeclarativeEngine engine;

    // The context is unused in this example
//    QDeclarativeContext *context = engine.rootContext();

    MApplicationWindow window;
    window.showFullScreen();

    MApplicationPage page;
    page.setPannable(false);
    page.appear(MApplication::instance()->activeWindow());

    QDeclarativeComponent component(&engine, QUrl("qrc:/qml/main.qml"));
    QGraphicsObject *content = qobject_cast<QGraphicsObject*>(component.create());
    MWidget *centralWidget = new MWidget;
    content->setParentItem(centralWidget);
    page.setCentralWidget(centralWidget);

    int result = app.exec();

    delete centralWidget;

    return result;
}

From QML support in Meego touch Framework I learnt that I had to load the QML into a MeeGoTouch widget, so I followed Loading QML components from C++ to replace the loadQmlComponent non-existing method with the QDeclarativeComponent::create approach.

Also, note that I use MApplicationWindow::showFullScreen instead of MApplicationWindow::show and MWidget::setMinimumSize

by Simón at October 10, 2011 09:07 PM

October 06, 2011

Claudio Saavedra

Thu 2011/Oct/06

  • Most of us who work in technology, secretly wish that one day, something we've created will change the world in a positive way, or that we will be able to look back at some point and realize that we've contributed somehow to make this world a better place. For many of us, this is the driving force that put us in this field in the first place, even when we rarely admit it to each other, let alone to anyone else.

    Some of us get to achieve it, one way or another. In an anonymous way, most likely in the form of one single link in a chain of events that, individually, might seem insignificant, but altogether, represent the continuous and dynamic steering of human progress. Our names will not be remembered, neither will our individual contributions, but they will be there for others to build upon, one link at the time, one step after another.

    And then there are those who manage to envision that things are possible in ways that would be unthinkable for the rest of us, and not only that, strive to make them happen. They don't work alone and rely on others, that's certain, yet it's their unique inspiration, persistence, and the exceptional love for what they do what motivates others to flock along them and help them change the world. Steve Jobs was probably one of the most remarkable examples in the latest times of this rare but wonderful people, and we've been lucky to be challenged with his contributions to technology. I am not sure whether being in this industry would be so challenging and exciting as it is, if he hadn't been around.

October 06, 2011 12:04 PM