Friday, July 10, 2009

Microformats: Reuse, don't reinvent

Orbitz engineer Mark Meeker has an introduction to microformats with examples


This is one of the best introductions I have found.

I found this Even Bill Gates wants you to use Microformats.



After some reflection, it seems that building an open source object model based upon hCard for people and organizations, hCalendar for events and rel-tags could be useful for many projects. How often do you end up reinventing classes for people, addresses and so on? With rel tags, you could define all sorts of relationships between people and institutions: you can add 'subsidiary', 'employee', 'retailer' and build all sorts of models for a wide range of business needs. If there was a simple object model, with some basic implementations in a few key frameworks, you could start coding from that rather than from scratch. This would also be useful for learning and comparing frameworks. Presumably, you could get a REST implementation, an XHTML view, and a WS-* web services almost free. You would also get the services in a format that would help others build mash-ups with your data.

Monday, July 6, 2009

The Story of REST: Representational State Transfer

Joe Gregario has provided a lucid description of REST at YouTube.
He has also provided a companion video on the Atom Publishing Protocol, which is described in the Wikipedia article on Rest is described as a canonical RESTful protocol. So Atom provides a great example of a real-world system that uses REST and Joe describes it clearly.


If you want a clear understanding of how to use Rest, this may be your best use of half an hour. If all you want to do is to grok Rest, Ryan Tomayako's How I Explained RESR To My Wife is a classic, and it only takes five to ten minutes.

If you have more time and really want to understand in greater detail, there is Roy Thomas Fielding's dissertation, Architectural Styles and
the Design of Network-based Software Architectures
.

For an actual implementation of a REST service, I am keen to use Grails. Grails has build-in support for REST. Grails also offers content negotiation. In HTTP, part of the request is a specification of the media type. Using content negotiation, the user agent can specify which format it prefers. This means that a URL for a person could return a portrait as image/jpeg, a hcard page via text/html, the vcard data as text/json, text/plain, text/xml, or text-plain. You could also use content negotiation to specify the language for the response. Suddenly URL seems to be the locator for a universal resource, as well as being the universal locator of a resource.

While it may be feasible to support multiple mime types at a single URL, it is not trivial to provide multiple representations of the same item. Even converting between two apparently similar data format has surprising complexity, as discussed in
Convert Atom documents to JSON at IBM Developer Works. The Developer Works also has a series of papers on Grails, which has specific examples of using Grails with Atom syndication.

Thursday, July 2, 2009

What HTTP reveals about your browser.

When surfing the web, is easy to feel that you are a relatively anonymous consumer of content. However, the HTTP traffic between your browser and the web server is a two way street. Henrik Gemal has provided browserspy.dk which has a series of queries that find our more about your browser than you probably know. Much of this information is potentially quite useful to the web site. The classic example is the HTTP_ACCEPT_ENCODING header that tells the server if your browser can accept compressed data. This can significantly reduce the size of a page. The other classic use is to identify Internet Explorer, the bane of JavaScript and CSS authors. But this is just the start. By knowing which version of Flash is installed, YouTube can warn you if you need to upgrade to view their video content. By sensing color depth and window size, a web site could determine an optimum image for me. This would be especially useful on a mobile device, where throughput and CPU limit battery life.

I would really like it if the geolocation information could be used to set the default country, state and city in web forms. In my case, the geolocation would have gotten me to Iowa, but would have placed me in Hiawatha rather than Marion. There is another geolocation demo that gets closer, but is still off by about 3 miles. I would like to be able to set a location, address and hcard info and have the option of using that on web forms. I would encourage more browser providers to support the navigator.geolocation object in the W3C Geolocation API.

But in my opinion, the scary information is from a CSS Exploit page. This exploit has been covered today in Slashdot. Web 2.o Collage will produce a collection of favicons of sites you have visited. What is most surprising to me is that this exploit by Brendon Boshell doesn't even require JavaScript. He has a Javascript version as well, which he describes in detail. So, unless you use one of the 'stealth modes' that don't record history, anyone can be checking to see if you have visited a particular site. Think about how that could facilitate a phishing attack.

Tuesday, June 30, 2009

V8 - the extremes

When it comes to the V8 Benchmarks, Chrome is still king, even on a Mac. Despite the fact that this is running under Parallels, Chrome 2 is almost twice as fast on the iMac as it is on the Dell at work.

Here is the real surprise. While every other browser ran faster on the iMac than the Dell, IE8 actually slowed down. But the slow down is almost entirely due to the final test, Splay. Google describes this test:
Data manipulation benchmark that deals with splay trees and exercises the automatic memory management subsystem (378 lines).
So it seems that the VM on the Mac can have performance issues with memory management.
If there is a problem with memory management, perhaps I should shut down all of the other applications and see if the numbers improve. Yup. Look at Splay: it went from 0.397 to 143.


So, running Parallels usually works fine, but in this case, it seems important to help the memory management along by closing down other applications. Still, it is IE8 which is far behind the other browsers in terms of JavaScript performance. Hey Microsoft, any chance you can keep up with the pack?

More V8 - on an iMac

After running the V8 benchmark suite at work, I am repeating at home. Home means a iMac with a 2.93 GHz Intel Core 3 Duo with 4 GB. I'm running Leopard (10.5.7). This time, I was more interested in looking at the improvements in Firefox 3.5 relative to Firefox 3.

But first, here are the results for Safari 2, this time running on OS/X.
For some reason, Blogger reverses the order of the images, so here we have the results for Firefox 3.5. There are two runs, one under OS/X and the other on XP. The XP version is running under Parallels. It sure looks like the VM running XP is very efficient: the Firefox numbers are within a few percent. They are also twice as fast the Dell Optiplex at work, even if the memory and clock speeds are quite similar.

Finally, we see the results of the old Firefox 3. The upgrade almost doubled the speed. So kudos to the Firefox team for the improvement in JavaScript performance. But we still have to recognize that the Webkit-based browsers are really dominating the JavaScript performance numbers.


V8 Benchmarks





Google's V8 Benchmark Suite is easy to run. Here are the results for several new browsers on my workstation, which is a Dell Optiplex GX620 with 2.79 GHz Pentium D and 3.49 GB of RAM. Wow. I didn't expect to see Webkit being this much faster. If my brand new Firefox 3.5 is given a relative score of 1, Safari 4 on Windows has a score of 7.5, Google Chrome has a relative score of 8.6. Internet Explore 8 has a score of 0.21. Webkit browsers have an order of magnitude better performance than Microsoft's flagship browser: IE8.

So, is Microsoft that bad a writing a JavaScript interpreter or are they trying to move us away from web standards like JavaScript and toward Silverlight?

Friday, June 19, 2009

Jef Jarvis and what to do next

Jeff Jarvis has more gray hair than me, but he really seems to understand the Internet. He may be best know as the author of What Would Google Do? You can read it online. Fora.tv has some lectures of his:
After listening to him, I am getting jazzed to try some Web 2.0 projects. He advocates being small, but being part of something big. So, what are some big things that we can expect to see? Here is something that comes to mind:

We all like images, and its probably the case that we have pictures all over the place that we like to access. I have pictures on Picasa, a friend has images on MobileMe, my wife has images on SmugMug and Flickr. My kids have images on FaceBook. This is probably pretty common. I don't want more ways to store images, I want a way to reference and search these images.

For images, I would like to have a linker site that lets me reference feeds, on line albums or even individual images on the Internet. Many of these sources provide titles, descriptions and other image metadata. Many images also have EXIF or IPTC metadata. What would be great would be a simple web interface to allow me to build a tool to subscript to several different sources and then subscribe to unified feed. Give the feed a URL and share with friends and family.

Even better, allow images to be linked to urls that identify people - hcard descriptions, home pages, FaceBook pages and so on. Then, you tag images (or better yet, some section of each image) with links to a person. The tags should have some 'types' like 'photographer/owner', 'model/subject' that show the relationship between the person and the image. Some key words links to images would also be great. They I could build feeds for all images linked to family in the last 6 months. Each of these dynamic albums could be given a URL on PubSubHubBub and expose the results has Media RSS. Then, anyone with a Media RSS viewer could see the feed in a browser. Open Iris and Slideshow Pro have inovative Media RSS viewers.