Thursday, May 29, 2008

Google I/O 2

Second day, and we're off with Melissa as she describes some principles in play at google.

"Imagination is a muscle" is the one which resounds most soundly with me.


some good quotes from this presentation:

Henry Ford: customers wld say they wanted faster horses
Sam Walton: if you don't listen to your customers, someone else will



I'm now loitering at the "GWT and client/server communication" talk. At first I've been pointedly ignoring GWT; watching folks battle JSF has been a counter example for adopting release 1.0 technologies. I'll add more as it starts up, right now they are using crowbars to fit everyone into the room.

-- later, after bandwidth was restored.

The GWT talk was inspiring. What a huge hunk of work they have been doing.

Next"Using google data APIs from non javascript languages" Vidam Spivak.

covering Search, Feed and Language AJAX APIs. pivoting on RESTful interfaces.

JScript isn't considered to work in : latency sensitive websites, Flash/Silverlight, and server-side apps.

Vidam goes through a tour of the APIs as an overview.

The AJAX language API is cool; highlight text and it tries to figure out
the source language and translate.

layers:

JS controls & UI
JS runtime
RESTful data access


this talk focuses on the RESTful layer

- read only
- JSON

shows a CURL request ( bonus points )

FLASH crossdomain file is avail on google to allow
flash requsts against google - allows all requests ( silverlight too)

referrer -
specify URL where used, or your homepage or a google ID

limits:
search returns 32 results
lang 500 characters
feed 100 feed entries

--- examples,
"faster AJAX"
use DOMContentLoaded - its faster than an OnLoad handler, works cross browser
possible to have the call to G use your function to handle the content on their side before it is returned, cool.


Flash: ActionSctript 3 use HTTPService, layout via MXML, and jason parser 'corelib' for AScript.


Server side example;: Facebooj App, Google App Engine, Google AJAX.
URL Fetch API from APPs pythong
simplejson
gminifb ( minimal facebook developer app in python )

in facebook translates wall postings to target language using google translation
API. nice.

examples at code.ggoogle.com/p/google-ajax-examples

--- next: server side javascript.

hah! let's see how this has come along since the old LiveWire days. I used to make a living running a small consulting firm doing LiveWire consulting. but that's another story - time to fight geeks for sandwiches.

RHINO - great lecture, highly entertaining. who the heck is this guy?

---


Reusing Google APIs with GWT. - migueal mendez

a specific project for the GWT.

GALGWT ( GWT is pronounced "gwit" )

opensource bindings for Google JS APIs.
Project for each API has individual JAR file, doc, etc.
supports Search, gadgets, Gears and Maps.

techniques -
containment ( java holds JS object you access )
JSIO google API interop. allws one to extend JS objects in Java etc.
JavaScriptObject in Java

in GWT 1.5 you cfan declare types which overlay JS objects.

Search overview -

condfigure SearchControlOptions
add options to the SearchControl
add SearchControl to the page
execute searches on the search control

Inspect the reults with a Search Listener . Listner callback gets updates
from search engine.

Gadgets overview -
( go to iGoogle to see a gadget )
extend Gadget class
implement each of the NeedsXXX interfaces for that it needs.
can make XHRs from gadget.
gadget suppport via Generator and Linker
need Gadget container to test against ( iGoogle, shindig, opensocial )


Gears overview
exposes Database, LocalServer and WorkerPool JS modules.
provides an Offline module which automates process of going offline.
provide GWT rebind prop to test for existence of gears, so your app can adopt if gears isnt' present.
"hosted mode" only supports IE on Windows
cannot debug WorkerPool workers currently

Maps overview
exposes Maps API w/cleanup
allows GWT widgets to be added to InfoWindows
Extend the Maps API using Java
( watch out for Maps keys issues )

( the example is dirt simple )

milestone builds:
gode.google.com/p/gwt-google-apis

--- Turbo GWT

First - GwtQuery
- like jQuery, query the DOM. uses what is available: XPath, W3C Selector, getElementsByClassName...
compile0time CSS3 Selector parsing

each browser gets separately compiled JS. ( neat )

!check out GWTQuery at http://gwtquery.com

Second - High power graphics. Display Lists

immediate mode vrs retained mode
-Canvas vs SVG/VML
JS VM top out beween 1-10K method calls on canvas
inserting DOM objects vrs canvas calls.
idea: record and optimize desired graphics calls

Chronoscope Chart library
renders 30K+ interactive rates
supports javascript, flash, applet, servlet and android due to GWT capabilities.

demo: graphing millions of datapoints of all the google trades ( about one a second )
over the last few months. smooth scaling and zooming. the crowd goes wild as seamless zooming from months to seconds scale

Third - GWT with other environments.

GWT and servlets is a given.
Also to browser, via JS calls.
what about RPC to Flash, Android, "Gears Workers?"

write once and publish gadget ti other containers -

"Syndroid" a prototype demo is given. This guy is amazingly talented.

Wednesday, May 28, 2008

Google I/O

I managed to get to the SF Google I/O conference today. I will admit that this is rather interesting.

I missed the Guice presentation in favor of an overview of the Google App APIs and application integration. The latter started so late perhaps I made the wrong choice.

The App APIs look like an easy reach for Sakai. I'll have to go to the authentication session later today, and then look at provisioning.

Now I'm attending a "get google apps running on your mac foo" workshop. Let's see how that goes. My Python is a bit rusty.

( later ) That was too easy. there were some typos in the presentation ( all of them so far ) and the hands on code was missing some python page template content ( ! ) but it really works nicely. I still want an IDE for setting breakpoints.

ach this is all HTTP. too bad. it would have to use anonomized IDs on the google side with a resolution table in the secure side. no threads. no C using Python APIs.

-- later, some notes on the "inside the app datastore" chat.

Google app datastore: bigtable. New term for me: "sharded data." This refers to splitting data across several servers. I've done that but I didn't know the name.

this datastore is a big array. a set of arrays, when you consider the indexes. lots of scanning; they must have a special filesystem at work here. This thing just hammers across the array.

So one can build all these tables. and their indexes. and composite indexes. The presenter is really dancing around how much all this costs the developer. the presenter sez "Im not a PM, and we don't want to charge for composite indexes because that will cause you the app developer to do all sorts of crazy things."

presentation is straightforward. slides look like LATEX.

interesting bit on expando rows; you won't find records for those expandos which lack an attribute used in a compound key. suggestion; reflect across the expando before storing it. (?) I must of missed something there, I guess your app wld keep track of what new attributes had been added in the past and force those attributes on new records? hmm.

transactions - timestamp journals. related things are bundled into "entity groups"

-- later, "Auth to Google APIs"

revocable token.

ClientLogin: lives on app on hardware owned by the user. does deal with users original creds. like cell phone, cant' easily redirect. token expires after a while. one HTTPS POST, U/Pwd, service name ( which Google API) get token back from google. CAPTCHA may be involved. Auth token returned, stuff it into your Authorization header. Nothing prevents a web site from using this approach.


AuthSub: user redirect to google, they auth w/ creds, and are redirected back to you. Tokens can be long-lived. Two redirects; one over and then back. provide an endpoint for the callback. Can be tightly scoped or wide; one token for calendar, contacts & docs. ( yer token is a one time token which is easily upgraded to a long lived session )

Secure AuthSub: so far token is in clear text. to get past that a domain may be registered with Google. during registration provide a public key. it will be used by google to encrypt the token. there is an interesting handshake between you and google where they confirm you administer the domain - for example a special .html file you publish w/in your domain containing data generated during the registration process. cool.

OAuth: "Upcoming standard which looks like AuthSub." Registration, HTTPS req for scoped token, redirects back and forth. finally sign all following requests.

lots of client libraries. hmm, perhaps not; java 1.5 and X. available now.