archives 2009

Internet Explorer strips leading whitespaces in text nodes

For some mysterious reason, Internet Explorer (tested in IE7 and IE8) strips leading spaces in text nodes preceded by an empty element, such as this:

<div><span></span> foo</div>

While innoccuous in static pages, it becomes problematic when DOM nodes get updated after a delay by some Javascript, as the separating whitespace has disappeared, hence ruining the layout of your text.

Surprisingly, I haven’t found any reference to this IE bug (not that there is a shortage of complaints about other IE idiosyncrasies), so I thought I’d share the problem and the solution I have found here. It’s all demonstrated in the following example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>IE Whitespace Bug</title>
  <script type="text/javascript">
    function fill(name) {
      var e = document.getElementById(name);
      e.innerHTML = ‘hello’;
    }
  </script>
</head>
<body onload="fill(‘hello1′); fill(‘hello2′);">
<h1><span id="hello1"></span> world</h1>
<h1><span id="hello2">&nbsp;</span> world</h1>

</body>
</html>

In the first case, the whitespace gets stripped, thus resulting in “Helloworld”. In the second example, the non-breaking space prevents IE from stripping the whitespace, so that when the span is filled by Javascript, the text reads “Hello world” as expected.

If you know other solutions or whether it’s considered a bug that will be fixed, please post in the comments!

“XMMS2 Collections” presentation at Metaweb

On my way to the Google Summer of Code Mentor Summit 2009, I accepted DraX’s invitation to give a 1-hour talk about XMMS2 Collections at his work, i.e. Metaweb, in San Francisco.

The topic was somewhat relevant for them as it’s reminiscent of MQL, the query language they developed for Freebase. It’s worth noting that although both share a pool of buzzwords such as “graph”, “loosely-structured”, “querying”, etc., they are not quite the same:

  • Freebase is essentially a giant graph-database, which you query with MQL to retrieve graph fragments.
  • The XMMS2 database is a flat denormalized store, which you query with graph-structured Collections to retrieve a list of entries.

Note: Collections 2.0 should however allow fancier querying to retrieve tree-shaped structures.

About 10-20 people showed up and listened to me babbling about the concept of Collections, the rationale behind them, the API, Collections 2.0, possible UI uses, what it represents for the user, pointers to S4, etc.

It’s all in those over-engineered slides that I have no choice but to put online, under Creative Commons Attribution-Share Alike 2.5 License, for them to live on forever on the internets. And yes, it’s still either in evil Keynote format (source), or in PDF.

Oh and Metaweb, thanks for the food!

“Music Player” session at the GSoC Mentor Summit 2009

Thanks to Google’s everlasting generosity, mentors from all Open Source projects that participated to the Google Summer of Code 2009 have flocked en masse to Mountain View to meet up and talk about code and drink beer. More in pictures in my Bay Area Flickr set, if you’re curious.

Sessions were organised spontaneously around various topics, and one of which, proposed by Amarok2’s Lydia/nightrose, was “Problems Audio Players face today”. Which resulted in 15-20 people from various projects (incl. Amarok2, Rockbox, Maemo, XMMS2 & others) talking about solving problems encountered by all music player developers (e.g. lyrics and cover art fetching), as well as features on our beloved users’ wishlists (portable player support, tags, musicbrainz, etc).

And if you weren’t there, don’t despair, for I just (finally) posted minutes for this session on the GSoC wiki. Some interesting ideas in there, so go and have a look, and get to work!

Embrace the community (Ep. I: The Fandom Menace)

Or why and how the new XMMS2 GUI client should be extensible (and what I mean by extensible anyway).

Quizz: What do Winamp, Foobar2000, Emacs, Eclipse and Firefox have in common?

(Vim users, we love you too, but shut up for now please.)

They are very popular and they highly promote extensibility.

Now, we all know that correlation != causation. What is certain, however, is that all those projects boast many fan(boy)s, some of whom even get quite religious about it.

This enthusiasm reflects itself in the emergence of strong communities: people who share content, tips, modules, extensions, themes, configurations, scripts, etc. And those people usually aren’t even core developers of the software, sometimes not developers at all; just users or hobbyists who like the project.

Paradoxically, most of what they share is aimed at personalizing the software, i.e. making it the user’s own, fitting the user’s wishes and needs. This creates a feeling of ownership and satisfaction, because the user can bend it the way she likes and master it like a pro.

In essence, the idea here is give power to people to shape the software the way they want, and they will extend it in creative ways and get together to share these extensions. And I think that encouraging this creative freedom is one of the many factors which contribute to popularity.

Continue reading

Git presentation at Purple Scout

On April 17, I was invited to do a presentation on Git for Purple Scout in Malmö, Sweden. Around 40 people showed up (including many XMMS2 folks) and endured 2-hours on what Git is, why it’s so awesome and all the fancy stuff you can do with it. I think people liked it and although most seemed to be using Git already, they were nice enough to say that they’d learned something anyway.

I’d given talks about Git previously in Switzerland, but for this occasion I reworked and pimped up my slides quite a bit to cover more material and have more cute diagrams. As before, you can get the slides for the Git presentation (PDF), or even fiddle with the source file, under the terms of the Creative Commons Attribution-Share Alike 2.5 License. Reuse, modify or poke fun at at will!

Sorry it’s still in proprietary Keynote format, because that’s the only vaguely acceptable software I found to make lots of diagram easily… Any Free alternative would be welcome, if someone knows of one.

It was great fun preparing and giving this course, and being back in Sweden and seeing friends again, so tusen tack till Purple Scout for making this happen!

Going beyond tracks and local data (Ep. VII: Return of the GUI)

Now that we have defined what/whose problem we’re trying to solve, and debated about the implementation details, it would be worth asking why a graphical XMMS2 client would be a good fit.

After all, we have a brand new korving CLI (nycli), isn’t that enough? In a sense it is, but it fills a different niche. GUI applications are good at things that CLI applications aren’t, and vice-versa. So the goal is to exploit the specific advantages of graphical music players.

For instance, even the most hardcore fans of the command-line will admit that the following tasks are easier with a graphical player:

  • Edit a playlist, using mouse selection and drag-and-drop.
  • Browse albums by cover.
  • Organize music manually into playlists or using dynamic collections.

But these are just simple examples that are now expected of any standard graphical music player.

Can’t we get something more exciting?

As Obama taught us, “yes, we can!”

Three main aspects usually poorly supported and under-exploited in music players are powerful tools to:

  • Browse
  • Organize
  • Explore/discover

Continue reading