Jeff Mesnil
Weblog · About

XML and JSON Pendulum Movement

December 22, 2010

A few weeks ago, I linked to James Clark's post about "XML vs the Web".

I concluded by writing that:

I believe than XML (and its associated technologies) will end up as an enterprise technology and a opaque content model (e.g. to save OpenOffice documents) and be less and less prevalent on the Web where HTML (with microformats) and JSON are better suited to represent data.

To sum up very broadly: XML for document, JSON for data.

Developers have been bitten by XML shortcomings for data exchange and moved to use JSON instead. It seems the benefits were (rightly) so convincing that there is now a pendulum movement away from XML and towards JSON for document representation. When all you have is a hammer...

Case in point: Apache Avro.

Avro defines a serialization system. It has very interesting features (rich data structures, binary format, schema inlined in the persisted files, etc.) and one shortcoming: it expresses its schema in JSON.

Here is an example from its documentation:

{
  "type": "record", 
  "name": "LongList",
  "aliases": ["LinkedLongs"],                      // old name for this
  "fields" : [
    {"name": "value", "type": "long"},             // each element has a long
    {"name": "next", "type": ["LongList", "null"]} // optional next element
  ]
}

Today, I spent too much time for the simple task of writing a schema in JSON to represent a map whose values were arrays of strings.

The signal-to-noise ratio when JSON is used to represent a schema is different to XSD or RelaxNG but not better.
Simple schemas are simple to express but the signal-to-noise ratio increases tenfold with the complexity of the schema. Funnily enough, XML Schema have an advantage here: they are very complex for the simplest schema but their ratio increases linearly with the schema complexity.

I don't think JSON is well suited to represent a document schema. A DSL is a better tool for this. For example, Google Protocol Buffers uses a simpler format to define their schema:

message Person {
  required int32 id = 1;
  required string name = 2;
  optional string email = 3;
}

I have not used protocol buffers enough to see how it changes with schema complexity but, at first glance, I expect it to remain more readable that a comparable JSON schema.

The difference between document and data depends on the use cases (you know it when you see it). But using JSON to represent a schema is a general step in the wrong direction to me. A DSL is a better tool for that.

After the "document representation" pendulum will have moved towards JSON too much and expose its shortcomings, I expect it to move again, away from JSON and towards DSL. Time will tell...

⇨ Uncharted 3: Drake's Deception Trailer

December 14, 2010

The trailer is quoting T.E Lawrence's Seven Pillars of Wisdom introduction (which is one of the best prose ever written) and there are cameo pictures of Lawrence wearing the english uniform and the traditional arabic dishdasha.

It makes me looking forward to playing this game.

⇨ WebSocket disabled in Firefox 4

December 8, 2010

This is a serious threat to the Internet and Websocket and not a browser specific issue. The protocol vulnerabilities also affect Java and Flash solutions. In a web environment that could for example mean that a widely used JavaScript file – like Google analytics – could be replaced on a cache you go through with a malware file.

I think Mozilla decision makes sense and they are right to be cautious.

I am interested by Web Sockets (I implemented a JavaScript library to use STOMP over Web Sockets for messaging) but we need to be very careful about opening a new communication channel between Web clients and servers. Web Sockets must integrate with the whole Web infrastructure (including caches and proxies) and not open a whole can of security issues.

The HTML5 Web Socket API has a lot of potental, especially now that it is available on iOS-based devices (I wrote a node.js-based application which uses it) but it is critical to get the protocol right before it is widespread.

Once Web Sockets are out in the wild, we will have to live with them for a long time, deal with their issues on our own and face ugly consequences for rushing it out.

⇨ Chromium Blog: A New Crankshaft for V8

December 7, 2010

Today we are introducing Crankshaft, a new compilation infrastructure for V8, Google Chrome's JavaScript engine. By using aggressive optimizations, Crankshaft dramatically improves the performance of compute-intensive JavaScript applications - often by more than a factor of two! This will give users a faster and more responsive experience loading web pages and applications built with complex JavaScript.

Since node.js is based on V8, I wonder if it can leverage this new infrastructure to improve its performance.

⇨ Who's Passing to Who

December 6, 2010

The guys at hoopism.com have created interesting diagrams connecting for each NBA team the passer to the scorer.

From the diagram above, we can see that Tony Parker assists were mainly for Tim Duncan and Richard Jefferson, while Manu Ginobili distribution is more diversified (George Hill, Dejuan Blair and Antonio McDyess in addition to Duncan and Jefferson).

As an aside, the diagrams at hoopism.com are drawn using a Processing-based Java applet. They are the single reason I activate Java Applets on my laptop...

(via TrueHoop)

⇨ Understanding the Nikon ISO Sensitivity Auto Control

December 6, 2010

The ISO Sensitivity Auto Control (ISO-AUTO), found under the Shooting Menu, is a powerful feature in many Nikon DSLR cameras. It's used to allow the camera to automatically control the ISO sensitivity and shutter speed, according to the light levels sensed by the camera. It's very helpful when you don't have time to deal with exposure issues—yet must get the pictures.

A good explanation to Nikon Auto ISO setting.

It is useful when shooting with a prime lens (35mm f/1.8) when the light conditions change because I know the minimum shutter speed I need to prevent blur.
However, I disable it when I use a zoom as the minimum shutter speed varies too much depending on the focal length (esp. with my 70-300mm).

⇨ New Luma Loop

December 5, 2010

I use a first-generation Loop with my Nikon D7000 and it is a great product that I heartily recommend.
With it, I can walk all day with the camera comfortably resting on my hip and hidden from sight by putting my hand on it.

The new version looks even better with a metallic connection instead of a plastic one:

They will soon offer to 1st-gen Loop customers a kit to upgrade to the new webbing and metal connection hardware of the new Loop. They can count on me to upgrade!

Luma's customer service is top notch: they once sent me an additional PodMount for free because the one I received did not meet their quality criteria even though it had no visible default.

Great products + great service = happy customer.

Michael Jordan: "Whatever Makes You Nervous"

December 1, 2010

Whenever Michael Jordan gets on the golf course and his friends ask the stakes of the game–how much money they're betting against one another–rumor has it that his stock response is: “Whatever makes you nervous.”

It's when we leave our comfort zone that we push our limits and give our best.

(via Chase Jarvis)

⇨ Nikon D7000 Review at dpreview.com

December 1, 2010

dpreview.com's conclusion:

The D7000 produces great image quality and feels very responsive in most shooting situations. It shines especially in low light. From a specification point of view a 16.3 MP resolution sensor, 6 frames per second continuous shooting, 1080p full HD video and an abundance of customization options place this camera firmly into the semi-pro segment of the market.

I bought the Nikon D7000 to upgrade from my old D60. I am very happy with it so far but I have not use it extensively since I get it mid-november.

My main complaints are minor:

  • I find the default Auto ISO setting difficult to understand and configure properly. When I use it, the flash warning is always blinking in the viewfinder even when there is enough light. I am using manual ISO setting until I understand what is going on.
  • the ISO button is hard to find when looking through the viewfinder. It would have been better positioned as the last button instead of the QUAL one. It is annoying that ISO control can not be assigned to the Fn or preview buttons.
  • the top screen is missing some information by default. I need to press the exposure compensation button to know the current step value. It also can't display both the ISO value and the remaining frames count.

Apart from that, I have no other gripes (yet...). The viewfinder is bright and its 100% coverage makes it a joy to look through.
I have seen only JPEG pictures as I am waiting for Aperture 3 to support its RAW format. Overall, the JPEG image quality is good and I am looking forward to seeing some RAWs.

I am not impressed by its video mode: the focus is not good at tracking subjects and it records too much sound noise from my 35mm f/1.8 when it autofocuses. I'll try to use manual focus when I shoot videos next... It's frustrating but not important: I bought this camera to take pictures, not to shoot video. Its video mode is a bonus.

I plan to stay on DX lenses for the near future (I enjoy using my 16-85mm and 35mm) and the Nikon D700 looks to be the best Nikon DX camera for amateurs on the market today.