Activate your free membership today | Log-in

Thursday, November 20th, 2008

CDNs Gaining Broader Use with JavaScript Libraries

Category: Ajax, Cloud, Ext, Yahoo!, jQuery

YUI and Google

Most everyone knows that Google has really stepped up to the plate by helping many JavaScript library projects host their builds on the Google AJAX Libraries API. Apart from providing a central distribution point for these libraries, the bandwidth cost savings alone go a long way in helping frameworks service there users in a sustainable manner.

Google continues it’s commitment to helping out by adding the Yahoo UI to the growing list of supported JavaScript libraries.

Thanks to Vadim Spivak at Google and Dion Almaer (now at Mozilla) for helping to make this additional option available to the YUI developer community. We love that Google is supporting web developers in this way — grabbing YUI files from Google’s global infrastructure is a fantastic option to have.

This is great news for YUI developers who now have a choice of linking directly to YUI via yui.yahooapis.com and ajax.googleapis.com. YUI team lead, Eric Miraglia, has a great write-up on the YUI blog about this and goes into detail on how the framework’s users can take advantage of this new hosting option.

jQuery and Amazon CloudFront

With nearly 2.5 million requests per day to the jQuery website, the jQuery project team is constantly on the look out for ways to decrease hosting costs while still managing the growing number of requests for the site’s resources. Originally leveraging Amazon S3 for many of their static pages, the project has now turned to Amazon’s new CloudFront CDN. The change has allowed for jQuery pages to be globally hosted as opposed to being centrally located in Amazon’s Seattle-based S3 hosting center.

In tests, John Resig, team lead for the jQuery project, noticed substantial performance gains based on the switch:

I ran a similar test here in Boston and even managed to see a large improvement. I was seeing latency of anywhere from 50-200ms on Amazon S3, but only a latency of 17-19ms with CloudFront.

What does all of this mean? It means that the jQuery site is going to load even faster than it does now. We already receive some excellent hosting from Media Temple but being able to off-load these static files to the fast-loading servers will only make for a better browsing experience.

In less than 24 hours the project had received almost 2.5 million requests for over 50GB of data. The only drawback is an increase in bandwidth costs but still substantially less than that of a traditional hosting plan. The jQuery project makes use of the Google AJAX API as well and recommends it as choice for linking to the jQuery and jQuery UI libraries.

Ext JS and CacheFly

The team at Ext JS has taken an interesting approach to CDN usage by extending their library build manager to allow users to host their own custom build on the CacheFly CDN.

The hosting is free and what makes it unique to something like the Google CDN is that it allows Ext developers a central access point for their own custom builds.

We are pleased to announce that Ext has partnered with CacheFly, a global content network, to provide free CDN hosting for the Ext JS framework. Cachefly’s globally distributed network and aggressive caching accelerate the delivery of web content like JavaScript and CSS, making for an even faster Ext experience.

Posted by Rey Bango at 11:16 am
Comment here

++++-
4 rating from 1 votes

Liquid Canvas: Draw inside canvas with a DSL

Category: Canvas, jQuery

JAVASCRIPT:
  1.  
  2. $(window).load(function() {
  3.   $("#example").liquidCanvas(
  4.     "[shadow border gradient] => roundedRect{radius:50}");
  5. });
  6.  

This is an example of Liquid Canvas, a new library from Steffen Rusitschka who created ShadedBorder and RUZEE.Borders.

Liquid Canvas is a JavaScript library which allows you to draw inside an HTML canvas element with an easy yet powerful description language.

  • Automatic generation of HTML canvas elements which scale with their HTML container, e.g. a floating DIV
  • Abstraction of canvas - each HTML element gets a "paint" method
  • Works with plugins for rendering
  • Loads of plugins already exist
  • Own plugins are possible
  • Simplified render language for plugin-based rendering
  • Rendering language uses a CSS-like syntax for plugin styles
  • Based on HTML Canvas, jQuery, ExplorerCanvas
  • Tested on Firefox, Internet Explorer, Safari, Chrome

Posted by Dion Almaer at 8:11 am
1 Comment

+++--
3.8 rating from 5 votes

Creating Custom Protocol Handlers With HTML 5 and Firefox

Category: Firefox, HTML

Via Myk Melez comes word that Firefox 3 supports HTML 5 web protocol handlers, which I had not realized before. These are really nifty:

JAVASCRIPT:
  1. window.navigator.registerProtocolHandler("mailto",
  2.                                   "https://www.example.com/?uri=%s",
  3.                                   "Example Mail");

This code creates a protocol handler for www.example.com that makes mailto links direct the user to the www.example.com web application, inserting the link into the URL given replacing the %s value. The final argument is the title of the protocol handler to present to the user.

There are obviously security limitations around this:

Note: Web sites may only register protocol handlers for themselves. For security reasons, it's not possible for an extension or web site to register protocol handlers targeting other sites...The URL template supplied when registering must be of the same domain as the webpage attempting to perform the registration or the registration will fail. For example, http://example.com/homepage.html can register a protocol handler for http://example.com/handle_mailto/%s, but not for http://example.org/handle_mailto/%s.

The user will be prompted on whether they want to allow this protocol handler:

Now, when the user clicks on a link that has a registered protocol handler, they will be prompted on how to work with it:

This feature is documented in the HTML 5 spec. You can find documentation on Firefox's implementation here and here.

Posted by Brad Neuberg at 7:00 am
2 Comments

++---
2.4 rating from 5 votes

This Week in HTML 5: Video tag changes

Category: HTML

Mark Pilgrim is back telling us what is new in the world of HTML 5 and focuses on changes with the video tag and API:

The big news this week is a major revamping of how browsers should process multimedia in the <audio> and <video> elements.

r2404 makes a number of important changes. First, the canPlayType() method has moved from the navigator object to HTMLMediaElement (i.e. a specific <audio> or <video> element), and it now returns a string rather than an integer. [canPlayType() discussion]

The canPlayType(type) method must return the string "no" if type is a type that the user agent knows it cannot render; it must return "probably" if the user agent is confident that the type represents a media resource that it can render if used in with this audio or video element; and it must return "maybe" otherwise. Implementors are encouraged to return "maybe" unless the type can be confidently established as being supported or not. Generally, a user agent should never return "probably" if the type doesn't have a codecs parameter.

Wait, what codecs parameter? That's the second major change: the <source type> attribute (which previously could only contain a MIME type like "video/mp4", which is insufficient to determine playability) can now contain a MIME type and a codecs parameter. As specified in RFC 4281, the codecs parameter specifies the specific codecs used by the individual streams within the audio/video container. The section on the type attribute contains several examples of using the codecs parameter.

Video and the Open Web is a huge issue. The idea of having video be a native object that other components can integrate with (e.g. rotate in canvas) is great. We need codecs implemented. We need penetration. We need more.

Posted by Dion Almaer at 6:58 am
2 Comments

+++--
3.2 rating from 5 votes

Microsoft LiveFX: Apps that look like a browser

Category: .NET

Regardless of whether you’re in the Google camp or in the Microsoft camp, I think it’s a fair statement to say that these differences of viewpoint accurately reflect each company’s core strength and focus: Google wants the browser to grow to subsume the desktop; Microsoft wants the desktop to grow to subsume the cloud.

This was the concluding paragraph in a post by Danny Thorpe of Microsoft (and formerly Google).

His post is itself a rebuttal on Dare's article: Live Framework (LiveFX), Is it Microsoft's GData or Something More?:

A number of LiveFX's additional features such as synchronization and resource introspection which have no analog in GData are fairly interesting and I wouldn't be surprised to see these ideas get further traction in the industry. On the flip side, the client-side Live Operating Environment is a technology whose benefits elude me. I admit it is kind of cool but I can't see its utility.

Danny answers:

The answer, in a word, is “offline.”

The local Live Operating Environment (local LOE) is what makes running mesh-enabled web applications on the desktop, outside the browser, possible. The local LOE creates and manages a sandboxed execution environment for the mesh app, just like a browser would for an HTML+JavaScript or Silverlight application but without the browser UI frame looming overhead.

It seems like a trivial thing, whether or not the browser frame surrounds your app UI. Does it matter? The answer is yes - having your app surrounded by browser UI constantly and forcibly reminds the user that this isn’t a real app, it’s just a web page with lipstick.

The Live Framework local LOE is a client application that works like a browser. It may even create an instance of the browser internally (I don’t know the internal details of the LOE) but it is fundamentally treated as “not the browser.”

I am trying to wrap my mind around this all myself :)

Posted by Dion Almaer at 5:04 am
7 Comments

+----
1.5 rating from 12 votes

Wednesday, November 19th, 2008

Canvas in 3D

Category: Canvas

Peter Nederlof of the infamous Dutch "Lost Boys" created a 3D engine in Canvas.

Flickr mashup with photos on a 3D plane

Straight from the horse's mouth:

I've been working on a 3D engine on canvas for some time, and as I was posting a message on our blog, I figured you guys might be interrested as well :)

The demo is over here: http://www.xs4all.nl/~peterned/3d/

Another (completely useless but fun to watch) one is over here (and
using chrome is strongly advised): http://www.xs4all.nl/~peterned/3d/psychedelic3D.html

Ultimately the purpose of this engine would be to provide an easy to
use platform/interface for creating 3D stuff, from degrading interface
elements for sites, to complete games. Collada support is en route,
and with squirrelfish hitting air, I'm considering trying that too :)

More details are available on the Lost Boys blog.

Posted by Chris Heilmann at 10:33 am
11 Comments

++++-
4.6 rating from 28 votes

EtherPad: Collab your script

Category: Utility

Aaron Iba of AppJet has announced EtherPad a very cool product that is near and dear to Ben and I as we play with dev tools on the Web. I will let Aaron talk about it in his words:

It's a realtime collaborative text editor that runs in a web browser
(IE6+, FF1.5+, Safari 3+). It's implemented entirely in JavaScript
(server, client, and database), which I think speaks to the power of
JavaScript as a language.

It's great for anyone who wants to collaborate on a text document, but
especially great for JavaScrpt programmers to collaborate because it
supports realtime text highlighting of JavaScript source code. (To
enable this feature, click on the checkbox under "options" on the
right side of the screen).

In addition to being a cool product on its own, EtherPad is also the
first product built and hosted on the AppJet Web Platform. The AppJet
Web Platform is like a "grownup" version of the current appjet. It
will feature a JavaScript framework for writing client and server code
(think "JavaScript on Jets"), an in-memory database of JavaScript
objects, and utility hosting on our grid.

Posted by Dion Almaer at 7:01 am
8 Comments

++++-
4.6 rating from 19 votes

The Ajax side of AIR

Category: Adobe, Aptana

AIR 1.5 has been released at MAX this week.

For the folks that like to write AIR apps that at least have some JavaScript, you will be happy to see that WebKit has been updated:

The version of WebKit included in AIR has been updated to a newer version. The updated version includes Squirrelfish, a new bytecode interpreter that improves the execution speed of JavaScript for common actions. Our internal tests show that HTML-based AIR applications run as much as 35% faster for many types of operations. We have also added support for interactive debuggin fo Ajax-based AIR applications.

There is also a nice sample app that uses jQuery called BlackbookSafe.

Aptana is also helping you out with their new Studio plugin for AIR debugging:

Today's release of the Adobe AIR Development Plug-in for Aptana Studio (beta) features, you guessed it — JavaScript debugging for Adobe AIR apps along with support for Adobe AIR 1.5 which Adobe announced earlier this week.

Posted by Dion Almaer at 6:02 am
3 Comments

++++-
4.3 rating from 7 votes

How Flash Can Join The Open Web

Category: Editorial, Flash, HTML

As it is Adobe MAX this week, there is a lot of talk about the Flash platform. How does this relate to the Open Web? Well, it turns out that Dion and I have been discussing how Flash can join and become a part of the Open Web.

Dion kicks things off with his blog post "The Flash Platform: How Adobe could join the Open Web to take on...". He first talks about how developers see Flash today versus other options:

Adobe (via Macromedia) has traditionally been a Web designer company, but developers haven’t jumped in to the same degree (note: not to say they haven’t been wildly successful!). I think that the perception is something like this:

Dion discusses how Adobe has an opportunity to position themselves relative to Silverlight much more strongly in the Open Web camp:

With Silverlight making a huge charge I worry about a world where you have “Best viewed in Silverlight and IE” (which in fact is “only viewed in…”) and people often ask: “But isn’t Flash just as bad?”

Adobe has an opportunity here. They can move to the right and Flash could become strongly in the Open Web camp. Then we would all be stronger as we come up against Silverlight :)

The next logical question related to this is open sourcing Flash:

The conversation tends to end up with opensourcing Flash, which I think will happen at some point through necessity, and the sooner the better (for everyones sake). Flex has a loyal base and has some open source help, but hasn’t gotten the love that it could get because it sits on top of something that isn’t open source itself. It is hard to get excited about an open source tech that sits on top of the same vendors proprietary platform!

I agree with Dion that open sourcing Flash and having it join the Open Web camp is a very compelling idea. Open source would just be the first step, though, so following up on Dion's post I put together an editorial titled "How Flash Can Integrate With The Open Web":

As Dion points out open sourcing Flash is one big part of making this happen, but another huge aspect would be to have Flash and Flex integrate better into the web stack and be less of a 'black box' on the screen...The important point is to integrate Flash and Flex more deeply into how the Open Web works:

  1. Cross-Platform Standards
  2. No Vendor Lock-in
  3. Anyone Can Innovate
  4. Powerful, Universal Clients
  5. Open Source Implementations
  6. Mashable, Searchable, and Integrated

I give a list of suggested ways to do this; the important thing is to have Flash integrate more deeply -- these are just some suggestions to kick things off. Here are some of them; click on them to read more in-depth how this might work:

I wrap up with a conclusion:

At the end of the day Adobe is a tools company, a really damn good tools company actually. Doing the above should allow Adobe to continue creating powerful tools that help authors and content creators while expanding the size of the market they can target.

The above list was just a suggestion to kick things off. The real focus is on having Flash integrate into the web stack better itself (and evolving both Flash and the web stack themselves into the future).

How do you see this happening?

Posted by Brad Neuberg at 6:00 am
9 Comments

+++--
3.4 rating from 14 votes

When generated JavaScript goes wild; JavaScript WTF in SharePoint

Category: Fun

The JavaScript below was pointed out by Aaron Newton, and it comes from SharePoint. Jim Wilson said about it: "and we wonder why windows has 40 million lines of code."

JAVASCRIPT:
  1.  
  2. function DeferCall() {
  3.         if (arguments.length == 0) {
  4.                 return null;
  5.         }
  6.         var args = arguments;
  7.         var fn = null;
  8.         if (browseris.ie5up || browseris.nav6up) {
  9.                 eval("if (typeof(" + args[0] + ")=='function') { fn=" + args[0] + "; }");
  10.         }
  11.         if (fn == null) { return null; }
  12.         if (args.length == 1) {
  13.          return fn();
  14.         } else if (args.length == 2) {
  15.                 return fn(args[1]);
  16.         } else if (args.length == 3) {
  17.                 return fn(args[1], args[2]);
  18.         } else if (args.length == 4) {
  19.                 return fn(args[1], args[2], args[3]);
  20.         } else if (args.length == 5) {
  21.                 return fn(args[1], args[2], args[3], args[4]);
  22.         } else if (args.length == 6) {
  23.                 return fn(args[1], args[2], args[3], args[4], args[5]);
  24.         } else if (args.length == 7) {
  25.                 return fn(args[1], args[2], args[3], args[4], args[5], args[6]);
  26.         } else if (args.length == 8) {
  27.                 return fn(args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
  28.         } else if (args.length == 9) {
  29.                 return fn(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);
  30.         } else if (args.length == 10) {
  31.                 return fn(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);
  32.         } else {
  33.                 var L_TooManyDefers_Text = "Too many arguments passed to DeferCall"
  34.                 alert(L_TooManyDefers_Text);
  35.         }
  36.         return null;
  37. }
  38.  

Posted by Dion Almaer at 5:00 am
13 Comments

++++-
4.5 rating from 26 votes

Tuesday, November 18th, 2008

Live Blogging the Yahoo BrowserPlus Release Party

Category: Browsers, Plugins, Yahoo!

Austin Chau and I are here on the Yahoo campus for the Yahoo BrowserPlus release party. I'm going to blog the event as it happens here (Disclosure: I work for Google with the Open Web Advocacy and Gears teams).

First, Ernest Delgado, Canvas whiz here at Yahoo, sent me a cool demo showing a prototype he and Michael Johnston made of Yahoo Maps and Flickr integrating with Yahoo BrowserPlus using the native gyroscope on Macs. You just hit the side of the laptop, for example, in order to jump to the next Flickr picture, or tip your laptop to zoom around a Yahoo Map:

Eric Miraglia is opening the release party up with a nice Introduction to YUI:

* Starts with some really nice demos of things you can create in the browser using YUI.
* Underlying technologies driving browsers are very complicated.
* About 7 knowledge areas needed for web development -- each is different than the standard, with bugs and specialized expert knowledge. You get about 672 different permutations of things needed for you to know and test on.
* YUI focused on "A-grade browser support".
* Good to target toolkits like YUI, since it helps you be future-compatible when new browsers appear like iPhone and Google Chrome
* Goal of YUI: Have a sophisticated widget like a rich text editor work cross-browser using just a snippet small snippet of code.
* Also want things to be automatically accessible.
* Progressive enhancement should be easy and possible, showing a cool demo of hierarchical menus still being readable on Lynx, a version of Firefox with no JavaScript, and then a full IE with CSS and JavaScript on.
* YUI is ala carte, file sizes are small, between 15 and 30K for any given component (including gziped)
* Deployed at Yahoo for three years, on every major property, 400 million users/browsers consuming YUI every month. In properties like Flickr and on the front page, well tested.
* YUI in lots of places: iGoogle, Wall Street Journal, Mozilla, LinkedIn, Southwest.com, Obama website, more
* ~1,000,000 external downloads

Now Lloyd Hilaiel is getting up to present on Yahoo BrowserPlus, the focus of today's event:

* The teams motivations: people get browsers -- browsers could be so much more -- plugins aren't working! Takes too long for new innovations to propagate (5-7 years)!
* Non-goals: no fixing web UI, no web outside the web (like AIR or Mozilla Prism), no improving JavaScript (that's the domain of YUI, JQuery, Dojo, etc.)
* YES to new web features with low overhead. Low overhead: low intellectual overhead, low overhead to implement and get it into widespread production
* Plugins have strengths (scriptable, cross-browser), but they have problems... installing them sucks, writing them is hard, sharing doesn't happen, updating is clumsy, securing them is hard
* BrowserPlus enables in-browser desktop applications
* Abstraction layer over web plugins. Implements all the stuff common to web plugs, decreasing cost of development and helping end users with management and installation
* User install core platform just once
* Page requests distinct services it wants to use, if not installed user is prompted to accept services and they are installed on the fly
* Demo of Flickr uploader working in browser using Yahoo BrowserPlus - drag and drop into browser of images, even folders for recursive uploading, 100% leveraging client-side functionality, multiple file selection.
* Demo of a BrowserPlus marble maze game using the Mac's motion sensor that exposes a single function that gives the laptop's x and y position and acceleration. Idea is that you can expose simple functions for custom hardware -- rest of app can just use web technologies.
* Demo where you can drop a file into a page and then work with the files contents, service coming out soon. Took just one day for them to create. Imagine dragging and dropping vCards or iCal files for example for a web-based calendering system.
* Demo showing desktop notifications
* Services installed on demand, no more monolithic plugins -- instead smaller services, installation seemless, no browser restarts
* Authoring of new services currently restricted to Yahoo and partners
* BrowserPlus will be Open Source! Goal is to have Service API and services open source by end of year, everything else by mid next year.
* Need to figure out how to protect end-users while removing Yahoo from the loop of handling serving up the services
* Yahoo roles: consumer of the platform and the project maintainer (bug fixes, feature requested, service adoption)

After a short break the team (Lloyd Hilaiel, Steve Spencer, David Grigsby, and Gordon Durand) did a deep dive on the Yahoo BrowserPlus architecture, security model, user-facing interaction, how web developers interact with it, and how to create your own services. There is some really impressive engineering in here; they've tackled some hard problems. There's lots of great material they went over, too much to summarize here. You can download the presentations from here in Keynote format.

Here's a snippet of using BrowserPlus from some JavaScript:

Desktop notifications:

JAVASCRIPT:
  1.  
  2. BPTool.Notify.create().show("My Title", "My Message");
  3.  

Drop-in uploading widget:

JAVASCRIPT:
  1.  
  2. BPTool.Uploader.create("uploader", {uploadUrl: "up.php"}).render();
  3.  

Check out the full developer docs that went live for more details.

Services are either binary shared libraries (.so or .dll) or Ruby script! The Ruby interpreter itself is a Yahoo BrowserPlus service that other services can use (services can be composed together and can work with each other, similar to how Unix utilities work with piping).

Posted by Brad Neuberg at 7:36 pm
1 Comment

+++-