Web Info & Tutorials

November 1st, 2006

GWT 1.2 RC: MAC OS X SUPPORT

Bret Taylor of GWT (and Mr. Google Maps btw :) has announced RC1 of Google Web Toolkit 1.2.

  • Full support for OS X development
    Develop with GWT on OS X as easily as on Linux and Windows
  • Much faster hosted mode
    Debug your GWT apps much more quickly. Hosted mode startup time has improved significantly — and even better, refreshes are now lightning-fast — even when your source code changes.
  • New HTTP request module
    The HTTP functionality that you’ve been asking for (custom headers, status code, timeouts, and more), all wrapped up in an API that’s easier to use than the JavaScript XMLHttpRequest object
  • Widgets in TreeItems
    Tree items can now contain arbitrary widgets — finally, it’s easy to create trees with checkboxes :-)

GWT is one of the frameworks that polarizes people.

On the one side: “Yay, I can stay in Java land!”

On the other side: “JavaScript isn’t a bad thing. GWT is bound to have a leaky abstraction so you will have to get under the hood at some point anyway”

November 1st, 2006

LEVERAGING HTML/JAVASCRIPT AND AJAX IN APOLLO APPLICATIONS

Chris Brichford gave a talk at Adobe MAX on Leveraging HTML and JavaScript within Apollo.

Here are some notes from the talk:

Overview of Apollo

Apollo is a cross-platform runtime that allows you to take your web skills to build desktop applications.

Your applications can be all Flash, all HTML, or a mixture of both.

The first demo showed an HTML Control Tester mixing an HTML window with Flash content behind. On the fly the application had controls to blur, rotate, change transparency, and it all still worked (e.g. links and such). Check out the video here to see using Google upside down :)

Motivation for supporting HTML

Realize that we need to be able to reuse the web application content for rich desktop applications, and want to leverage the knowledge of Ajax and CSS.

The use cases are:

  • Embedding a full browser: integrate live partner content, or building a dashboard
  • HTML UI: Text field on steroids, create UI widgets using HTML markup

HTML Support

HTML engine renders to Flash display list object, and can be treated as any other display list (e.g. filters, fransforms, opacitiy).

Considering using Flash fonts to render HTML text.

HTML form widgets will be visually consistent with your application so the user can’t tell what is Flash and what is HTML.

On the scripting side JavaScript and ActionScript object models are bidirectional and seamless.

HTML can be loaded from the network, URLRequest, ActionScript string, or an adobe-app:/ package.

HTML Engine Choice

Using WebCore and JavaScriptCore from the WebKit open source project.

They chose it because:

  • WebKit is mobile friendly.
  • WebKit is a small source code base for a modern HTML engine

Planning to keep Apollo in sync with Safari’s HTML and JavaScript support. So, if you support Safari, your Ajax app would work as-is inside Apollo.

Apollo will support Adobe Reader and Flash plugins.

API overview

Still in the works.

New ActionScript class called HTMLControl which is a subclass of Sprite and the default behaviour is modeled on an iframe.

You can subclass the HTMLControl yourself and change behaviour (e.g. what happens when a link is clicked, when window.open is called, when a form is submitted, etc).

A nice demo was Maptacular that was a mashup of Google Maps with application behaviour.

Key Takeaways

Unified HTML and Flash rendering pipelines.

Bridging JavaScript and ActionScript object model.

November 1st, 2006

MINIKIT: VISUAL EFFECT BAG

Candyscript has prepacked unitedly bits and pieces from moo.fx, nifty corners, and their possess accumulation to create Minikit:

Minikit entireness alone, but is transparently harmonious with mochikit. What this effectuation is that if you are using the mochikit library, minikit module ingest it’s features, which are crack to the more lightweight variant, which is built-in to minikit.

The think for this organisation is that mochikit - patch existence a strange accumulation - is a taste super to allow on publically covering sites. Minikit is quite diminutive in itself, which makes it multipurpose in said applications. On the another hand, your covering haw accomplish a filler where it makes significance to allow mochikit (or perhaps whatever packages from it), and minikit module then only verify plus of this.

There are of instruction online samples of the effects/widgets:

Minikit

November 1st, 2006

OPTIMIZING PAGE LOAD TIME

Aaron histrion of Google has free an article on Optimizing Page Load Time which came discover of his undergo optimizing tender alluviation nowadays for a high-profile Ajax application.

He starts soured conversation most “how such I could invoke interval cod to outside objects. Specifically, I looked into how the protocol computer feat in ordinary browsers and characteristics of ordinary cyberspace connections modify tender alluviation instance for pages with whatever diminutive objects.”

  • Neither IE nor Firefox board with HTTP pipelining
    enabled by default. This effectuation apiece letter has to be answered and its
    connection free up before the incoming letter crapper be sent. This incurs
    average player interval of the round-trip (ping) instance to the individual separated by
    the sort of connections allowed. Or if your computer has protocol keepalives
    disabled, doing added protocol three-way acknowledgment adds added ammo trip,
    doubling this latency.

  • By default, IE allows exclusive digit unpaid connections per hostname
    when conversation to HTTP/1.1 servers or eight-ish unpaid connections total.
    Firefox has kindred limits. Using up to quaternary hostnames instead of digit will
    give you more connections. (IP addresses don’t matter; the hostnames can
    all saucer to the aforementioned IP.)

  • Most line or telegram cyberspace connections hit asymmetric bandwidth, at
    rates aforementioned 1.5Mbit down/128Kbit up, 6Mbit down/512Kbit up, etc. Ratios of
    download to upload bandwidth are commonly in the 5:1 to 20:1 range. This
    means that for your users, a letter takes the aforementioned invoke of instance to send
    as it takes to obtain an goal of 5 to 20 nowadays the letter size.
    Requests are commonly around 500 bytes, so this should significantly impact
    objects that are diminutive than maybe 2.5k to 10k. This effectuation that serving
    small objects strength stingy the tender alluviation is bottlenecked on the users’
    upload bandwidth, as fantastic as that haw sound.

He necessary to manoeuvre the trenchant bandwidth of his users, and utilised the mass to road it via his logs:

<html>
<head>
<title></title>
<script type=“text/javascript”>
<!–
var began_loading = (new Date()).getTime();
function done_loading() {
 (new Image()).src = ‘/timer.gif?u=’ + self.location + ‘&t=’ +
  (((new Date()).getTime() - began_loading) / 1000);
}
// –>

</script>
<!–
Reference whatever outside javascript or stylesheets after the above block.
// –>

</head>
<body onload=“done_loading()”>
<!–
Put your connatural tender noesis here.
// –>

</body>
</html>
 

He then came up with tips to invoke tender alluviation time:

  • Turn on protocol keepalives for outside objects. Otherwise you add an player round-trip for every protocol request. If you are worried most touch orbicular computer unification limits, ordered the keepalive timeout to something short, aforementioned 5-10 seconds. Also countenance into bringing your noise noesis from a assorted webserver than your impulsive content. Having thousands of connections unstoppered to a empty downbound noise enter webserver crapper hap in aforementioned 10 megs of RAM total, whereas your important webserver strength easily verify 10 megs of RAM per connection.
  • Load less outside objects. Figure discover how to globally meaning the aforementioned digit or digit javascript files and digit or digit outside stylesheets instead of many; essay preprocessing them when you publicize them. If your UI uses mountain of tiny GIFs every over the place, study modify to CSS, which tends to not requirement so whatever of these.
  • If your users regularly alluviation a dozen or more uncached or uncachable objects per page, study evenly broad those objects over quaternary hostnames. This commonly effectuation your users crapper hit 4x as whatever unpaid connections to you. Without protocol pipelining, this results in their cipher interval descending to most 1/4 of what it was before.
  • Allow noise images, stylesheets, and javascript to be cached by the browser. This won’t hold the prototypal tender alluviation for a newborn user, but crapper substantially pace up ensuant ones.

    Set an Expires brick on everything you can, with a fellow life or modify months into the future. This tells the application it is alright to not revalidate on every request, which crapper add interval of at diminutive digit round-trip per goal per tender alluviation for no reason.

  • Minimize protocol letter size. Often cookies are ordered domain-wide, which
    means they are also unnecessarily dispatched by the application with every ikon request
    from within that domain. What might’ve been a 400 byte letter for an image
    could easily invoke into 1000 bytes or more erst you add the cake headers.
    If you hit a aggregation of uncached or uncachable objects per tender and big,
    domain-wide cookies, study using a removed field to patron static
    content, and be trusty to never ordered whatever cookies in it.

  • Minimize protocol salutation filler by sanctioning gzip densification for HTML and
    XML for browsers that hold it. For example, the 17k writing you are
    reading takes 90ms of the flooded downstream bandwidth of a individual on 1.5Mbit
    DSL. Or it module verify 37ms when shut to 6.8k. That’s 53ms soured of the
    full tender alluviation instance for a ultimate change. If your HTML is large and more
    redundant, you’ll wager an modify greater improvement.

    If you are brave, you could also essay to amount discover which ordered of browsers
    will appendage shut Javascript properly. (Hint: IE4 finished IE6 asks for
    its javascript compressed, then breaks seriously if you beam it that way.) Or
    look into Javascript obfuscators that field discover whitespace, comments, etc
    and commonly intend it downbound to 1/3 to 1/2 its example size.

  • Consider locating your diminutive objects (or a mirror or store of them)
    closer to your users in cost of meshwork latency. For large sites with a
    global reach, either ingest a advertizement Content Delivery
    Network
    , or add a
    colo within 50ms of 80% of your users and ingest digit of the whatever available
    methods
    for routing individual requests to your colo close them.

  • Regularly ingest your place from a graphic gain connection. Convincing
    the scheme developers on my send to ingest a “slow proxy” that simulates bad
    DSL in New Sjaelland (768Kbit down, 128Kbit up, 250ms RTT, 1% boat loss)
    rather than the lance ethernet a whatever milliseconds from the servers in the U.S.
    was a Brobdingnagian win. We institute and immobile a sort of usability and functional
    problems rattling quickly.

  • (Optional) Petition application vendors to invoke on protocol pipelining
    by choice on newborn browsers. Doing so module vanish whatever of the requirement for these
    tricks and attain such of the scheme see such faster for the cipher user.
    (Firefox has this unfit supposedly because whatever proxies and whatever versions
    of IIS turn on pipelined requests. But there are workarounds.)