<?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>bruno fernandez-ruiz</title>
	<atom:link href="http://www.olympum.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.olympum.com</link>
	<description>random code dumps</description>
	<lastBuildDate>Wed, 14 Jul 2010 06:49:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Facebook BigPipe in an Async Servlet</title>
		<link>http://www.olympum.com/java/facebook-bigpipe-in-an-async-servlet/</link>
		<comments>http://www.olympum.com/java/facebook-bigpipe-in-an-async-servlet/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 06:44:48 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.olympum.com/java/facebook-bigpipe-in-an-async-servlet/</guid>
		<description><![CDATA[Since Subbu wrote BigPipe using node.js, I had to see how the same thing would look like in a Java async servlet.

Stephan Schmidt had already written Facebook BigPipe for Java, but using a synchronous servlet model, not asynchronous. I decided to implement it using Jetty continuations and the Jetty HTTP client, but the code should [...]]]></description>
			<content:encoded><![CDATA[<p>Since <a href="http://www.subbu.org/">Subbu</a> wrote <a href="http://www.subbu.org/blog/2010/07/bigpipe-done-in-node-js">BigPipe using node.js</a>, I had to see how the same thing would look like in a Java async servlet.</p>

<p><a href="http://codemonkeyism.com/">Stephan Schmidt</a> had already written <a href="http://codemonkeyism.com/facebook-bigpipe-java/">Facebook BigPipe for Java</a>, but using a synchronous servlet model, not asynchronous. I decided to implement it using Jetty continuations and the Jetty HTTP client, but the code should be easy to adapt to servlet 3.0 <code>AsyncContext</code>.</p>

<script src="http://gist.github.com/475077.js"></script>

<p>The code initially constructs the page with a few empty <code>div</code>s that will contain the pagelets, for example:</p>

<pre>
&lt;div id='pagelet3'&gt;&lt;/div&gt;
</pre>

<p>I keep the connection open from the browser to the server while I render pagelets. As pagelets become available, I flush them onto the browser, which in turn inserts them into the right place in the DOM using Javascript. Assuming we get back a response from the remote module protocol:</p>

<pre>
&lt;span&gt;some useful message for module: pagelet3&lt;/span&gt;
</pre>

<p>We wrap it inside Javascript so that it looks like:</p>

<pre>
&lt;script&gt;arrived('pagelet3', '&lt;span&gt;some useful message for module: pagelet3&lt;/span&gt;');&lt;/script&gt;
</pre>

<p>All is left is for the <code>arrived</code> function to update the <code>pagelet3</code> element in the DOM.</p>

<p>In terms of concurrency, the initial page construction is done synchronously. As soon as I have the frame in place with the <code>div</code>s that will eventually hold the pagelets, I suspend the execution of the servlet, which in turn releases the thread that was attached to the client connection. At that point, I fire in parallel HTTP client requests to the remote module server.</p>

<p>For resuming the continuation, I could have used a counter, but since each HTTP client execution is a separate thread, unlike in node.js, I did not want to have to acquire a lock and synchronize to be able to update the counter. Instead, I used request attributes, as setting, getting and removing them is thread safe. The code keeps a list of references to the elements that we are offloading to a remote module server, as an <code>ArrayList</code> with the ids to fire parallel requests to <code>http://localhost:8080/module?id={id}</code>; each <code>id</code> is also kept as a request attribute. As each request comes back from the remote module server, I write and flush the response buffer, so that the element appears on the browser immediately, and I remove the corresponding request attribute.</p>

<p>Although the code is not as readable and straight forward as what Subbu got with node.js, I am actually surprised how simple the async Java solution actually turned out to be.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/java/facebook-bigpipe-in-an-async-servlet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Scaling node.js to Multiple Cores</title>
		<link>http://www.olympum.com/future/on-scaling-node-js-to-multiple-cores/</link>
		<comments>http://www.olympum.com/future/on-scaling-node-js-to-multiple-cores/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 15:29:11 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Future]]></category>

		<guid isPermaLink="false">http://www.olympum.com/future/on-scaling-node-js-to-multiple-cores/</guid>
		<description><![CDATA[From a thread on multicore leverage in nodejs, Edwin Khodabakchian talking about feedly:


  We have an &#8220;admin&#8221; node process which is started with as input the 
  number of &#8220;feedly&#8221; node processes it should launch and monitor. When 
  the admin starts, it spawns multiple &#8220;feedly&#8221; node processes, padding 
  as [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://groups.google.com/group/nodejs/browse_thread/thread/36146559c089dca0">a thread</a> on multicore leverage in nodejs, <a href="http://blog.feedly.com/">Edwin Khodabakchian</a> talking about <a href="http://feedly.com/">feedly</a>:</p>

<blockquote>
  <p>We have an &#8220;admin&#8221; node process which is started with as input the 
  number of &#8220;feedly&#8221; node processes it should launch and monitor. When 
  the admin starts, it spawns multiple &#8220;feedly&#8221; node processes, padding 
  as input the port the feedly node should listen to 9701 for the first 
  one,&#8230;9710 for the 10th one.</p>
  
  <p>On the server we have a varnish server which load balances the traffic 
  from m.feedly.com to 127.0.0.1:9701 &#8212; 127.0.0.1:9710.</p>
  
  <p>Each &#8220;feedly&#8221; node process has a 127.0.0.1:970x/heath endpoint where 
  it reports stats about its execution. The admin node monitor each 
  feedly node every 2 minutes and makes sure that the feedly node is 
  healthy and responding. If not, it kills the child and restart a new 
  instance of the feedly node listening to the same port.</p>
  
  <p>All feedly nodes point to a redis instance for shared memory/session 
  management. This allows incoming HTTP requests to be load balances 
  across any feedly nodes transparently. 
  In dev/staging, we have varnish and all the node processes running on 
  the same box.</p>
  
  <p>In production, we can scale out by having varnish on one server and 
  multiple node cell (where a cell is an admin+10 feedly). This allows 
  us to do rolling upgrades, etc. without any interruption to the 
  service.</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/future/on-scaling-node-js-to-multiple-cores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nodes and Jetties</title>
		<link>http://www.olympum.com/future/nodes-and-jetties/</link>
		<comments>http://www.olympum.com/future/nodes-and-jetties/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 05:59:20 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Future]]></category>

		<guid isPermaLink="false">http://www.olympum.com/future/nodes-and-jetties/</guid>
		<description><![CDATA[I am intrigued by node.js. Others are not so much. So they ask me, why node.js, why not Jetty, or Netty, or &#8230; ? Others say, and Twisted, and EventMachine? The core of the answer lies in a simple not well understood truth: concurrent programming is really hard. Concurrent programming using threads and locks to [...]]]></description>
			<content:encoded><![CDATA[<p>I am intrigued by node.js. Others are not so much. So they ask me, why node.js, why not Jetty, or Netty, or &#8230; ? Others say, and Twisted, and EventMachine? The core of the answer lies in a simple not well understood truth: concurrent programming is really hard. Concurrent programming using threads and locks to shared memory is <em>extremely</em> hard. Most programmers get concurrency wrong, since they don&#8217;t quite realize that threads actually execute <em>simultaneously</em>.</p>

<p>Functional programming languages have long understood this, and designed mechanisms to avoid the risk of a programmer getting it wrong, such as immutable data structures (take a look at java.lang.String, designed by Lee Boynton, a true Lisp guy), or message passing (erlang).</p>

<p>Surprisingly, another line of programming has ended up in the same place. PHP can be deployed multi-threaded on Apache, but unfortunately most native libraries are <em>not</em> thread safe, so one ends up running processes as workers. Similarly, Python has the GIL, and Guido has no interest in fixing that. And yet, PHP and Python scale really well using processes.</p>

<p>So, here&#8217;s the interesting bit about node.js. It&#8217;s written on a functional programming language, Javascript, and provides a reactor server (remember POSA2?) on a single thread! I hear you say, how does it scale to multiple cores? It does not.</p>

<p>A single thread is only able to utilize one CPU. Even though most web apps are initially I/O bound, at some point programmers somehow manage to make them CPU bound (such as marshaling and wrangling JSON and XML). This will limit the scalability on the single process. In order to scale beyond 1 core, two possibilities exist. Right now, one would need to launch one node.js process per core, and then setup a load balancer. In the future, launching the processes needs to be done inside node (maybe this is fixed in the future?). The second option, which might also be implemented based on the node.js web site, is to adopt the Web Workers spec.</p>

<p>Now, because of the (single) threading model, response times are fairly unpredictable. One would expect a Java server on an async stack, such as Jetty, to provide more consistent response times, as it uses multiple threads. <a href="http://praxx.is/post/486034949/comet-with-bayeux-node-js-vs-jetty-and-cometd">A test</a> corroborates such hypothesis (look at the curve distribution for node.js vs jetty).</p>

<p>At the same time, because of the (single) threading model, memory usage is very low in node.js,  compared with Netty, or Jetty, where as a result of being multi-threaded, memory usage will be higher for the same load and latency. A <a href="http://news.ycombinator.com/item?id=1454722">discussion</a> on ycombinator seems to be along these lines. I am of the opinion that being able to run both on low and large memory profiles is critical to becoming successful, especially as many developers run their code in shared hosts.</p>

<p>If you have followed me this far, putting memory aside as that can be shared on the heap, you will then conclude that a multi-threaded Java-based async I/O server, like Jetty, should be better that node.js. And I would agree, only if it was not Java.</p>

<p>So here&#8217;s the deal. Except a counted number of exceptions, Java libraries carry significant legacy of the wrong kind of concurrent programming, either abusing or ignoring locks. Either they do not scale to multiple cores, or they corrupt integrity of state. And this will continue to be a problem, since Java does not prevent bad programming practices in a concurrent setting. But there is a light: using the JVM, ignoring Java and most existing Java libraries.</p>

<p>Building new libraries for the JVM that are truly designed for concurrency requires using the right abstractions, and this is where functional programming comes into place. There are three key functional programming language contenders to the JVM: Javascript (Rhino), Scala, and Clojure.</p>

<p>First, there is Javascript, with Rhino, Mozilla&#8217;s Javascript implementation for the JVM. <a href="http://www.ringojs.org/wiki/">Ringo</a> is a nodejs alternative based on Rhino. Unfortunately, Rhino is slow and quite a memory hog. Additionally calls in Ringo are blocking, which defeats the programming model. And Ringo uses the same Java libraries that were not coded with concurrency in mind. Compared to nodejs, Ringo has no community (a quick scan reveals 9701 messages in the node.js mailing list in 12 months of usage, against only 181 in 2 years of usage).</p>

<p>Next, come Scala and Clojure. Both are very intriguing, perhaps Clojure being more of my taste. For Clojure, we now have <a href="http://github.com/ztellman/aleph">Aleph</a>, a thin Netty wrapper. On multi-core, it seems to beat node.js latency and throughput wise, at the cost of memory. And Clojure allows message passing, immutable data structures, ala Lisp, all transparently mapped onto threads. Beautiful I say.</p>

<p>But Scala and Clojure are not Javascript. Javascript attracts many developers from the browser world, it provides a consistent event-driven programming paradigm for both server runtime and client runtime. Eventually, this pushes most UI logic to the browser, and leaves the server as a smart data source. As much as I find Clojure extremely exciting, I don&#8217;t think it can realistically compete with Javascript.</p>

<p>So, realistically, only node.js is a viable alternative today. Maybe Clojure truly succeeds, and a Clojure based async I/O server appears. But for now, node.js is more interesting.</p>

<p>But don&#8217;t get me wrong: node.js is very young, truly bleeding edge, and needs substantial work. Some of that work will make it easy for applications to scale beyond one core. Scaling beyond one core will improve consistency in response times. But given the vibrant community and excitement (and hype) around node.js, I am fairly confident this will happen.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/future/nodes-and-jetties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why node.js Matters</title>
		<link>http://www.olympum.com/internet/why-node-js-matters/</link>
		<comments>http://www.olympum.com/internet/why-node-js-matters/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 15:36:30 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.olympum.com/internet/why-node-js-matters/</guid>
		<description><![CDATA[Since the days when I coded my first reactor [POSA2] back at MIT, I have been convinced of the
conceptual simplicity of non-blocking event driven server. Aside not blocking for I/O and being able
to scale well beyond polling architectures, it is harder, sometimes impossible, to make concurrent
programming mistakes with an event-driven programming paradigm. However, reactor servers [...]]]></description>
			<content:encoded><![CDATA[<p>Since the days when I coded my first reactor [POSA2] back at MIT, I have been convinced of the
conceptual simplicity of non-blocking event driven server. Aside not blocking for I/O and being able
to scale well beyond polling architectures, it is harder, sometimes impossible, to make concurrent
programming mistakes with an event-driven programming paradigm. However, reactor servers never took
off massively, probably because event based programming of server-side applications is a more
complex programming paradigm for the average programmer than a thread- or process-per-request. In in
a way, we have had not enough pressure to move, yet. Things would just work, reasonable well.</p>

<p>But I believe we are finally at a turning point. Multi-core architectures imply <a href="http://www.olympum.com/future/composable-and-concurrent/">the end of the free
lunch</a>. It is happening. Writing highly
concurrent server-side applications that are able to scale linearly as the number of cores increases
is something that we should be preparing for.</p>

<p>Once you believe reactor servers are the future, and somewhat the present, comes the question of
programming language. When it comes to programming for the web, there are many religions and
options: PHP, Ruby, Python, Java, C#, &#8230; However, when it comes to writing web applications, there
are three languages on which all web developers agree universally on: HTML, CSS and Javascript.</p>

<p>And this is what makes node.js exciting. node.js develops a reactor server on top of Google&#8217;s V8
Javascript engine. First, it solves the free lunch problem using a language that is universally
accessible to web developers. Second, it opens the door for innovation to a world of extremely high
concurrency, for example, MMORPGs, and potentially to a completely different web interaction
paradigm.</p>

<p>With motivation in mind, I set myself to learn a bit more about node.js. I chose one possible stack,
node.js + express + mongodb, but there are many more to learn. What follows in the rest of this post
are my raw notes, which I am posting here just in case it helps fellow developers getting up to
speed in all this new cool technology.</p>

<h2>Installation</h2>

<p>First, we install <a href="http://nodejs.org/">node.js</a> itself, and <a href="http://github.com/drnic/kiwi">kiwi</a>, a
packaging system for node.js, using homebrew (I have dropped Macports in favor of
<a href="http://github.com/webs/homebrew">homebrew</a>, as it allows me to create my own installation recipes
really easily).</p>

<pre><code>$ brew install node
$ brew install kiwi
</code></pre>

<p>That installed for me:</p>

<pre><code>kiwi (0.3.1)
node (0.1.98)
</code></pre>

<p>Once we have kiwi, we install the <a href="http://expressjs.com/">express</a> framework:</p>

<pre><code>$ kiwi -v install express
</code></pre>

<p>Finally, we install <a href="http://www.mongodb.org/">mongodb</a>:</p>

<pre><code>$ brew install mongodb

If this is your first install, automatically load on login with:
    cp /usr/local/Cellar/mongodb/1.4.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents
    launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

If this is an upgrade and you already have the org.mongodb.mongod.plist loaded:
    launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist
    cp /usr/local/Cellar/mongodb/1.4.3-x86_64/org.mongodb.mongod.plist ~/Library/LaunchAgents
    launchctl load -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

Or start it manually:
    mongod run --config /usr/local/Cellar/mongodb/1.4.3-x86_64/mongod.conf
</code></pre>

<p>And finally, the native adapter to mongodb for node.js:</p>

<pre><code>$ kiwi install mongodb-native
</code></pre>

<h2>Hello World</h2>

<p>Fire text editor and create app.js:</p>

<pre><code>var kiwi = require('kiwi')
kiwi.require('express')

get('/', function(){
  this.contentType('html')
  return '&lt;h1&gt;Welcome To Express&lt;/h1&gt;'
})

run()
</code></pre>

<p>And back to the terminal:</p>

<pre><code>$ node app.js
</code></pre>

<p>Point the browser to:</p>

<pre><code>http://localhost:3000/
</code></pre>

<h2>Tutorial App</h2>

<p>I found a good blog with many <a href="http://howtonode.org/">node.js tutorials</a>, including one on building
a <a href="http://howtonode.org/express-mongodb">blog app example</a> that included <a href="http://github.com/creationix/howtonode.org/blob/master/articles/express-mongodb/express-mongodb-2.zip">source
code</a>
using express and mongodb.</p>

<p>To run the demo, first start mongodb, and then node.js (I used two terminal windows):</p>

<pre><code>$ mongod run --config /usr/local/Cellar/mongodb/1.4.3-x86_64/mongod.conf
$ node app.js
</code></pre>

<p>And then visit <code>http://localhost:3000/</code>. I could not create a new blog post by visiting
<code>http://localhost:3000/blog/new</code>, as I&#8217;d get an error:</p>

<pre><code>/Users/brunofr/Projects/express-mongodb-2/app.js:39
        title: article.title,
                      ^
TypeError: Cannot read property 'title' of undefined
    at /Users/brunofr/Projects/express-mongodb-2/app.js:39:23
</code></pre>

<p>Looking at the code, it seems like the route <code>blog/*</code> is being executed before <code>blog/new</code>:</p>

<pre><code>get('/blog/*', function(id){
  var self = this;
  articleProvider.findById(id, function(error, article) {
    self.render('blog_show.html.haml', {
      locals: {
        title: article.title,
        article:article
      }
    });
  });
});

get('/blog/new', function(){
  this.render('blog_new.html.haml', {
    locals: {
      title: 'New Post'
    }
  });
});
</code></pre>

<p>Reversing the order fixed the problem.</p>

<h2>Benchmark</h2>

<p>I found one interesting benchmark, on <a href="http://tjholowaychuk.com/post/543953703/express-vs-sinatra-benchmarks">Express vs
sinatra</a>, which as always
should be taken with a grain of salt. But the benchmark illustrates some of the properties of
reactor servers that we have been talking about.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/internet/why-node-js-matters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autonomy, Mastery, Purpose</title>
		<link>http://www.olympum.com/other/autonomy-mastery-purpose/</link>
		<comments>http://www.olympum.com/other/autonomy-mastery-purpose/#comments</comments>
		<pubDate>Sat, 29 May 2010 04:41:31 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.olympum.com/?p=305</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/u6XAPnuFjJc&#038;color1=0xb1b1b1&#038;color2=0xd0d0d0&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/u6XAPnuFjJc&#038;color1=0xb1b1b1&#038;color2=0xd0d0d0&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/other/autonomy-mastery-purpose/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Linked-Atom Web</title>
		<link>http://www.olympum.com/internet/the-linked-atom-web/</link>
		<comments>http://www.olympum.com/internet/the-linked-atom-web/#comments</comments>
		<pubDate>Fri, 14 May 2010 05:02:08 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.olympum.com/?p=288</guid>
		<description><![CDATA[The release of Facebook&#8217;s Open Graph Protocol has spurred renewed interest
in the semantic web. I give credit to Facebook for pushing forward an RDFa
derived format onto the world wide web. In fact, RDFa is the least
interesting part. Producing semantic data has been around for a long time.
Most importantly, I give Facebook credit for focusing on [...]]]></description>
			<content:encoded><![CDATA[<p>The release of Facebook&#8217;s Open Graph Protocol has spurred renewed interest
in the semantic web. I give credit to Facebook for pushing forward an RDFa
derived format onto the world wide web. In fact, RDFa is the least
interesting part. Producing semantic data has been around for a long time.
Most importantly, I give Facebook credit for focusing on the interesting
part of the problem: consumption of semantic data.</p>

<p>And although it&#8217;s a great achievement, I regret the locked-in and
centralized nature of Facebook&#8217;s Open Graph Protocol. The web is an open
environment, where open wins at the end.</p>

<h2>Entity Identifiers</h2>

<p>Facebook assigns and owns internal identifiers to entities. These
identifiers do not look unique, nor something that external parties,
disconnected from Facebook could assign, inspect or do anything useful with.
By owning the identifiers, Facebook is owning the entity graph.</p>

<p>The assumption of a single party owning the identifiers for entities is
fundamentally flawed. Entities appear, disappear, merge and fork. Known
entities change constantly, and most importantly what you and I, or anybody
else understands and knows as an entity is different. IMDB and Netflix will
both describe the movie &#8220;The Book of Eli&#8221;, however each use different
identifiers. To assume that one unique identifier can be used consistently
and universally across the web leads to information lock-in.</p>

<p>Luckily, the web is an open environment. And, at the end, open wins on the
web (prove by induction to the avid reader).</p>

<p>Identity on the open web is federated, starting at the top-level domain
identifiers, and all the web to a fully qualified Universal Resource
Identifiers (URIs). In reality, there are many sources of truth. Some of
those are canonical, or trusted, yet many other sources exist. Movies data
from IMDB or Netflix will usually be considered canonical. Yet that does not
stop Wikipedia, or any web publisher, from creating its own entities. All it
takes is a URI.</p>

<p>Anybody on the web, be it Facebook or Freebase, can make statements such as:
this URI on Netflix is about the same movie as this other URI on IMDB. All
it takes is a web page with a couple of links. The difference between
Facebook and the &#8220;web&#8221; way, is that a web page is identified by a URI, and
anybody can create one in a federated way. Not just Facebook.</p>

<h2>Semantic Web Annotation Techniques</h2>

<p>The most interesting value of the web is not about describing resources, or
the roles of the relationships between resources, but the relationships
themselves. The statement &#8220;Madonna is related to Guy Ritchie&#8221; is, in
relative terms, more important than the more fact-complete &#8220;Madonna is Guy
Ritchie&#8217;s ex-wife&#8221;. Although the fact &#8220;ex-wife&#8221; increases knowledge, it has
only value once we asserted that the relationship exists. Establishing
relationships can be achieved through links and URIs. That&#8217;s what the web is
about. Pages and links to other pages.</p>

<p>The problem however with the current web of pages and links is that all URIs
are anonymous. Ideally, I would like to bring some structure to those
relationships so that I can codify exactly what &#8220;ex-wife&#8221; means. That&#8217;s what
semantic annotations address: naming the role in the relationship between
resources in a structured format.</p>

<p>Inlined semantic annotations, ala Facebook, is one possible way of linking
data sets. The issue however with this approach is that the meta-data about
the resource is mingled with the data. This creates a number of problems.
First, there is an arbitrary distinction between what constitutes data and
what is metadata. Additionally, one needs to be able to parse the resource
format in order to find the semantic annotations. Aside the parsing
computing cost, adding semantic annotations to videos, images, etc. would
require custom extensions to be container format, which is practically
unfeasible. Practically speaking inline semantic annotations are only
partially useful, and only for text-readable content types.</p>

<p>A better alternative would be to use out-of-line semantic annotations. In
this model, we cleanly separate meta-data from the resource data itself.
This separation should be not just syntactical, but structural. Semantic
annotation constructs should treat the data as an opaque resource. For all
we care, we should treat all data as binary resources. If we wanted to look
into the data, an specialized parser would read the data, and surface
interesting facts that we could then promote to metadata.</p>

<p>The first possible construct that provides out-of-line semantic annotations
is the <a href="http://tools.ietf.org/html/draft-nottingham-http-link-header-10">Link HTTP
Header</a>.
Using link headers we can describe a web resource without having to parse
the payload, by simply looking at the HTTP headers. Examples of usage for
link headers could include:</p>

<pre><code>  Link: &lt;http://www.cern.ch/TheBook/chapter2&gt;; rel="Previous"
  Link: &lt;mailto:timbl@w3.org&gt;; rev="Made"; title="Tim Berners-Lee"
</code></pre>

<p>Although powerful, link headers are not particularly accessible for most
publishers, since they require programming access to the web server to
generate those link headers. Additionally, if we are only interested in the
semantic annotations, fetching a full document only to throw it away is
highly inefficient both for consumer and publisher.</p>

<p>A better construct to provide out-of-line semantic annotations is to create
a separate resource altogether representing the semantic annotations for the
parent resource. This alternative, alike link headers, also differentiates
between data and meta-data, but does not require stack changes to HTTP.
Furthermore, it does not require the publisher to generate those semantic
annotations. Anybody can publish semantic annotation documents for any
resource on the web. In that sense, the use of out-of-line semantic
documents that describe web resources is truly open and federated.</p>

<h2>The Linked-Atom</h2>

<p>There are many possible formats for describing resources in an out-of-line
fashions. One of the most interesting formats ones is the <a href="http://www.ietf.org/rfc/rfc4287.txt">The Atom
Publishing Format</a>. With Atom, the
focus is on identity and linking resources. The actual content is hidden
away.</p>

<p>But within the context of semantic annotations, Atom has its
<a href="http://www.olympum.com/future/a-web-linked-by-atoms/">shortcomings</a>. Rather
than abusing Atom, perhaps we need to create a separate, specialized
out-of-line resource descriptor. I call such format the &#8220;Linked-Atom&#8221;. There
are a few differences between Atoms and Linked-Atoms. Whereas the atom is a
generic format for content publishing, the linked-atom is only using for
linking web resources.</p>

<p>Let&#8217;s consider a graph whereby:</p>

<ul>
<li>Each resource on the web is unique identified by a URI. Let&#8217;s make such
resource a vertex, and the identity of this vertex be the URI.</li>
<li>A resource can link to other resources, also identified by URIs. We&#8217;ll
make each link a directed edge, and the link&#8217;s identity the URI of the
target resource.</li>
<li>Edges have a type, which corresponds to the type of the target resource.</li>
<li>Edges might be named, or remain anonymous.</li>
</ul>

<p>In this graph, the set of a vertex and its outbound edges constitutes a
linked-atom. The linked-atom introduces some additional constraints:</p>

<ul>
<li>A linked-atom is immutable. A change in the graph (adding or removing
edges, or changing edge types or edge names) creates a new Atom, with the
vertex identifier and a new revision number.</li>
<li>Linked-atoms are identified by a composite key composed of the vertex
identifier and the revision identifier.</li>
<li>The list of all linked-atoms describing all revisions of a vertex
constitutes a collection.</li>
<li>Collections are uniquely identified by the vertex identifier.</li>
</ul>

<p>A possible JSON representation for a linked-atom would be:</p>

<pre><code>    {
        "id": "http://example.com/foo.html",
        "rev_id": 1,
        "links": [
            {
                "id": "http://example.com/bar.html",
                "rev_id": 2,
                "type": "text/html",
                "name": "bar" 
            },
            {
                "id": "http://example.com/toto.png",
                "rev_id": 1,
                "type": "image/png",
                "name": "toto" 
            }
        ] 
    }
</code></pre>

<p>A more compact representation of the atom is perhaps more interesting for
extracting information. Instead of grouping all the edges into a single
document, we would create describe each vertex-edge relationship as a
N-tuple. A possible implementation of the linked-atom could use n-tuples to
store the data:</p>

<pre><code>    http://example.com/foo.html 1 http://example.com/bar.html 2 text/html bar
    http://example.com/foo.html 1 http://example.com/toto.png 1 image/png toto
</code></pre>

<h2>The Graph</h2>

<p>Using linked-atoms, we can model the information in the web, not simply as a
graph of pages and links, but a graph of named and typed links between
vertices. Each linked-atom represents a statement about a web resource, a
piece of knowledge. The advantage of a linked-atom graph is that anybody can
publish a document making statements via linked-atoms and collections of
linked-atoms, and not just the publisher of the web resource.</p>

<p>This is in contrast with Facebook&#8217;s Open Graph Protocol, where only the
publisher of the web resource can make such statements, and where only one
consumer assigns identifiers to those statements. Maybe the Linked-Atom is
not the perfect construct, but it provides an alternative to what I see as a
centralized lock-in model that threatens the open nature of the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/internet/the-linked-atom-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android Solves Rubik in 24 Seconds</title>
		<link>http://www.olympum.com/mobile/android-solves-rubik-in-24-seconds/</link>
		<comments>http://www.olympum.com/mobile/android-solves-rubik-in-24-seconds/#comments</comments>
		<pubDate>Sun, 09 May 2010 16:57:39 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.olympum.com/?p=296</guid>
		<description><![CDATA[Update (20100524): the owner of the video has removed it. That&#8217;s the &#8220;beauty&#8221; of UGC.


]]></description>
			<content:encoded><![CDATA[<p><strong>Update (20100524)</strong>: the owner of the video has removed it. That&#8217;s the &#8220;beauty&#8221; of UGC.</p>

<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/0v8pJSGi4CA&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/0v8pJSGi4CA&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/mobile/android-solves-rubik-in-24-seconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brilliant Tech Video Ad</title>
		<link>http://www.olympum.com/internet/brilliant-tech-video-ad/</link>
		<comments>http://www.olympum.com/internet/brilliant-tech-video-ad/#comments</comments>
		<pubDate>Tue, 04 May 2010 21:04:08 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.olympum.com/?p=284</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/LNE0R3rEe5Q&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/LNE0R3rEe5Q&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/internet/brilliant-tech-video-ad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Apple, Flash and Java</title>
		<link>http://www.olympum.com/mobile/on-apple-flash-and-java/</link>
		<comments>http://www.olympum.com/mobile/on-apple-flash-and-java/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 23:25:43 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://www.olympum.com/mobile/on-apple-flash-and-java/</guid>
		<description><![CDATA[Steve Jobs said reportedly that Flash is buggy and that it won&#8217;t make it to the iPad and iPhone. The same story was used for Java, a technology that Steve Jobs described as not worth going onto the phone. However, I call B.S. on Apple&#8217;s arguments. Apple has decided not to ship Flash and Java [...]]]></description>
			<content:encoded><![CDATA[<p>Steve Jobs said reportedly that Flash is buggy and that it won&#8217;t make it to the iPad and iPhone. The same story was used for Java, a technology that Steve Jobs described as not worth going onto the phone. However, I call B.S. on Apple&#8217;s arguments. Apple has decided not to ship Flash and Java not because of the lack of intrinsic value and quality, but because if allowed these technologies would result in the vertical disintegration of the Apple platform.</p>

<p>Microsoft saw the same threat with Netscape and Java more than 15 years ago. When the application developers were developing for Windows, Microsoft was controlling the ecosystem, but most importantly, reaping the rewards of the complementary value generated the applications created by those developers. The more applications that were out there, the more users wanted to use Microsoft Windows.</p>

<p>But Netspace and Java were promoting a cross-platform environment with the famous write once, run anywhere. In the Internet, data formats and viewers are open, and any developer can create new applications. Being able to run those applications on multiple platforms is a significant advantage, especially in the context of the Internet. Microsoft reacted by exposing the Windows API, what developers were familiar with, through ActiveX and Internet Explorer. Developers could reuse their tools and code and use these to create great applications that would only run on Internet Explorer and Windows. Great apps attracted users, and more users attracted more developers. This is how Microsoft attacked the jugular of Netscape and Sun. Netscape eventually went bankrupt, but that&#8217;s probably partially because of its own doing.</p>

<p>To Apple, Flash and Java technologies pose the same cross-platform threat that Netscape and Java were to Microsoft. Apple wants to control the hardware, the operating system, and the content that goes onto the devices through iTunes. Apple is locking developers onto its own APIs and its own distribution system, controlling all the feedback loops that the Apple ecosystem has.</p>

<p>Steve Jobs clearly learned the lessons well from Bill Gates. By allowing the Flash and Java runtimes, Apple would be opening the door to competitor products and applications running on multiple platforms, which could result in users switching platform if a competitor platform would for example lower costs or subsidize users or developers. Today, developers, and users, are locked in to the Apple platform.</p>

<p>In a market where the economics of developing applications for the iPhone are not that attractive, allowing cross platform would result in killing the value of developing for that platform. Most developers cannot afford to write code in parallel for Symbian, Android and iPhone, as the cost of doing so would eat up whatever small margins they are now getting. But because the alternative platforms to the iPhone have even smaller margins, developers are &#8220;happy&#8221; to be locked into Apple.</p>

<p>However, such lock-in is dangerous as it is a vector of Apple becoming a monopoly in the portable computing device market. Apple might argue about how ensuring a perfect user experience is the main reason why they control the whole ecosystem. However, Apple not only controls the user experience, but the runtimes. Apple could allow Flash and Java runtimes, and only approve those applications complying with the user experience guidelines. However, it is not likely to do so, because it would be opening the door to make a competitor platform, namely Android, stronger.</p>

<p>This situation makes me highly upset. I still believe that the iPhone SDK is one order of magnitude better than what you get with Symbian, and still a few knots better than what Android has to offer. Symbian and Android suffer, although not on equal degrees, of the multiple identity problem. There is no one Symbian, there are many Symbians. There is no one Andriod, there are many Androids. This atomization of the device and the user experience makes the developer&#8217;s jobs significantly more complex than it ought to be.</p>

<p>Flash and Java have some of the same problems as Symbian or Android. Since the target platform is unknown, the developer has to work much harder to provide a user experience that works in all environments. It&#8217;s a trade off the developer opts in to. As a developer, I want to have the freedom to opt into a harder development environment, if that means getting cross-platform support because my business model so it requires. And until Apple gives me that, I won&#8217;t get anywhere close to the iPhone.</p>

<p>Apple needs a strong competitor, and the only one that is positioned to potentially become one is Nokia. Nokia unfortunately has been playing the disintegration harakiri game really well, and completely opened itself for a competitive attack. As a developer, I don&#8217;t care whatsoever what their internal device platform strategy, but externally, as a developer, and consequently as a user, I care about consistency of APIs, distribution channels, tools, etc. Now that Android Linux is becoming the standard for Java on the mobile phone, I wonder if all is left for Nokia is to become the standard for Flash and AIR on the mobile. Except, of course, if they really believe that they can compete with their own Linux distribution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/mobile/on-apple-flash-and-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Relocating to the US</title>
		<link>http://www.olympum.com/future/relocating-to-the-us/</link>
		<comments>http://www.olympum.com/future/relocating-to-the-us/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 07:11:40 +0000</pubDate>
		<dc:creator>Bruno Fernandez-Ruiz</dc:creator>
				<category><![CDATA[Future]]></category>

		<guid isPermaLink="false">http://www.olympum.com/future/relocating-to-the-us/</guid>
		<description><![CDATA[
Tomorrow, I&#8217;ll be flying to the US and leaving the UK. But this time, it&#8217;s different. Now, it&#8217;s a one way flight. But that flight is the end of a journey that started four months. A difficult journey full of live experiences.



Back in April, Yahoo made me an offer to move to California, with my [...]]]></description>
			<content:encoded><![CDATA[<p>
Tomorrow, I&#8217;ll be flying to the US and leaving the UK. But this time, it&#8217;s different. Now, it&#8217;s a one way flight. But that flight is the end of a journey that started four months. A difficult journey full of live experiences.
</p>

<p>
Back in April, Yahoo made me an offer to move to California, with my family, to take on a new role. Since then, we&#8217;ve had twins, boy and girl, moved house once, finished our ever-lasting DIY project, a little summer bungalow in the middle of Kent, only this time using contractors, sold our cars, packed everything, cancelled the school, the utilities, the direct debits, the payments, changed addresses, changed insurance policies, and finally put our lives on a plane.
</p>

<p>
And it is surprising how many things are broken, that you only realize when you get out of the usual cycle. Returns for faulty products that take weeks, P&amp;C carriers that don&#8217;t want to take your money. Or the complexity of servicing or selling your car when you only have one car. The utter absurdity of BT, making as pay 9 months of non-fulfilled line and broadband contract. A TV license officer poking around thinking that everybody in the UK must watch TV, actually the BBC, arguing that otherwise they are weirdos. A council planning officer arguing that our carport is closer to the highway than the main elevation of the house and asking us to pay for planning permission, even though every single aerial photograph shows they are incorrect. A school asking us to pay a full term of tuition, and then denying our daughter from attending. Or well, the length of processing the legal paperwork to work in the US with a Finnish-Spanish family.
</p>

<p>
It is also saddening, because of many things aren&#8217;t broken and we have to leave a little behind. Like the goodbye photo-book our eldest got yesterday from her classmates. Or our beloved Greek-German friends that we&#8217;ll miss so much. Or my mahogany Bechstein 1980 model M. Or my new Startrek home office. Or the beautiful views at dawn over the grazing land from our conservatory.
</p>

<p>
Tomorrow, a new exciting period in our lives starts. As much as I am sad about leaving, I am also thrilled about the opportunity to work for Yahoo! Inc in its Sunnyvale headquarters doing one of what I think is one of the most exciting jobs available in Yahoo! and in the industry. And it&#8217;s not just me me. We all are excited. The wife is clearly hoping for more days of sunshine, which should not be difficult to meet, easier life with children, and most definitely, not DIY in years to come.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.olympum.com/future/relocating-to-the-us/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
