<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>techno.blog(&#34;Dion&#34;) &#187; apis</title>
	<atom:link href="http://almaer.com/blog/tag/apis/feed" rel="self" type="application/rss+xml" />
	<link>http://almaer.com/blog</link>
	<description>blogging about life, the universe, and everything tech</description>
	<lastBuildDate>Fri, 25 May 2012 16:56:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Do you want your service to keep state for you? Comparing the Twitter and Facebook APIs</title>
		<link>http://almaer.com/blog/do-you-want-your-service-to-keep-state-for-you-comparing-the-twitter-and-facebook-apis</link>
		<comments>http://almaer.com/blog/do-you-want-your-service-to-keep-state-for-you-comparing-the-twitter-and-facebook-apis#comments</comments>
		<pubDate>Mon, 11 Oct 2010 23:01:33 +0000</pubDate>
		<dc:creator>dion</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[apis]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://almaer.com/blog/?p=2811</guid>
		<description><![CDATA[
I love the Twitter for iPad application and how Loren et al have built an experience that feels right in your hands. There is one bug though that can drive me crazy, and that is the fact that the unread state of direct messages is broken. It feels like 99% of the time I will [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/laughingsquid/5018800588/"><img src="http://almaer.com/blog/uploads/twitterfacebook.jpg" alt="twitterfacebook" title="twitterfacebook" width="500" height="373" class="alignnone size-full wp-image-2813"></a></p>
<p><a href="http://almaer.com/blog/newtwitter-ie9-and-the-change-in-user-experience-expectations">I love the Twitter for iPad application</a> and how Loren et al have built an experience that feels right in your hands. There is one bug though that can drive me crazy, and that is the fact that the unread state of direct messages is broken. It feels like 99% of the time I will open up the application and the last 20 messages will have unread:true, even though I know I have read those messages. The bug is particularly irksome because it is so in your face. The messages tab is highlighted as though there are no items even though I know there is nothing new for me (and I just need to go through again and mark them all as read? ugh).</p>
<p>It made me wonder how Twitter was handling the state of direct messages. In creating <a href="http://www.facebook.com/apps/application.php?id=4620273157">Facebook for webOS</a> we built out FB messaging, and the state was handled for us. The Facebook design has the notion of threading baked in (as apposed to email for example) and is as follows:</p>
<ul>
<li>A user has multiple <a href="http://developers.facebook.com/docs/reference/fql/mailbox_folder">mailbox folders</a> (default messages, sent, updates)
<li>A folder has multiple <a href="http://developers.facebook.com/docs/reference/fql/thread">threads</a>
<li>A thread has multiple <a href="http://developers.facebook.com/docs/reference/fql/message">messages</a>.
</ul>
<p>So, where is the unread flag kept? You may think that it is at the message level&#8230; after all, it is a message that is either read or not. However, the thread actually controls the flag for Facebook. This means that in a conversation there is basically an int count that shows you how many messages are unread. If zero, then all messages in the thread are read. There are trade offs on having the unread flag be a count and not a flag on the message layer, but the high level point is the core platform is keeping track of what a user has done. Whether you go through the website, or any application that speaks the Facebook API, as long as your application doesn&#8217;t cache too aggressively, you will have a good result. The key becomes: as the platform developer you very much understand that the service is the master, and you need to be smart about caching data to give your users a responsive interface, but make sure to sync on the data to make sure it is accurate.</p>
<p><img src="http://almaer.com/blog/uploads/echofon-sync.png" alt="echofon-sync" title="echofon-sync" width="339" height="213" class="alignnone size-full wp-image-2812"></p>
<p>The Twitter API on the other hand <a href="http://developer.twitter.com/doc/get/direct_messages">doesn&#8217;t appear to keep any unread state</a> for messages. <a href="http://www.echofon.com/twitter/mac/">Echofon</a> is a cross platform client that showcases its support for syncing this kind of data. It is a nice feature for them to be able to differentiate on, but man&#8230;.. it sucks that they have to write it!</p>
<p>I hope that Twitter starts to own the state so we aren&#8217;t in the current situation of no one really knowing my state, and it has been interesting to see the different state of affairs, and have you thinking about what the platform should be doing, and what should be left to the clients of said platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://almaer.com/blog/do-you-want-your-service-to-keep-state-for-you-comparing-the-twitter-and-facebook-apis/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Will APIs effect mergers and acquisitions?</title>
		<link>http://almaer.com/blog/will-apis-effect-mergers-and-acquisitions</link>
		<comments>http://almaer.com/blog/will-apis-effect-mergers-and-acquisitions#comments</comments>
		<pubDate>Mon, 10 Mar 2008 15:17:03 +0000</pubDate>
		<dc:creator>dion</dc:creator>
				<category><![CDATA[Comic]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[apis]]></category>
		<category><![CDATA[dopply]]></category>
		<category><![CDATA[trippit]]></category>

		<guid isPermaLink="false">http://almaer.com/blog/will-apis-effect-mergers-and-acquisitions</guid>
		<description><![CDATA[
I believe that 2008 and beyond will be huge for mashups and APIs. We are going to move beyond the world of &#8220;Look, I took some data and put it together with a Google Map and Calendar&#8221; and have full featured read/write in browser APIs thanks in part to the slew of cross domain friendly [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://almaer.com/blog/category/comic"><img src='http://almaer.com/blog/uploads/intecompete.png' alt='Will APIs effect mergers and acquisitions?' border='0'/></a></p>
<p>I believe that 2008 and beyond will be huge for mashups and APIs. We are going to move beyond the world of &#8220;Look, I took some data and put it together with a Google Map and Calendar&#8221; and have full featured read/write in browser APIs thanks in part to the slew of cross domain friendly features that are coming from browsers, Gears, and developer hacks.</p>
<p>I have talked about the <a href="http://gearsblog.blogspot.com/2007/10/bloggears-offline-blogger-client.html">blog.gears example</a>, that shows how you can use Blogger as a back-end for a blog system. It seems quite obvious to me that if you are building a Web application that isn&#8217;t the Next Blog Thing, why would you want to spend any time building a blog system to get that functionality in the product. You have a couple of choices beyond writing it yourself. You could grab an open source blogging engine (there are many great ones), you could use a service and have blog.* CNAME over, or if you want tight integration you could do what blog.gears does, and use a JavaScript API to access blogger as the store and have it hidden from the user.</p>
<p>I got to thinking, <b>how will the fact that it is easier to integrate with sites through richer APIs affect M &amp; A?</b></p>
<p>An example that got me thinking about this is Dopplr and TripIt. Dopplr is a phenomenal service that seems to nail usability and the art of doing one thing, and doing it really well. It is clean. It has subtle touches that I love (the personal colors in the header icon and favicon even).</p>
<p>Them came along TripIt. The killer feature that it has is the ability to email your itineraries that you got from online sites and airlines to the system, and it groks a bunch of the formats and can thus suck them in automatically. Once you hit Apple-F, you are done, and you see the new information appear in your TripIt iCal.</p>
<p>Compare this to Dopplr. For a long time you would manually input your travel information in some shape or form. At the London Future of Web Apps I met Matt Biddulph, who not only was a fantastic, nice, fun guy, who gave the best talk at the event, but also was able to flip a bit which enabled Dopplr to read one of my Google Calendars. This feature is now in the wild for all. That was a great improvement, as I could setup a &#8220;Travel&#8221; calendar that Dopplr reads from.</p>
<p>I still had to keep that calendar going through. When TripIt came out, I heard cries of Dopplr fans that they should buy TripIt, or merge, or just copy the functionality. That isn&#8217;t the way with 2008. Instead, Matt was able to integrate with TripIt in a very simple way.</p>
<p>TripIt produces an iCal calendar from it&#8217;s data, and <a href="http://blog.dopplr.com/index.php/2008/02/27/new-feature-dopplr-subscribes-to-your-personal-calendar/">you can simply tie Dopplr to that calendar&#8230; and ta da!</a></p>
<p>I have been in quite a few meetings recently where the topic of buy has changed to be integrate through APIs. This enables each piece to grow, and to have people work on one small thing and make it the best it can be.</p>
<p>Of course, there is a time and a place for buyouts and mergers, but I wonder if they will be a little less frequent now. Then the game changes to being the platform, and being able to monetise it (a.k.a. make money to feed your family!)</p>
<p><b>Fixing calendars</b></p>
<p>As an aside, I still find a lot of pain with calendar systems. The main problem that I have is that I want events to cross various calendars, but collapse them in my view. For example, if I am going on a trip, I want my wife to see it, as well as my work colleagues. I don&#8217;t want to have to duplicate the entry in multiple calendars and then see the same darn thing repeatedly.</p>
]]></content:encoded>
			<wfw:commentRss>http://almaer.com/blog/will-apis-effect-mergers-and-acquisitions/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Gears Future APIs: Messaging API</title>
		<link>http://almaer.com/blog/gears-future-apis-messaging-api</link>
		<comments>http://almaer.com/blog/gears-future-apis-messaging-api#comments</comments>
		<pubDate>Thu, 27 Dec 2007 15:47:38 +0000</pubDate>
		<dc:creator>dion</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Gears]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[apis]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[messaging]]></category>

		<guid isPermaLink="false">http://almaer.com/blog/gears-future-apis-messaging-api</guid>
		<description><![CDATA[Once you start delving into the WorkerPool API, you quickly see how a common pattern would be using it as a messaging system. As it stands, it looks like an Open Web version of Erlang processes.
Scott Hess wrote up his thoughts on a more formal Messaging API based on WorkerPool:

Gears WorkerPool has two pieces, the [...]]]></description>
			<content:encoded><![CDATA[<p>Once you start delving into the <a href="http://code.google.com/apis/gears/api_workerpool.html">WorkerPool API</a>, you quickly see how a common pattern would be using it as a messaging system. As it stands, it looks like an Open Web version of Erlang processes.</p>
<p>Scott Hess wrote up his thoughts on a more formal <a href="http://code.google.com/p/google-gears/wiki/MessagingAPI">Messaging API</a> based on WorkerPool:</p>
<blockquote><p>
Gears WorkerPool has two pieces, the part about running a bit of JS asynchronously, and the part about trading messages with that JS. This API may be composable from more basic bits. The messaging bit could be used in other contexts, such as implementing something like <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/section-crossDocumentMessages.html">WhatWG&#8217;s postMessage()</a>.
</p></blockquote>
<p><b>Aside: What is WhatWG&#8217;s postMessage?</b></p>
<p><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/section-crossDocumentMessages.html">postMessage</a> is &#8220;a messaging system that allows documents to communicate with each other regardless of their source domain, in a way designed to not enable cross-site scripting attacks.&#8221;</p>
<p>Here is an example:</p>
<blockquote><p>
For example, if document A contains an <code><a href="section-embedded0.html#object">object</a></code> element that contains document B, and<br />
    script in document A calls <code title="dom-window-postMessage"><a href="#postmessage">postMessage()</a></code> on document B, then a<br />
    message event will be fired on that element, marked as originating from<br />
    document A. The script in document A might look like:</p>
<pre>var o = document.getElementsByTagName('object')[0];
o.<span title="dom-object-contentWindow">contentWindow</span>.<a href="#postmessage" title="dom-window-postMessage">postMessage</a>('Hello world');
</pre>
<p>To register an event handler for incoming events, the script would use<br />
    <code title="">addEventListener()</code> (or similar mechanisms). For<br />
    example, the script in document B might look like:</p>
<pre>document.addEventListener('message', receiver, false);
function receiver(e) {
  if (e.domain == 'example.com') {
    if (e.data == 'Hello world') {
      e.source.postMessage('Hello');
    } else {
      alert(e.data);
    }
  }
}</pre>
<p>This script first checks the domain is the expected domain, and then<br />
    looks at the message, which it either displays to the user, or responds<br />
    to by sending a message back to the document which sent the message in<br />
    the first place.</p>
</blockquote>
<p><b>Back to the Gears Messaging API</b></p>
<p>Scott gives an example of the messaging API, starting with an end point:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> port <span style="color: #339933;">=</span> google.<span style="color: #660066;">gears</span>.<span style="color: #660066;">factory</span>.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'beta.messageport'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'1.0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
port.<span style="color: #660066;">onmessage</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>port<span style="color: #339933;">,</span> msg<span style="color: #339933;">,</span> sender<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;message: &quot;</span> <span style="color: #339933;">+</span> msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
port.<span style="color: #660066;">listen</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #006600; font-style: italic;">// Omit for anonymous listener.</span></pre></div></div>

<p>and having a way to send it a message:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> port <span style="color: #339933;">=</span> google.<span style="color: #660066;">gears</span>.<span style="color: #660066;">factory</span>.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'beta.messageport'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'1.0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
port.<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
port.<span style="color: #660066;">sendMessage</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hello there&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To enable cross domain, you can <code>post.open(name, domain)</code>, and on the other side, you have to allow it via something like <code>port.allowCrossOrigin(["www.good.com", "www.angelic.com"]);</code>.</p>
<p>I am excited about a messaging API, as I think that it fits into the way in which we are developing new Web applications. Having an asynchronous queue that allows me to replay work (e.g. offline), and work nicely with Comet based interactions, would be great. We can reuse all that we have learned from other event based systems, and <a href="http://www.enterpriseintegrationpatterns.com/ramblings.html">Gregor</a> can rename his book and be happy!</p>
<p><b>Other Future APIs</b></p>
<ul>
<li><a href="http://almaer.com/blog/gears-future-apis-location-api">Location API</a></li>
<li><a href="http://almaer.com/blog/gears-future-apis-desktop-shortcut-api">Desktop Shortcut API</a></li>
<li><a href="http://almaer.com/blog/gears-future-apis-image-manipulation-api">Image Manipulation API</a></li>
<li><a href="http://almaer.com/blog/google-gears-upgrading-from-a-1950s-chevy-in-cuba">Introduction to the series</a></li>
</ul>
<p><em>Disclaimer: This is early days, and who knows what the final API will look like, or if it will even make it. Do you have ideas for cool Gears that make the Web better? <a href="http://groups.google.com/group/google-gears/">Let us know!</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://almaer.com/blog/gears-future-apis-messaging-api/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

