Monthly Archives: February 2007

SamePlace 0.6.0rc1 available

The first release candidate of the SamePlace Suite 0.6.0 is available.


Update: see here for current packages.

What’s new for users

  • experimental Thunderbird 2.0b2 integration
  • accounts can be configured to auto-connect at startup
  • contact input field with auto-completion
  • hotkey (Alt+N) to switch to next conversation with unread messages
  • sending and displaying typing events
  • hotkeys for text styles (Control+B, Control+I, Control+U)
  • different colors for nicknames in groupchats

What’s new for developers

  • revised presence cache policy: keeping presences from contacts also when unavailable, and outgoing MUC presences; removing incoming MUC presences when leaving room
  • when connecting remote application to MUC, application receives occupants’ presences
  • replaced JavaScript XML parser with internal Mozilla DOM parser
  • made logging optional and disabled by default; set xmpp.logTargets to “console” to enable it

Special thanks to…

  • dfd, who replaced half the nitrogen in the air he breathes with JavaScript and gave me quite a hard time in keeping up with his patches.
  • intinig, whose heroic, relentless, altruistic… nagging helped shape many features. Giovanni, users shall love you. (Me, I am going to write a plugin that deletes sentences from you beginning with “I’d like” for a while!)
  • Giuseppe Adessi, who contributed code for Thunderbird integration.
  • Sten, who patiently gave copious feedback that eventually led to fixing the infamous bug #20.

XML Sync Islands – Let the web sharing begin!

It does not happen often that I find my jaw dropping in amazement on the floor and staying there. I also do not expect, should it really have to happen, that it be related to something I myself started, and which I can delude myself into believing that I know what it can do and where it is headed.

Well, reality strikes. This time, it’s been thanks to dfd.

Some weeks ago, dfd got his feet wet in the field of real-time collaborative applications by writing Tratto, a simple shared whiteboard based on XUL and SVG.

Then one day as he and Ripley were chatting, their incurable geeky nature took over. They wondered: “wouldn’t it be neat if synchronization and sharing were taken care of once for all and stuffed into a nice little module, with an easy interface?” The idea of XML Sync Islands was born.

RichDraw, a VML/SVG Editor by Mark Finkle, turned into a shared whiteboard using the bookmarklet version of XSI. (Scaled-down YouTube video, full-size OGG [high quality, 3.2MB], full-size AVI [medium quality, 1.7MB])

Talking ensued. A few mornings ago, dfd sat down and started to code a proof of concept. That day I logged on to Jabber a few times, and he repeatedly greeted me with satanic laughs. At the end of the day, I understood why.

XML Sync Islands allow to share a portion of the DOM (XHTML, XUL, SVG) among users over an IM session carried by SamePlace and xmpp4moz, transparently, in real-time. Its complete API reference is:

 * Make an element and its subtree synchronized across an IM session.
 * Argument can be an ID or a DOMElement.


Talk about doing more with less…

It can be used in two ways: as a library, to build a shared application from the ground up, or as a bookmarklet, to share parts of existing, innocent, unknowing web pages.

Although it is still a proof of concept (e.g. there is no handling of collisions), it can already be put to good use, as shown by the screencasts.

Chessboard is written from scratch using XSI as a library. The only actual code is the drag and drop handler and little else. (Scaled-down YouTube video, full-size OGG [high quality, 4.3MB], full-size AVI [medium quality, 2.6MB])

Preliminary documentation about XML Sync Islands is available on the wiki.

Head over to the forum and let us know what you think about this!

On Flock, xmpp4moz, Jingle, and Friday nights

Oh, great. Just when I think I have completed my duties and reported on the latest developments (“reported” as, for the most and best part, they took place far from my keyboard), and that I can enjoy a relatively calm weekend for a change, Joshua chimes in and evokes “all sorts of craziness” in Flock with xmpp4moz and Jingle.

Did you really have to say that on a Friday night, Joshua?

Memoize in JavaScript

In JavaScript, functions are objects. No big deal, until you expand that to functions can have state, and realize that things like this become possible:

function fact(n) {
    var memo = arguments.callee.memo;
    if(!(n in memo))
        if(n == 0)
            memo[n] = 1;
            memo[n] = n * fact(n - 1);

    return memo[n];
fact.memo = {};

(arguments.callee is how you reference a function from within the function itself.)

seethrough 0.1: sub-templates, and cache-ready

Uh oh. Beware when you take an evening’s hack and put it online, as someone who knows what he’s doing might come along and turn it into something useful.

That happened to seethrough, with a patch courtesy of Joel, who added two major features:

  • sub-template inclusion, via the <e:include/> tag;
  • parse/render stage split.

The latter means that the (possibly expensive) parse and preparation stage only needs to be performed once. The resulting intermediate form can be cached, and rendered many times within different environments. For example:

%% Parsing
{XMLTree, _Misc} = xmerl_scan:file(File),
Intermediate = seethrough:visit(XMLTree),

%% Rendering intermediate form within Env1
Render1 = seethrough:render(Intermediate, Env1),
xmerl:export_simple(lists:flatten([Render1]), xmerl_xml,
                    [#xmlAttribute{name = prolog, value = ""}]).

%% More rendering, but within Env2
Render2 = seethrough:render(Intermediate, Env2),
xmerl:export_simple(lists:flatten([Render2]), xmerl_xml,
                    [#xmlAttribute{name = prolog, value = ""}]).

%% Yet more rendering, within Env3
Render3 = seethrough:render(Intermediate, Env3),
xmerl:export_simple(lists:flatten([Render3]), xmerl_xml,
                    [#xmlAttribute{name = prolog, value = ""}]).

Kudos to Joel!