Web Info & Tutorials

February 12th, 2007

BISON: BINARY JSON

Binary Interchange Standard and Object Notation (BISON) is a new binary format created by Kai Jäger.

After seeing the direction AJ(AX) was going into with light web service protocols like JSON, I was wondering if I could come up with an even lighter binary protocol that would work with JavaScript. Not so much to replace XML or JSON but more as a proof of concept and to see if it was even possible. I ran into a couple of problems (some of which I talk about in the article), but I actually managed to write a working implementation of the protocol. Essentially, you can now serialize any JavaScript variable into a string that holds a binary representation of whatever you had in that variable. This string may then be sent over XMLHTTPRequest to a script running on a web server. JavaScript and PHP implementations are available from my blog and there’s also a few demos.

I can’t wait for someone to write an XML wrapper of the binary protocol ;)

February 12th, 2007

DOM STORAGE AND MICROFORMATS

John Resig has been writing about the bleeding edge features that will hopefully hit us around the Firefox 3 timeframe: DOM Storage and Microformat integration.

DOM Storage

John wanted to delve into DOM Storage and answered some of the questions posed such as:

  • What’s to stop a script from filling an entire storage area with random data?
  • Storing data to globalStorage[’localdomain’] (intranet global storage baybee)
  • What’s with the name “DOM Storage”? (It is bad isn't it)
  • The storage event
  • Server-side Data

Microformats

Michael has already started developing the solid Microformat Parser, with Andy Mitchell, that will go into Firefox 3. And since this is part of the overall Firefox 3 Content Handling Requirements, it's a big priority for inclusion.

So, what could this content-handling API mean for you, the Firefox extension developer? It means that you would be able to write quick-and-dirty JavaScript to handle matched Microformats - and it'd be blazingly fast.

For example, here's some pseudo-code (any final result will, most likely, be very very different):

JAVASCRIPT:
  1.  
  2. Microformats.addHandler("hcard", function(card){
  3.    var img = document.createElement("img");
  4.    img.src = "hcard.gif";
  5.    img.title = card.data.name + "'s Personal Information";
  6.    card.container.appendChild( img );
  7. });
  8.  

It is fun to hear about the new features. Thanks to John for getting the word out.

February 12th, 2007

PARSEURI: ANOTHER JAVASCRIPT URL PARSER

Steven Levithan saw the Poly9’s Polyvalent Javascript address Parser and thinks he has finished digit better.

He created parseUri and thinks it has advantages:

  • Ability to separate the directory line and enter name.
  • If a line factor was inform in the maker URL, it module ever convey a chase cutting as the terminal case in the directoryPath factor (this is cushy to vanish if a individual does not poverty this functionality).
  • Offers convenient, pre-concatenated commonly utilised factor pairs (authority = field + port; line = directoryPath + fileName).
  • Much device coefficient (literally exclusive a some lines of code).
  • Cleaner structure (e.g., parseUri(someUri).port).
  • Unlike the deciding code, it does not allow an extemely anaemic and imperfect endeavor at validation.
  • It’s such more flexible, since every address components are optional.
  • Uses preparation lawful countenance syntax.
  • More closly follows the generic URI structure description ordered in RFC 3986
  • Available in JavaScript and ColdFusion implementations.

So, Is there some leaner, meaner URI parser discover there?