<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>ralphm.net blog</title><link>http://ralphm.net/blog</link><description>Syndicated ralphm.net blog</description><item><title>XMPP Message Attaching, Fastening, References</title><link>http://ralphm.net/blog/2019/09/09/fastening</link><dc:date>2019-09-09T13:29:26+02:00</dc:date><description>
          Rich messaging in modern messaging services often includes
            marking up plain text messages with user mentions, link cards,
            emoji reactions, etc. To implement this in XMPP, there have been
            several protocol proposals. This post explores how those could be
            combined and rendered.
        </description><content:encoded>&lt;![CDATA[<p><i>Pointing to things…</i></p>
      

      <p>Services like Twitter and Slack have functionality that attempts to
        interpret parts of the plain text of tweets or message as entered by
        the user. Pieces of the text that look like links, mentions of another
        user, hash tags, or stock symbols, cause additional meta data to be
        added to the object representing the message, so that receiving clients
        can mark up those pieces of text in a special way. Twitter calls this
        meta data <a href="https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/entities-object.html" title="">Tweet
          Entities</a> and for each piece of interpreted text, it includes
        indices for the start and end of along with additional information
        depending on the type of entity. A client can then do in-line
        replacements at the exact character indices, e.g. by making it into a
        hyperlink.  Twitter Entities served as inspiration for <a href="https://xmpp.org/extensions/xep-0372.html" title="">XEP-0372:
          References</a>.</p>

      <p>References can be used in two ways: including a
        <code class="tag language-xml  element">reference</code> as a sibling to the <code class="tag language-xml  element">body</code> element of a
        message. The <code class="tag language-xml attribute">begin</code> and <code class="tag language-xml attribute">end</code> attributes then point to the indices of
        the plain text in the body. This would typically be used if the
        interpretation of the message is done by the sending client.</p>

      <p>Alternatively, a service (e.g. a MUC service) could parse incoming
        messages and send a separate stanza to mark up the original stanza. In
        this case you need a mechanism for pointing to that other message.
        There have been two proposals for this, with slightly differing
        approaches, and in the examples below, I'll use the proto-XEP <a href="" title="">Message Fastening</a>. While pointing to the <em>stanza ID</em> of
        the other message, it embeds a <code class="tag language-xml  element">reference</code> element in the
        <code class="tag language-xml  element">apply-to</code> element.</p>

      <h4>Mentioning another user</h4>

        

        <p>Let's start out with the example of mentioning another user.</p>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/Kev" type="groupchat"&gt;
  &lt;stanza-id id="2019-09-02-1" by="room@muc.this.example"
             xmlns="urn:xmpp:sid:0"/&gt;
  &lt;body&gt;Some rubbish @ralphm&lt;/body&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <p>A client might render this as:</p>

        <div class="message" id="message-1"><div class="meta"><span class="sender">
            Kev
          </span><time class="timestamp" datetime="2019-09-02T13:04:59" title="Monday, 2 September 2019 at 13:04:59">13:04</time></div><div class="body">
            <p>Some rubbish @ralphm</p>
          </div></div>

        <p>The MUC service then parses the plain-text message, and finds a reference to my nickname prefixed with an @-sign, and sends a stanza to the room that marks up the message Kev sent to me.</p>
        
        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example"
         type="groupchat"&gt;
  &lt;stanza-id xmlns="urn:xmpp:sid:0"
             id="2019-09-02-2" by="room@muc.this.example"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-1"&gt;
    &lt;reference begin="13" end="19" xmlns="urn:example:reference:0"&gt;
      &lt;mention jid="room@muc.this.example/ralphm"/&gt;
    &lt;/reference&gt;
  &lt;/apply-to&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <p>This stanza declares that it is attached to the previous message by the stanza ID that was included with the original stanza. In its payload, it includes a reference, referring to the characters 13 through 19. It has a <code class="tag language-xml  element">mention</code> child pointing to my occupant JID. Alternatively, the room might have linked to my real JID. A client can then <em>alter</em> the presentation of the original message to use the attached mention reference:</p>

        <div class="message" id="message-2"><div class="meta"><span class="sender">
            Kev
          </span><time class="timestamp" datetime="2019-09-02T13:04:59" title="Monday, 2 September 2019 at 13:04:59">13:04</time></div><div class="body">
            <p>Some rubbish <a href="/ralphm">@ralphm</a></p>
          </div></div>

        <p>The characters referencing <code class="literal">@ralphm</code> are now highlighted, hovering the mention shows a tooltip with my full name, and clicking on it brings you to a page describing me. This information was not present in the stanza, but a client can use the XMPP URI as a key to present additional information. E.g. from the user's contact list, by doing a vCard lookup, etc.</p>

        <hr class="admon"/><div class="admon note"><h5 class="admon">Note:</h5>
          <p>The current specification for References does not have defined child elements, but instead uses a <code class="tag language-xml attribute">type</code> attribute and URIs. However, Jonas <s>Wielicki</s> Schäfer provided some valuable <a href="https://mail.jabber.org/pipermail/standards/2018-March/034559.html" title="">feedback</a>, suggesting this idea. By using a dedicated element for the target of the reference, each can have their own attributes, making it more explicit. Also, it is a natural extension point, by including a differently namespaced element instead.</p>
        </div><hr class="admon"/>

      

      <h4>Referring to previous messages</h4>
        

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/Ge0rG"
         type="groupchat"&gt;
  &lt;stanza-id xmlns="urn:xmpp:sid:0"
             id="2019-09-02-3" by="room@muc.this.example"/&gt;
  &lt;reference begin="0" end="6" xmlns="urn:example:reference:0"&gt;
    &lt;mention jid="room@muc.this.example/ralphm"/&gt;
  &lt;/reference&gt;
  &lt;reference begin="26" end="32" xmlns="urn:example:reference:0"&gt;
    &lt;message id="2019-09-02-1"/&gt;
  &lt;/reference&gt;
  &lt;body&gt;@ralphm did you see Kev's message earlier?&lt;/body&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <p>Unlike before, this example does not point to another stanza with <code class="tag language-xml  element">apply-to</code>. Instead, Ge0rG's client added references to go along with the plain-text body: one for the mention of me, and one for a reference to an earlier message.</p>

        <div class="message" id="message-3"><div class="meta"><span class="sender">
            Ge0rG
          </span><time class="timestamp" datetime="2019-09-02T13:16:32" title="Monday, 2 September 2019 at 13:16:32">13:16</time></div><div class="body">
            <p><a href="/ralphm">@ralphm</a> did you see Kev's <a href="#message-2" title="">message</a> earlier?</p>
          </div></div>
      

      <h4>Emoji Reactions</h4>
        

        <p>Instead of reacting with a full message, Slack, like online forum software much earlier, has the ability to attach emoji reactions to messages.</p>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/Kev"
         type="groupchat"&gt;
  &lt;stanza-id xmlns="urn:xmpp:sid:0"
            id="2019-09-02-4" by="room@muc.this.example"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-3"&gt;
    &lt;reactions xmlns="urn:example:reactions:0"&gt;
      &lt;reaction label=":+1:"&gt;👍&lt;/reaction&gt;
    &lt;/reactions&gt;
  &lt;/apply-to&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/ralphm"
         type="groupchat"&gt;
  &lt;stanza-id xmlns="urn:xmpp:sid:0"
             id="2019-09-02-6" by="room@muc.this.example"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-3"&gt;
    &lt;reactions xmlns="urn:example:reactions:0"&gt;
      &lt;reaction label=":parrot:"
                img="cid:b729aec3f521694a35c3fc94d7477b32bc6444ca@bob.xmpp.org"/&gt;
    &lt;/reactions&gt;
  &lt;/apply-to&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <p>These two examples show two separate instances of a person
          reacting to the previous message by Ge0rG. It uses
          the protocol from <a href="https://xmpp.org/extensions/inbox/reactions.html" title="">Message
            Reactions</a>, another Proto-XEP. However, I expanded on it by
          introducing two new attributes. The <code class="tag language-xml attribute">label</code> allows for a textual shorthand, that
          might be typed by a user. Custom emoji can be represented with the
          <code class="tag language-xml attribute">img</code> attribute, that points to a <a href="https://xmpp.org/extensions/xep-0231.html" title="">XEP-0231: Bits of
            Binary</a> object.</p>

        <div class="message" id="message-4"><div class="meta"><span class="sender">
            Ge0rG
          </span><time class="timestamp" datetime="2019-09-02T13:16:32" title="Monday, 2 September 2019 at 13:16:32">13:16</time></div><div class="body">
            <p><a href="/ralphm">@ralphm</a> did you see Kev's <a href="#message-2" title="">message</a> earlier?</p>
          </div><div class="reactions">
            <span class="reaction" title="Kevflow reacted with :+1:"><span class="text">👍</span> <span class="count">2</span></span>
            <span class="reaction self" title="ralphm reacted with :parrot:"><span class="text">
                <img src="/images/blog/parrot.gif"/>
              </span> <span class="count">1</span></span>
          </div></div>

        <p>The attached emoji are rendered below the original message, and hovering over them reveals who were the respondents. Here my own reaction is highlighted by a squircle border.</p>

      

      <h4>Including a link</h4>
        

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/ralphm" type="groupchat"&gt;
  &lt;stanza-id id="2019-09-02-7" by="room@muc.this.example"
             xmlns="urn:xmpp:sid:0"/&gt;
  &lt;body&gt;Have you seen https://ralphm.net/blog/2013/10/10/logitech_t630?&lt;/body&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example"
         type="groupchat"&gt;
  &lt;stanza-id xmlns="urn:xmpp:sid:0"
             id="2019-09-02-8" by="room@muc.this.example"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-7"&gt;
    &lt;reference begin="14" end="61" xmlns="urn:example:reference:0"&gt;
      &lt;link url="https://ralphm.net/blog/2013/10/10/logitech_t630"/&gt;
    &lt;/reference&gt;
  &lt;/apply-to&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <p>Here the MUC service marks up the original messages with an explicit <code class="tag language-xml  element">link</code> reference. Possibly, the protocol might be extended so that a service can include shortened versions of the URL for display purposes.</p>

        <div class="message" id="message-7"><div class="meta"><span class="sender">
            ralphm
          </span><time class="timestamp" datetime="2019-09-02T14:11:36" title="Monday, 2 September 2019 at 14:11:36">13:16</time></div><div class="body">
            <p>Have you seen <a href="https://ralphm.net/blog/2013/10/10/logitech_t630" title="">https://ralphm.net/blog/2013/10/10/logitech_t630</a>?</p>

            <figure class="card">
              <figcaption><a href="https://ralphm.net/blog/2013/10/10/logitech_t630" title="">Logitech Ultrathin Touch Mouse</a></figcaption>
              <p>Logitech input devices are my favorite. This tiny bluetooth
                mouse is a nice portable device for every day use or while
                traveling.</p>
              
                <img src="/images/blog/ultrathin-touch-mouse-t630.jpg"/>
              
            </figure>
          </div></div>

        <p>The client has used the markup to fetch meta data on the URL and presents a summary card below the original message. Alternatively, the MUC service could have done this using <a href="https://xmpp.org/extensions/xep-0385.html" title="">XEP-0385: Stateless Inline Media Sharing (SIMS)</a>:</p>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example"
         type="groupchat"&gt;
  &lt;stanza-id xmlns="urn:xmpp:sid:0"
             id="2019-09-02-8" by="room@muc.this.example"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-7"&gt;
    &lt;reference begin="14" end="61" xmlns="urn:example:reference:0"&gt;
      &lt;link url="https://ralphm.net/blog/2013/10/10/logitech_t630"/&gt;
      &lt;card xmlns="urn:example:card:0"&gt;
        &lt;title&gt;Logitech Ultrathin Touch Mouse&lt;/ulink&gt;&lt;/title&gt;
        &lt;description&gt;Logitech input devices are my favorite. This tiny bluetooth mouse is a nice portable device for every day use or while traveling.&lt;/description&gt;
      &lt;/card&gt;
      &lt;media-sharing xmlns='urn:xmpp:sims:1'&gt;
        &lt;file xmlns='urn:xmpp:jingle:apps:file-transfer:5'&gt;
          &lt;media-type&gt;image/jpeg&lt;/media-type&gt;
          &lt;name&gt;ultrathin-touch-mouse-t630.jpg&lt;/name&gt;
          &lt;size&gt;23458&lt;/size&gt;
          &lt;hash xmlns='urn:xmpp:hashes:2' algo='sha3-256'&gt;5TOeoNI9z6rN5f+cQagnCgxitQE0VUgzCMeQ9JqbhWJT/FzPpDTTFCbbo1jWwOsIoo9u0hQk6CPxH4t/dvTN0Q==&lt;/hash&gt;
          &lt;thumbnail xmlns='urn:xmpp:thumbs:1'uri='cid:sha1+21ed723481c24efed81f256c8ed11854a8d47eff@bob.xmpp.org' media-type='image/jpeg' width='116' height='128'/&gt;
        &lt;/file&gt;
        &lt;sources&gt;
          &lt;reference xmlns='urn:xmpp:reference:0' type='data' uri='https://test.ralphm.net/images/blog/ultrathin-touch-mouse-t630.jpg' /&gt;
        &lt;/sources&gt;
      &lt;/media-sharing&gt;
    &lt;/reference&gt;
  &lt;/apply-to&gt;
&lt;/message&gt;</code></pre>
        </div></div>
      

      <h4>Editing a previous message</h4>
        

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/ralphm" type="groupchat"&gt;
  &lt;stanza-id id="2019-09-02-9" by="room@muc.this.example"
             xmlns="urn:xmpp:sid:0"/&gt;
  &lt;body&gt;Some thoughtful reply&lt;/body&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <div class="message" id="message-9"><div class="meta"><span class="sender">
            ralphm
          </span><time class="timestamp" datetime="2019-09-02T13:19:23" title="Monday, 2 September 2019 at 13:19:23">13:19</time></div><div class="body">
            <p>Some thoughtful reply</p>
          </div></div>

        <p>After sending that message, I want to add a bit more information:</p>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/ralphm" type="groupchat"&gt;
  &lt;stanza-id id="2019-09-02-10" by="room@muc.this.example"
             xmlns="urn:xmpp:sid:0"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-9"&gt;
    &lt;external name='body'/&gt;
    &lt;replace xmlns='urn:example:message-correct:1'/&gt;
  &lt;/apply-to&gt;
  &lt;body&gt;Some more thoughtful reply&lt;/body&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <p>Unlike <a href="https://xmpp.org/extensions/xep-0308.html" title="">XEP-0308: Last Message Correction</a>, this example uses Fastening to refer to the original message. I would also lift the restriction on correcting just the last message, but allow any previous message to be edited.</p>

        <div class="message" id="message-9"><div class="meta"><span class="sender">
            ralphm
          </span><time class="timestamp" datetime="2019-09-02T13:19:23" title="Monday, 2 September 2019 at 13:19:23">13:19</time></div><div class="body">
            <p>Some more thoughtful reply<span class="edited" datetime="2019-09-02T13:22:02" title="Monday, 2 September 2019 at 13:22:02"/></p>
          </div></div>

        <p>Upon receiving the correction, the client indicates that the
          message has been edited. Hovering over the marker reveals when the
          message was changed.</p>

      

      <h4>Editing a previous message that had fastened references</h4>
        

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/Kev" type="groupchat"&gt;
  &lt;stanza-id id="2019-09-02-11" by="room@muc.this.example"
             xmlns="urn:xmpp:sid:0"/&gt;
  &lt;body&gt;A witty response mentioning @ralphm&lt;/body&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example"
         type="groupchat"&gt;
  &lt;stanza-id xmlns="urn:xmpp:sid:0"
             id="2019-09-02-12" by="room@muc.this.example"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-11"&gt;
    &lt;reference begin="28" end="34" xmlns="urn:example:reference:0"&gt;
      &lt;mention jid="room@muc.this.example/ralphm"/&gt;
    &lt;/reference&gt;
  &lt;/apply-to&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <div class="message" id="message-11"><div class="meta"><span class="sender">
            Kev
          </span><time class="timestamp" datetime="2019-09-02T13:26:19" title="Monday, 2 September 2019 at 13:26:19">13:26</time></div><div class="body">
            <p>A witty response mentioning <a href="/ralphm">@ralphm</a></p>
          </div></div>

        <p>After a bit of consideration, Kev edits his response:</p>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example/Kev" type="groupchat"&gt;
  &lt;stanza-id id="2019-09-02-13" by="room@muc.this.example"
             xmlns="urn:xmpp:sid:0"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-11"&gt;
    &lt;external name='body'/&gt;
    &lt;replace xmlns='urn:example:message-correct:1'/&gt;
  &lt;/apply-to&gt;
  &lt;body&gt;A slighty wittier response mentioning @ralphm&lt;/body&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <div class="message" id="message-11"><div class="meta"><span class="sender">
            Kev
          </span><time class="timestamp" datetime="2019-09-02T13:26:19" title="Monday, 2 September 2019 at 13:26:19">13:26</time></div><div class="body">
            <p>A slightly wittier response mentioning @ralphm<span class="edited" datetime="2019-09-02T13:29:08" title="Monday, 2 September 2019 at 13:29:08"/></p>
          </div></div>

        <p>Upon receiving the correction, the client discards all fastened
          references. The body text was changed, so the reference indices are
          stale. The room can then send a new stanza marking up the new
          text:</p>

        <div class="example"><div class="body">
          <pre><code class="language-xml">&lt;message from="room@muc.this.example"
         type="groupchat"&gt;
  &lt;stanza-id xmlns="urn:xmpp:sid:0"
             id="2019-09-02-14" by="room@muc.this.example"/&gt;
  &lt;apply-to xmlns="urn:xmpp:fasten:0"
            id="2019-09-02-11"&gt;
    &lt;reference begin="40" end="46" xmlns="urn:example:reference:0"&gt;
      &lt;mention jid="room@muc.this.example/ralphm"/&gt;
    &lt;/reference&gt;
  &lt;/apply-to&gt;
&lt;/message&gt;</code></pre>
        </div></div>

        <div class="message" id="message-11"><div class="meta"><span class="sender">
            Kev
          </span><time class="timestamp" datetime="2019-09-02T13:26:19" title="Monday, 2 September 2019 at 13:26:19">13:26</time></div><div class="body">
            <p>A slightly wittier response mentioning <a href="/ralphm">@ralphm</a><span class="edited" datetime="2019-09-02T13:29:08" title="Monday, 2 September 2019 at 13:29:08"/></p>
          </div></div>

      

      <h4>Closing notes</h4>
        

        <ul>
          <li><p>Fastening should also gain a way to unfasten
              explicitly. I <em>think</em> that should use the
              stanza ID of the stanza that included the earlier fastening. This
              allows for undoing individual emoji reactions.</p></li>
          <li>Unfastening should probably not use the proto-XEP on <a href="https://xmpp.org/extensions/inbox/message-retraction.html" title="">Message
              Retraction</a>. That is for retracting the entire original
            message plus all its fastened items, and invalidating all message
            references pointing to it.</li>
          <li><p>It might make sense to have a separate document
              describing how to handle stanza IDs, so that all specifications
              could point to it instead of each having their own algorithm. In
              different contexts, different IDs might be used. The other
              proposal for attachments, <a href="https://xmpp.org/extensions/xep-0367.html" title="">XEP-0367:
                Message Attaching</a>, has a section (4.1) on this
              that might be taken as a start.</p></li>
          <li>
            <p>In the discussion leading up to this post, a large
              part was about how to handle all these things attached/fastened
              to messages in message archives. This is not trivial, as you
              likely don't want to store a sequence of stanzas, but of
              (original) messages. Each of those message then might have one or
              more things fastened to it, and upon retrieval, you want these to
              come along when retrieving a message. Some of these might be
              collated, like edits. Some might cause summary counts (emoji,
              simple polls) with the message itself, and require an explicit
              retrieval of all the reactions, e.g. when hovering the reaction
              counts.</p>
            <p>Details on message archive handling is food for a later post.
              I do think that having a single way of attaching/fastening things
              to messages makes it much easier to come up with a good solution
              for archive handling.</p>
          </li>
          <li><p>I didn't provide examples for <a href="https://xmpp.org/extensions/xep-0420.html" title="XEP-0420: Stanza Content Encryption">stanza
                encryption</a>, but discussions on this suggested that
              stanzas with fastened items would have an empty
              <code class="tag language-xml  element">apply-to</code>, including the <code class="tag language-xml attribute">id</code> attribute, so that message archives
              can do rudimentary grouping of fastened items with the original
              message.</p></li>
          <li><p>I didn't include examples on <a href="https://xmpp.org/extensions/xep-0333.html" title="XEP-0333: Chat Markers">Chat Markers</a>, as its
              current semantics are that a marker sent by a recipient applies
              to a message <em>and all prior messages</em>. This
              means the marker isn't really tied to a single message. I think
              this doesn't match the model for Message
              Fastening.</p></li>
      </ul> 

      

    ]]&gt;</content:encoded></item><item><title>Changes</title><link>http://ralphm.net/blog/2016/12/23/changes</link><dc:date>2016-12-23T14:28:28+01:00</dc:date><description>
          Christmas and Jabber go well together and lead up to another
            year starting off with the XMPP Summit and FOSDEM, with more
            change in the MIX.
        </description><content:encoded>&lt;![CDATA[<p><i>Throwing everything in the MIX…</i></p>
      

      <p>For me, Christmas and Jabber/XMPP go together. I started being
        involved with the Jabber community around the end of 2000. One of the
        first things that I built was a bot that recorded the availability
        presence of my online friends, and show this on a Christmas tree.
        Every light in the tree represents one contact, and if the user is
        offline, the light is darkened.As we are nearing Christmas, I put the
        tree up on the <a href="/" title="">frontpage</a> again, as many years
        before.</p>
      
      <p>Over the years, the tooltips gained insight in User Moods and
        Tunes, first over regular Publish-Subscribe, later enhanced with the
        Personal Eventing Protocol. A few years later, <a href="http://www.saint-andre.com/jabber/journal/2005-12-19.html" title="">Jingle
          was born</a>, and in 2009, stpeter wrote a <a href="http://xmpp.org/extensions/xep-0169.html" title="">great
          specification</a> that solidifies the relationship between
        Christmas and Jabber/XMPP.</p>

      <p>Many things have changed in those 16 years. I've changed jobs
        quite a few times, most recently switching from the Mailgun team at
        Rackspace, to an exciting new job at VimpelCom as <em>Chat
          Expert</em> last April, working on <a href="http://www.reuters.com/article/us-telecoms-vimpelcom-idUSKBN12Z1ZE" title="">Veon</a>
        (more on that later). The instant messaging landscape has changed
        quite a bit, too. While we, unfortunately, still have a lot of
        different incompatible systems, a lot of progress has been made as
        well.</p>
        
      <p>XMPP's story is long from over, and as such I am happy and honored
        to serve as Chair of the XMPP Standards Foundation since last month.
        As every year, my current focus is making another success of the
        <a href="https://wiki.xmpp.org/web/Summit_21" title="">XMPP Summit</a>
        and our presence with the Realtime Lounge and Devroom at FOSDEM in
        Brussels in February. This is always the highlight of the year, with
        many XMPP enthousiasts, as well as our friends of the wider Realtime
        Communications, showing and discussing everything they are working
        on, ranging from protocol discussions to WebRTC and IoT
        applications.</p>

      <p>Like last year, one of the topics that really excite me is the
        specification known as <a href="http://xmpp.org/extensions/xep-0369.html" title="">Mediated Information
          eXchange (MIX)</a>. MIX takes the good parts of the Multi User
        Chat (MUC) protocol, that has been the basis of group chat in XMPP for
        quite a while, redesigned on top of XMPP Publish-Subscribe. Modern
        commercial messaging systems, for business use (e.g. Slack and
        HipChat), as well as for general use (e.g.  WhatsApp, WeChat, Google's
        offerings), have tried various approaches on the ancient model of
        multi-part text exchange, adding multi-media and other information
        sources, e.g. using <em>integrations</em>, bots, and
        cards.</p>

      <p>MIX is the community's attempt to provide a building block that
        goes beyond the tradional approach of a single stream of
        information (presence and messages) to a collection of
        orthogonal information streams in the same context.
        A room participant can select (manually or automatically by the user
        agent) which information streams are of interest at that time. E.g.
        for mobile use or with many participants, exchanging the presence
        information of all participants can be unneeded or even expensive (in
        terms of bandwidth or battery use). In MIX, presence is available as a
        separate stream of information that can be disabled.</p>

      <p>Another example is Slack's integrations. You can add streams of
        information (Tweets, continuous integration build results, or pull
        requests) to any channel. However, all participants have no choice to
        receive the resulting messages, intermixed with discussion. The
        client's notification system doesn't make any distinction between the
        two, so you either suffer getting alerts for every build, or mute the
        channel and possibly miss interesting discussion. The way around it is
        to have separate channels for notifications and discussion, possibly
        muting the former.</p>

      <p>Using MIX, however, a client can be smarter about this. It can
        offer the user different ways to consume these information streams.
        E.g. notifications on your builds could be in a side bar. Tweets can
        be disabled, or modeled as a ticker. And it can be different depending
        on which of the (concurrent) clients you are connected with. E.g. the
        desktop or browser-based client has more screen real-estate to show
        such orthogonal information streams at the same time, a mobile client
        might still show the discussion and notifications interleaved.</p>
          
      <p>All-in-all MIX allows for much richer, multi-modal, and more
        scalable interactions. Some of the other improvements over MUC include
        persistent participation in channels (much like IRC bouncers, but
        integrated), better defined multi-device use (including individual
        addressing), reconnection, and message archiving. I expect the
        discussions at the XMPP Summit to tie the loose ends as a prelude to
        initial implementations.</p>

      <p>I am sure that FOSDEM and the XMPP Summit will have many more
        exciting topics, so I hope to see you there. Until then, Jabber
        on!</p>

    ]]&gt;</content:encoded></item><item><title>Logitech Ultrathin Touch Mouse</title><link>http://ralphm.net/blog/2013/10/10/logitech_t630</link><dc:date>2013-10-10T14:00:37+02:00</dc:date><description>
          Logitech input devices are my favorite. This tiny bluetooth
            mouse is a nice portable device for every day use or while
            traveling.
        </description><content:encoded>&lt;![CDATA[<p><i>But does it work with Linux?</i></p>
      

      <div style="float: right; margin-left: 10px;">
        
          <img src="/images/blog/ultrathin-touch-mouse-t630.jpg"/>
        
      </div>

      <p>Logitech is my brand of choice for input devices. Unfortunately,
        though, Logitech seems to focus on their unifying receiver for most of
        their stuff, to the detriment of their Bluetooth offering. Every now
        and then, they do come out with a nice Bluetooth device, usually
        targetting ultrabooks or tablets. Last month I stumbled upon the new
        <a href="http://www.logitech.com/en-us/product/ultrathin-touch-mouse-t630" title="">Logitech
          Ultrathin Touch Mouse (t630)</a>. As usual, it is marketed for
        Windows compatibility, with Linux officially not supported. They do
        have a second model targetted to Mac users with the <a href="http://www.logitech.com/en-us/product/ultrathin-touch-mouse-t631" title="">t631</a>,
        but I suspect the only difference is its color.</p>

      <p>Fortunately, this device mostly works fine on my Ubuntu 13.04
        laptops. Plural, because this tiny mouse can be set up to pair with two
        devices, switchable with a switch on the bottom. The only problem is
        that, out-of-the-box, <code class="literal">gnome-bluetooth</code> cannot
        reconnect with the device when it has been powered down or switched
        back from the other channel. It turns out that Logitech might not be
        following standards, and requires repairing every time. In my search
        for similar cases, I found a bug report for another device that has had
        similar issues, and the solution presented there also works for the
        Ultrathin Touch Mouse.</p>

      <p>The trick is to tell <code class="literal">gnome-bluetooth</code> to always
        send the pincode (<code class="literal">0000</code>, as usual) upon
        connecting. For this, it needs an entry in <kbd class="filename">/usr/share/gnome-bluetooth/pin-code-database.xml</kbd> like this:</p>

      <div class="example"><div class="body">
        <pre><code>
&lt;!-- Logitech Ultrathin Touch Mouse --&gt;
&lt;device oui="00:1F:20:" name="Ultrathin Touch Mouse" pin="0000"/&gt;</code></pre>
      </div></div>

      <p>I filed a <a href="https://bugs.launchpad.net/ubuntu/+source/gnome-bluetooth/+bug/1237355" title="">bug report</a>
        to have this included by default. After adding the entry, add the mouse as a new input device and it should work as expected.</p>

      <p>On to the mouse' features. Besides detecting motion with its bottom
        laser, the surface is a touch pad that can be depressed as a whole.
        Pressing in the top left and top right corner will trigger the left and
        right mouse button events (button 1 and 3). To do a middle-click, you
        have to press in the center of the touch pad, not at the top middle, as
        you'd expect. Vertical and horizontal scrolling can be done with swipe
        gestures, respectively up/down and left/right. This will trigger
        buttons 4 through 7.</p>

      <p>On top of that, there are some additional gestures, which Logitech
        has pictured in a <a href="http://www.logitech.com/assets/50008/t630-touch-gestures-guide.pdf" title="">handy
          overview</a>. First, there is a two-finger left or right swipe
        for doing previous and next actions.  In X11 this will trigger buttons
        8 and 9, and Firefox, for example, will respond to move back and forth
        in a tab's history. The other three gestures generate keyboard events,
        instead of the usual mouse events. A double-finger double-tap yields a
        press and release of the <code class="literal">Super_L</code> key. In Unity this
        brings up the dash home by default. Finally there are swipes from the
        left edge and from the right edge. The former triggers <code class="literal">Ctrl_L
          Super_L Tab</code>, which switches between the two last used tabs
        in Firefox, the latter <code class="literal">Alt_L Super_L
          XF86TouchpadOff</code>, which doesn't have a default action bound
        to it, as far as I can tell. Logitech also mentions the single-finger
        double tap, but that doesn't seem to register any event in the input
        handler.</p>

      <p>The mouse can be charged with via its micro-USB connector, also on
        the bottom, with a convenient short USB cable in the box. The micro-USB
        connector on that cable is also angled so the mouse doesn't have to be
        upright when charging. The battery state is reported to the kernel, but
        there is another bug in <code class="literal">upower</code> that will make
        batteries in bluetooth input devices show up as laptop
        batteries.</p>

      <p>Having used the mouse for a few days now, I like it a lot. It is
        really tiny, but not in a bad way (for me). The two-finger swipe
        gestures are a bit tricky to get right, but I don't really use them
        anyway. I also tried hooking it up to my Nexus 7, and that works
        nicely. All-in-all a great little device, especially while
        travelling.</p>

    ]]&gt;</content:encoded></item><item><title>Using ElasticSearch and Logstash to Serve Billions of Searchable Events for Customers</title><link>http://ralphm.net/blog/2013/10/10/elasticsearch_mailgun</link><dc:date>2013-10-10T13:47:20+02:00</dc:date><description>
          Having recently moved to work for Rackspace on the Mailgun
            team, I wrote a detailed post on our use of Elasticsearch for
            making customer mail logs available.
        </description><content:encoded>&lt;![CDATA[<p><i>Another real-time technology</i></p>
      

      <div style="float: right; margin-left: 10px;">
        
          <img src="/images/blog/needle_in_a_haystack.jpg"/>
        
      </div>

      <p>Kicking off the revival of this publication, I recently did a guest
        post on our use of <a href="http://elasticsearch.org/" title="">Elasticsearch</a> at <a href="http://www.mailgun.com/" title="">Mailgun</a>. Since I have joined
        the Mailgun team at Rackspace in May, my primary project was to
        reimplement the Mailgun customer logs so that we can <a href="http://www.elasticsearch.org/blog/using-elasticsearch-and-logstash-to-serve-billions-of-searchable-events-for-customers/" title="">serve
          billions of searchable events</a>. Head over to the <a href="https://news.ycombinator.com/item?id=6477062" title="">HackerNews
          page</a> for some additional details.</p>

    ]]&gt;</content:encoded></item><item><title>Activity Streams in practice</title><link>http://ralphm.net/blog/2011/02/02/activitystreams</link><dc:date>2011-02-02T20:50:43+01:00</dc:date><description>
          How we use ActivityStreams in anyMeta as a concept, format for
            Federated notifications and over XMPP for real-time use.
				</description><content:encoded>&lt;![CDATA[<p><i>What are they doing?</i></p>
			

      <p>Atom and RSS feeds are typically used to support syndication of
        existing works, most commonly weblog entries. They are XML documents
        that provide a common representation that can be consumed by feed
        readers, unlike the HTML pages for such a work. <a href="http://activitystrea.ms/" title="">ActivityStreams</a> is <q>a
          format for syndicating social activities around the web</q>.
        Based on the Atom Syndication Format, it tries to provide a feed for
        activities, rather than existing works. This includes the
        <em>act</em> of posting a blog entry, but can also express
        activities typical for social networking sites, like adding friends,
        <em>liking</em> something or affirming an RSVP for an
        event.</p> 

      <p>At <a href="http://www.mediamatic.nl/" title="">Mediamatic Lab</a>,
        we've recently gave notifications an overhaul. We had some code
        scattered around for sending notices to users, like when they received
        a friend request. We wanted to add a bunch of notifications so that
        people are aware of what happens in the network of sites, with their
        profile or works they've created. For example, when someone tags a
        person as being in a picture, it would be nice for that person to get a
        message about that. We also have a collection of RFID-enabled
        Interactive Installations that generate XMPP notifications for our
        backchannel system. I'll come back on this.</p>

      <p>Whenever something happens that you want to send a notification
        for, there are a couple of things that you want to include in the
        notification: what happened, when it happened, and which persons and/or
        things are involved. The concepts of ActivityStreams turned out to
        coincide with how we wanted the notification to work. It abstracts
        activities in actors, objects and targets, along with a human-readable
        text to describe each activity.</p>

      <p> A verb is an identifier for the kind of activity that has taken
        place. A verb takes the form of a URI, much like <code class="literal">rel</code>
        attributes in Atom link elements, or properties in RDF. The most basic
        verb is <code class="literal">post</code>, with the URI
        <code class="literal">http://activitystrea.ms/schema/1.0/post</code>.</p>

      <p>An actor is the (usually) person that has performed the activity.
        Objects are the main persons or things that the activity was performed
        upon.  For example, when I post a picture, I am the actor, and the
        picture is the object. A target is an object an action was done to. An
        example could be the photo album my uploaded picture was posted to.
        Actors, objects and targets usually have a URI, a title and an object
        type, similar to RDF classes.</p>

      <p>Our new notification system does a couple of things whenever a an
        activity has taken place. It figures out the verb, actor, object and
        possibly the target and then creates a notification entry. It then
        calculates the parties that should get this notification in their
        inbox. This is usually the actor and the owner of the object. A
        person's profile is always owned by itself, so when the object is a
        person, that person would get a notification on things happening to
        them. When a party is not local (i.e. on another site in the
        federation), the notification is sent to the other site to be processed
        there. Each person's inbox is viewable as a stream of activities, much
        like Jaiku or Facebook, and is also published as an ActivityStreams
        feed (e.g. <a href="http://www.mediamatic.nl/person/feed/24879" title="">ralphm's
          activities</a>. New notifications can then be processed by other
        modules.</p> 

      <p>One of them is the Message module, that sends out e-mails for
        notifications, according to personal preferences. For now, you can
        choose what kind of notifications you want to receive an e-mail about,
        by choosing the verbs you are interested in. Examples currently
        include: friend requests/confirmations, changes to things you own,
        people liking, linking to, RSVPing (for events), sharing (to Twitter,
        Facebook, etc) or commenting on things you own, and people tagging you
        in a picture.</p>

      <p>Another module is the Publish-Subscribe module, that provides
        <a href="http://xmpp.org/extensions/xep-0060.html" title="">XMPP
          Publish-Subscribe</a> nodes for each person, along with a node
        for all notifications for that site. This allows for applications that
        use the stream of activities for a person or the whole site, in
        near-real-time.  An example could be a mobile app to track activity for
        you and/or your friends, or IM notifications much like Identi.ca or
        Jaiku.</p>

      <p>Another possibility is a <a href="http://www.mediamatic.nl/page/8371" title="">backchannel</a>. We
        developed a backchannel system for events we deploy our <a href="http://www.mediamatic.nl/page/26657" title="">RFID-enabled Interactive
          Installations</a> at. A backchannel feed is aggregated from a
        configurable set of sources, of which the incoming items are formatted
        into notifications to be put up on a live stream. Every time someone
        takes a (group) picture with our <a href="http://www.mediamatic.nl/ikcam" title="">ikCam</a>, the image is
        posted on the backchannel, along with a text listing the people in the
        picture.</p>
      
      <p>On top of that, we also can include tweets by tracking particular
        keywords and people. We use (and improved) <a href="http://github.com/ralphm/twitty-twister" title="">twitty-twister</a>
        to interact with Twitter's Streaming API from Twisted. I've recently
        changed the streaming code of twisty-twitter to consume JSON instead of
        the deprecated XML (with a bunch of tests), and a way to detect
        unresponsive connections.</p>

      <p>With activities now also available as XMPP notifications, the
        logical step was to consume these for the backchannel as well. We have
        an <a href="http://display.mediamatic.nl:8000/" title="">office
          backchannel</a> on a big screen that tracks Twitter for keywords
        related to Mediamatic and its events, and the notifications from our
        interactive installations. It now also includes activity on our sites,
        and this turns out to be a great way to see everything happening in our
        sites.</p>

      <p>So, did it all go smoothly? No. We found quite some things in the
        ActivityStreams' concepts in combination with anyMeta and our
        interactive installations that we didn't expect when we started the
        project.</p>

      <p>One of the big ones was Agents. Our interactive installations have
        their own user accounts to take pictures, process votes, etc. These
        accounts have special privileges to perform actions like making all
        people in an ikCam picture contacts in the network. We also have a
        Physical I-like-it button, which is an RFID reader placed next to a
        physical object (e.g. a painting) that has a representation in one of
        the sites. When reading a tag, it creates a <em>like</em>
        relationship between the holder of the RFID tag and the object. When we
        just enabled the first enabled the new notifications functionality, a
        message popped up on the backchannel: <q>ikPoll Agent likes
          iTea</q>.</p>

      <p>That was quite unexpected but quite logical when we thought about
        it. ikPoll Agent is the user account for the I-like-it button, that is
        powered by the same software as our more generic ikPoll installations.
        We defaulted the actor of an activity to the user account performing
        the action. Although the agent creates a link from the person to the
        object, the link was not created on behalf of the physical user. So we
        needed to introduce the concept of Agents, and have that also stored
        and communicated along with activities. The same action would now yield
        an entry with the title 'ralphm likes iTea (via ikPoll Agent).</p>

      <p>Another was pictures taken with the ikCam. Besides posting the
        image, all actors are tagged in the picture, the picture is optionally
        linked to an event and a location. This yields a bunch of
        notifications, where we would like to have only one: <q>ralphm took
          a self-portrait</q>. We have started work on compound activities
        that would have the enclosed activities linked to it and back, a bit
        like the <a href="http://www.faqs.org/rfcs/rfc4685.html" title="">Atom
          Threading Extension.</a>. This would allow aggregators like the
        backchannel only show the umbrella notification.</p>

      <p>A final one was our verb <code class="literal">link</code>. This was supposed
        to be a catch-all verb for the activity of creating a semantic link
        between two things, of which the predicate didn't already have its own
        verb (like friending, liking, etc.). It now looks like having a
        notification like 'person A linked to thing B' might need some more
        information. An e-mail notification at least has the links to
        respective pages, but that doesn't quite work on a backchannel beamed
        on a big screen. For now we ignore such notifications for the
        backchannel, until we have a better solution. It might be that we need
        to include the link's predicate in the notification, or make links
        themselves first-class citizens (with their own URI).</p>

      <p>Going to FOSDEM and/or the <a href="http://xmpp.org/participate/the-xmpp-summit/xmpp-summit-10/" title="">10th
          XMPP Summit</a> in Brussels? I'll be talking about this and other
        topics in my talk on Federating Social Networks on Saturday 5
        February.</p>

		]]&gt;</content:encoded></item><item><title>Apple Notification Server = Idavoll</title><link>http://ralphm.net/blog/2010/01/14/apple_uses_idavoll</link><dc:date>2010-01-14T16:23:11+01:00</dc:date><description>
          Apple Notification Server turns out to be based on Idavoll, a
            generic XMPP publish-subscribe service.
				</description><content:encoded>&lt;![CDATA[<p><i>Pushing ahead...</i></p>
			

      <p>Last week, <a href="http://romeda.org/">Blaine Cook</a>
        congratulated me on <a href="http://idavoll.ik.nu/" title="">Idavoll</a>
        being in Apple Mac OS 10.6 Server, as its Notification Server. I did
        have contact with Apple's server team ages ago, about them using
        Idavoll and having added some customizatons, but never knew where it
        ended up. The <a href="http://www.apple.com/opensource" title="">list of Open
          Source projects used in Apple's products</a> confirms the use of
        Idavoll, and <a href="http://wokkel.ik.nu/" title="">Wokkel</a>, too, as
        a dependency of Idavoll. Cool!</p>

      <p>Idavoll, and thus Notification Server, is a generic XMPP
        publish-subscribe service, in Python with Twisted. Upon inspection of
        the code and the differences against the mentioned versions, most of
        the customizations match those I was already aware of: an SQLite
        backend, the whitelist <a href="http://xmpp.org/extensions/xep-0060.html#accessmodels" title="">node
          access model</a> and associated member affiliations. The link to
        Notification Server at the open source list goes nowhere (yet), so I am
        unsure about the actual license of their additions. I contacted the
        server team, and will write again if I have more news on this.</p>

      <p>At the nice post by Jack Moffitt on <a href="http://metajack.im/2010/01/13/even-apple-uses-xmpp/" title="">Apple's use
          of XMPP</a>, Kael mentions the presence of more
        <a href="http://trac.calendarserver.org/browser/CalendarServer/branches/users/sagen/xmpp/twistedcaldav/notify.py?rev=2684#L433" title="">Publish-Subscribe
          goodness in Calendar Server</a>. This is actually the stuff that
        uses Notification Server for <a href="http://www.appleinsider.com/articles/09/02/11/iphone_push_notification_server_tied_to_snow_leopard_server.html&amp;page=2" title="">push
          notification in iCal</a>. As Jack says, it is truly great to see
        large corporations like Apple to embrace XMPP like this. I really wish
        Google Calendar had a similar feature. Now I only get meeting invites
        through e-mail. Apple's particular use of Publish-Subscribe reminds me of
         Joe Hildebrand's effort on <a href="http://xmpp.org/internet-drafts/draft-hildebrand-webdav-notify-02.html" title="">WebDAV
           notifications</a>, and I think that there are a lot of
         applications that could benefit from such push features.</p>
      
       <p>As I <a href="http://ralphm.net/blog/2009/07/19/twisted_mediamatic" title="">touched
           upon earlier</a>, at <a href="http://www.mediamatic.nl/" title="">Mediamatic Lab</a>, we use XMPP
         Publish-Subscribe for exchanging <em>things</em> for
         federation. But we've also built a bunch of interactive installations,
         most of them dealing with RFID tags we call <a href="http://www.mediamatic.nl/iktag" title="">ikTag</a>s. To name two
         examples, the <a href="http://www.mediamatic.nl/ikcam" title="">ikCam</a> takes a (group)
         picture, uploads it and friends the depicted persons by <a href="http://www.mediamatic.net/page/129066" title="">reading</a> their
         tags. The <a href="http://www.mediamatic.nl/ikpoll" title="">ikPoll</a>
         is a polling station where people can 'vote' on questions with the
         tag. Typically, there are also publish-subscribe notifications coming
         out of those interactions, so you can create a <a href="http://www.flickr.com/photos/bas-boerman/3948163089" title="">live
           stream</a> of things happening at an event like PICNIC. Combined
         with the <a href="http://apiwiki.twitter.com/Streaming-API-Documentation" title="">Twitter
           Streaming API</a> and our own status messages, this creates an
         entertaining back channel, coincidently powered by Idavoll.</p>


		]]&gt;</content:encoded></item><item><title>Jewish Monument Changes</title><link>http://ralphm.net/blog/2009/12/17/jhm_changes</link><dc:date>2009-12-17T14:46:15+01:00</dc:date><content:encoded>&lt;![CDATA[<p><i>An exercise in semantic web relationships...</i></p>
			

      <p>Two exciting projects I've been recently working on at <a href="http;//www.mediamatic.nl/" title="">Mediamatic Lab</a> are two highly
        connected sites around the Jewish Community in the Netherlands during
        World War Ⅱ. The first is one of the oldest sites we have made, the
        <a href="http://www.joodsmonument.nl/" title="">Digital Monument</a>.
        This site contains verified information on all of the Dutch jews that
        have died during WWⅡ along with their households, documented posessions
        and known documents and pictures. It is maintained by a team of editors
        of the <a href="http://www.jhm.nl/" title="">Jewish Historical
          Museum</a>.</p>
     
      <p>The second is a brand new <a href="http://www.jewishmonument.nl/" title="">community site</a>, to
        complement the Monument by allowing anyone to add new information,
        pictures and stories on people at the Monument.</p>

      <p>The Monument is very impressive, as I learned back at the first
        <a href="http://barcamp.org/BarCampAmsterdam" title="">BarCamp
          Amsterdam</a>, hosted by Mediamatic. You will know what I mean if
        you spend a little as five minutes paging through the site.  Today,
        however, I want to talk about the technology behind both sites.</p>

      <h4>Data Model Changes</h4>
        

        <p>The data in the Monument is highly semantic in nature. People are
          part of households, as head-of-family, spouse, son or daughter. Or
          some other relation. Households have a location and lists of
          possessions.  Tied to all of these are supporting documents and
          pictures. In <a href="http://www.anymeta.net/" title="">anyMeta</a>,
          all of these are modeled as <em>thing</em>s with
          <em>edge</em>s between them with a certain predicate. A
          typical household would be modelled like this:</p>
        

        
          <img src="/images/blog/jhm_old_model.png"/>
        
        
        <p>For the community site, however, we wanted to have more direct
          relationships between people: parent-child relations, sibling
          relations, partner relations and a more generic (extended) family
          relationship. As the community also has most things of the monument
          imported, this meant a change in the data model and a subsequent
          conversion in the monument.</p>
          
        <p>In anyMeta, (almost) everything is a thing. As such, the
          predicate on an edge between two things is also represented by a
          thing. This has traditionally been named <em>role</em>.
          Like all things in an anyMeta site have a <em>resource
            URI</em>, the resource URI of a role is the predicate's URI.
          We try to use existing (RDF) vocabularies as much as possible for
          this.</p>

        <p>For relationships between people, we've used the
          <code class="literal">knowsOf</code> and <code class="literal">friendOf</code> properties
          from <a href="http://vocab.org/relationship" title="">RELATIONSHIP</a>,
          used in FOAF. So this was the first place to look for the desired new
          predicates. However, this vocabulary does not have a property for
          expressing a generic extended family relationship. Fortunately,
          <a href="http://gmpg.org/xfn/" title="">XFN</a> has the
          <code class="literal">kin</code> relationship type, along with
          <code class="literal">child</code>, <code class="literal">parent</code>,
          <code class="literal">spouse</code> and <code class="literal">sibling</code>.
          Richard Cyganiak described how to <a href="http://vocab.sindice.com/xfn" title="">express XFN relations in
            RDF</a>, so we used that to base our predicates on.</p>

        <p>Like RELATIONSHIP, most of the XFN properties are subproperties
          of the <code class="literal">foaf:knows</code> property, and have some
          hierarchy themselves, too. In anyMeta, we didn't have the concept of
          subproperties, yet, so we added a new role for expressing subproperty
          relationships between roles, and introduced the concept of
          <em>implicit edges</em>. These are edges with a
          superpredicate of the explicit edge that is being created. For
          example, the <code class="literal">xfn:child</code> property is a subproperty
          of <code class="literal">foaf:knows</code>. Whenever an edge between two people
          gets created with the child role, another implicit one with the knows
          role is added, too.</p>

        <p>After conversion and with the implicit edges present, the new
          data model of the example above looks like this:</p>

        
          <img src="/images/blog/jhm_new_model.png"/>
        

        <p>The blue arrows are the new, derived edges. A spouse edge is made
          between those people that respectively have a head-of-family and
          partner relation to the same household (this can be assumed to be
          correct for this dataset). For person that have a son or daugther
          edge to a household, a child edge is made from the head-of-family and
          partner persons (if any) in that household to this person. We haven't
          (yet) added derived sibling edges, as this relation depends on the
          parents of both persons, too.</p>

        <p>You can also see gray, dashed edges. These are the implicit edges
          that follow from the property hierarchy. Another thing to notice, is
          that the biographies are gone. We put the texts in there directly on
          the persons and households, instead.</p>

        <p>Besides the regular pages of all people, households and other
          things, you can also use our semantic browser to look at the
          relationships between things. For example, <a href="http://www.joodsmonument.nl/page/382750" title="">Mozes and his
            family</a> can be browsed from <a href="http://www.joodsmonument.nl/browse/382750" title="">here</a>.</p>

      

		]]&gt;</content:encoded></item><item><title>Twisted at Mediamatic</title><link>http://ralphm.net/blog/2009/07/19/twisted_mediamatic</link><dc:date>2009-07-19T16:45:59+02:00</dc:date><description>
          A story on how Mediamatic use Twisted for making friends,
            finding stories behind physical objects and poll people. Oh, and
            casually adding social networking federation in the mix.
        </description><content:encoded>&lt;![CDATA[<p><i>How Georgious is Twisted?</i></p>
      

      <p>Even before I got to work for <a href="http://www.mediamatic.nl/" title="">Mediamatic Lab</a>, Mediamatic
        was using <a href="http://www.twistedmatrix.com/" title="">Twisted</a>.
        My friend <a href="http://term.ie/blog/">Andy Smith</a> used it
        for a bunch of projects around physical objects, usually involving some
        kind of RF tags. Examples include the <a href="http://www.mediamatic.nl/page/218" title="">Symbolic Table</a> and
        the <a href="http://www.mediamatic.nl/page/219" title="">Friend Drinking
          Station</a>.  From this grew <a href="http://launchpad.net/fizzjik" title="">fizzjik</a>, a Twisted based
        library that implements support for several kinds of RFID readers,
        network monitoring and access to online services like Flickr and of
        course <a href="http://www.anymeta.net/" title="">anyMeta</a>.</p>

      <p>On the other hand, I have dabbled in Twisted for quite a while now,
        mostly contributing XMPP support in Twisted Words and through the
        playground that is known as <a href="http://wokkel.ik.nu/" title="">Wokkel</a>. But why go through all
        that effort, while there are a several different Python-based XMPP
        implementations out there? And why does Mediamatic use Twisted? Why do
        I believe Twisted is <em>awesome</em>?</p>

      <p>First of all, we like Python. It is a great little language with
        extensive library support (<q>batteries included</q>), where
        everything is an object. Much like in anyMeta. It is a language for
        learning to program, to code small utility scripts, but also for entire
        applications.</p>

      <p>But going beyond that, building applications that interact with
        different network protocols and many connections all at the same time
        is a different story. Many approach such a challenge by using preemtive
        threading. Threads are hard. Really hard. And Python has the GIL,
        allowing the interpreter to only execute byte codes in one thread at a
        time.</p>

      <p>So in comes Twisted. Twisted is a framework for building networked
        applications in Python, through a concept known as cooperative
        multitasking. It uses an event loop that hands off processing of events
        (like incoming data on a socket or a timer going off) to non-blocking
        functions. Events loops are mostly known from GUI toolkits like GTK,
        and so Twisted goes even beyond networking by working with such
        toolkits' event loops, too. As most network protocol implementations
        only have a synchronous interface (i.e. one that blocks), Twisted
        includes asynchronous implementations of a long list of network
        protocols. For the blocking interfaces that come from C libraries, like
        databases, Twisted provides a way to work with
        <em>their</em> threads, while keeping all your controlling
        code in the main thread. Asynchronous programming does take some
        getting used to, hence Twisted's name.</p>

      <p>So how do we use Twisted? Well, a recent application is our recent
        RFID polling system. It allows people to use their ikTag (or any card
        or other object with a Mifare tag), tied to their user account on an
        anyMeta site, to take part in a poll by having their tag read at an
        RFID reader corresponding to a possible answer. The implementation
        involves:</p>

      <ul>
        <li><p>Communication with one or more RFID readers (that
            also have output capabilities for hooking up lamps, for
            example).</p></li>
        <li><p>Communication over HTTP to access anyMeta's API to
            store and process votes.</p></li>
        <li><p>Network availability monitoring (can we access the
            network and specifically our anyMeta site?)</p></li>
        <li><p>Power management monitoring (do we still have
            power?)</p></li>
        <li><p>Device monitoring. Are RFID readers plugged in
            or not? Which device handle are they tied to? Also watch coming
            or leaving devices.</p></li>
        <li><p>A (GTK-based) diagnostic GUI</p></li>
      </ul> 

      <p>Additionally, we also want to show polling results, so we have a
        browser talking to a local HTTP server and a listener for XMPP
        publish-subscribe notifications.</p>

      <p>This is quite a list of tasks for something as seemingly simple as
        a polling stations. But wait: there can be multiple readers tied to a
        particular poll answer, likely physically apart, a polling question can
        have maybe 50 answers (depending on the type of poll, like choosing
        from a collection of keywords) or there could be a lot of questions at
        one event.</p>

      <p>So, back to Twisted. Twisted has HTTP and XMPP protocol support
        (both client and server-side), can talk to serial devices (like your
        Arduino board) and DBus (for watching NetworkManager and device events)
        and provides event loop integration with GTK to also process GUI events
        and manipulate widgets based on events. Together with Wokkel, it powers
        the exchange of information in our (and your?) federating social
        networking sites. In Python. No threads and associated locking. In
        rediculously small amounts of code. That's why.</p>
        
      <p>Not yet convinced? Add a <a href="http://twistedmatrix.com/trac/wiki/TwistedConch" title="">Manhole</a>
        to your application server, SSH into it, and get an interactive, syntax
        highlighted Python prompt with live objects from your application. Yes,
        really.</p>

    ]]&gt;</content:encoded></item><item><title>XMPP Summit #7 and OSCON 2009</title><link>http://ralphm.net/blog/2009/07/19/xmpp_summit_7</link><dc:date>2009-07-19T08:53:10+02:00</dc:date><description>
          Another edition of the XMPP Summit and OSCON and what I am
            going to do there.
        </description><content:encoded>&lt;![CDATA[<p><i>Two great flavors...</i></p>
      

      <p>I am attending <a href="http://xmpp.org/summit/summit7.shtml" title="">XMPP Summit #7</a> and
        part of <a href="http://en.oreilly.com/oscon2009" title="">OSCON 2009</a>, with which it is co-located due the kind folks at
        O'Reilly. Much like <a href="http://ralphm.net/blog/2009/07/26/xmpp_summit_5" title="">last
          year</a>, only this time in San José, California. Unlike the
        European version of the summit last February, we hope to focus more on
        doing than talking, although there will be plenty of that, of
        course.</p>

      <p>Suggestions were made to do some interoperability testing, along
        with general hacking sessions. I am bringing my implementation of
        <a href="http://xmpp.org/extensions/xep-0220.html" title="">server-to-server
          dialback</a>, and a bunch of other protocol implementations in
        <a href="http://wokkel.ik.nu/" title="">Wokkel</a> to the table. While
        there are a bunch of other protocol implementations in Python, I think
        the Twisted approach is so different that I want people to know about
        the ideas behind it. By introducting them to Twisted through Wokkel
        should give them at least a glimpse of <a href="http://ralphm.net/blog/2009/07/19/twisted_mediamatic" title="">why I believe
          Twisted is awesome</a>.</p>

      <p>So, nearing the summit I prepared a bunch of examples around the
        <a href="http://xmpp.org/extensions/xep-0199.html" title="">XMPP Ping</a>
        protocol, as I mentioned <a href="http://ralphm.net/blog/2009/07/08/wokkel_0.6.0" title="">before</a>.
        Additionally I prepared an example <a href="http://wokkel.ik.nu/browser/trunk/doc/examples/echo_server.tac" title="">echo
          bot on steroids</a>, which is basically a stand-alone XMPP server
        that connects to other servers using the server-to-server protocol. It
        will accept presence subscriptions to any potential
        <em>account</em> at the configured domain, sending presence
        and echoing all incoming messages.</p>

      <p>Besides the hacking sessions, I planning to discuss
        publish-subscribe delete-with-redirect, node collections,
        publish-subscribe in multi-user chats and service discovery meta data.
        Oh, and we might go on a field trip to discuss Google Wave XMPP-based
        federation protocols. Then, after the summit, I will hanging out at
        OSCON until Thursday, for hallway meet-ups on federating social
        networks with protocols like OpenID, OAuth and technologies like
        webfinger and pubsubhubbub. I also brought an RFID reader to play
        with.</p>

    ]]&gt;</content:encoded></item><item><title>Wokkel releases</title><link>http://ralphm.net/blog/2009/07/08/wokkel_0.6</link><dc:date>2009-07-08T22:18:15+02:00</dc:date><description>
          A couple of Wokkel releases, that add server-to-server support,
            publish-subscribe improvements and lots of deployment examples
            around the XMPP Ping protocol.
        </description><content:encoded>&lt;![CDATA[<p><i>Making crispy sounds...</i></p>
      

      <p>Today's <a href="http://wokkel.ik.nu/releases/0.6.1/" title="">Wokkel
          0.6.2</a> release is to show case some of the features in the
        previous 0.6.0 release. Most of the work was part of the things we have
        been building at <a href="http://www.mediamatic.nl/" title="">Mediamatic
          Lab</a> as part of a restructuring of how we federate our social
        networking sites using <a href="http://xmpp.org/tech/pubsub.shtml" title="">publish-subscribe</a>.</p>
          
      <p>First of all, I added a preliminary, but functional, implementation
        of server-to-server support, using the dialback protocol. This
        complements the router code that went into 0.5.0 and Twisted Words
        8.2.0 to make a fully stand-alone XMPP server. Note that it does not
        implement any client-to-server functionality yet, but this can be added
        as separate server-side components now.</p>

      <p>To show this off, I have created a bunch of examples around the
        <a href="http://xmpp.org/extensions/xep-0199.html" title="">XMPP Ping</a>
        protocol, for which the protocol implementation itself is also a nice
        example of how to write XMPP protocol implementations using Twisted
        Words and Wokkel. Be sure to check out these <a href="http://wokkel.ik.nu/browser/trunk/doc/examples" title="">examples</a>.</p>

      <p>The other feature I want to mention is publish-subscribe Resources.
        They provide an abstraction of (part of) a publish-subscribe service.
        The protocol parts are handled by Wokkel. This should make it easier to
        do node-as-code scenarios, by just filling in the blanks of the various
        methods that are called upon receiving requests from pubsub
        clients. I'll create some examples for this shortly.</p>

    ]]&gt;</content:encoded></item></channel></rss>
