SlideShare une entreprise Scribd logo
1  sur  84
Télécharger pour lire hors ligne
Google Back to Front
From Gears to App Engine, and beyond
Interesting, passionate, times
We
                      Believe...




The Web is the platform of today,
      and of the future
Act One
The Client
Top Grossing Film of 1957   Top Grossing Film of 2007
“Gimme Offline!”
It takes too long to update the Web
What is the philosophy?
          Do for offline what XMLHttpRequest did for web apps



     Ajax Libraries                   Gears Libraries
Dojo, jQuery, Prototype, GWT          Dojo Offline, GWT




  XMLHttpRequest                          Gears




       Open Web                         Open Web
Database
                             Embedded using SQLite
                            Contributed Full Text Search



var db = google.gears.factory.create('beta.database', '1.0');
db.open('database-demo');

db.execute('create table if not exists Demo (Phrase varchar(255),
Timestamp int)');
db.execute('insert into Demo values (?, ?)', [phrase, currTime]);
GearsDB
                       Abstract over the API

var bob = {id: 3, name: 'Bob', url: 'http://bob.com', description: 'whee'};
db.insertRow('person', bob);
db.insertRow('person', bob, 'name = ?', ['Bob']);

db.selectAll('select * from person', null, function(person) {
  document.getElementById('selectAll').innerHTML += ' ' + person.name;
});

var person = db.selectRow('person', 'id = 1');

// update
person.name = 'Harry';
db.updateRow('person', person);
person = db.selectRow('person', 'id = 1');

// force
person.name = 'Sally';
db.forceRow('person', person);
person = db.selectRow('person', 'id = 1');

db.deleteRow('person', bob);
GearsORM
         Are we going to get a GearsHibernate?


var Person = new GearsOrm.Model(quot;Personquot;, {
  firstName: GearsOrm.Fields.String({maxLength:25}),
  lastName: GearsOrm.Fields.String({maxLength:25})
});

GearsORM.Transaction(function() {            “While developing transaction support for
  new Person({name:quot;Johnquot;}).save();        GearsORM i had to write a test, in that test it
                                         execute 100 inserts and 100 updates, this test take
  new Person({name:quot;Doequot;}).save();        about 15 seconds for the inserts and about 10
                                        seconds for the updates without transactions,when
});                                         using transactions for each set it takes about
                                           377ms for the inserts and 200ms for the
                                                        updates that is about
Person.select(quot;firstName = 'Uriel'quot;);                    39 times faster!”
Person.count(quot;lastName = ?quot;,[quot;Katzquot;])
GearShift
              DB Migrations for Gears

Gearshift.rules[1] = {
   // create the demo table
   up: function() {
       return this.e(quot;CREATE TABLE demo_table (
                id INTEGER PRIMARY KEY
                AUTOINCREMENT,
                name VARCHAR(30),
                movie VARCHAR(30)
          )quot;).success;
   },
   down: function() {
       return this.e(quot;DROP TABLE demo_tablequot;).success;
   }
};
Database Tools
Buxfer
Full Text Search
• Gears added FTS2 to SQLite
• Create the database
 db.execute('CREATE VIRTUAL TABLE recipe USING fts2
 (dish, ingredients)');


• Search the database
 db.execute('SELECT dish FROM recipe WHERE recipe
 MATCH ?', ['tomatoes']);

 Fun queries: dish:stew tomatoes
   Find rows with 'stew' in the dish field, and 'tomatoes' in any field.
The Digg Oracle
Local Server
A mini-web server that groks 200 and 304
ResourceStore
                                Manually Capturing
var pageFiles = [
   location.pathname,
   'gears_base.js',
   '../scripts/gears_db.js',
   ‘foo.html’
];

try {
  localServer = google.gears.factory.create('beta.localserver', '1.0');
} catch (e) {
  alert('Could not create local server: ' + e.message);
  return;
}

var store = localServer.openStore(this.storeName) ||
            localServer.createStore(this.storeName);

store.capture(pageFiles, function(url, success, captureId) {
  console.log(url + ' capture ' + (success ? 'succeeded' : 'failed'));
});
ManagedResourceStore
                                                   JSON Me
{
    // version of the manifest file format
    quot;betaManifestVersionquot;: 1,

    // version of the set of resources described in this manifest file
    quot;versionquot;: quot;my_version_stringquot;,

    // optional
    // If the store specifies a requiredCookie, when a request would hit
    // an entry contained in the manifest except the requiredCookie is
    // not present, the local server responds with a redirect to this URL.
    quot;redirectUrlquot;: quot;login.htmlquot;,

    // URLs to be cached (URLs are given relative to the manifest URL)
    quot;entriesquot;: [
        { quot;urlquot;: quot;main.htmlquot;, quot;srcquot;: quot;main_offline.htmlquot; },
        { quot;urlquot;: quot;.quot;, quot;redirectquot;: quot;main.htmlquot; },
        { quot;urlquot;: quot;main.jsquot; }
        { quot;urlquot;: quot;formHandler.htmlquot;, quot;ignoreQueryquot;: true },
      ]
}
HTML 5
                                 Offline in General

<html application=”manifest-of-urls.txt”>

<html application>
“There’s a concept of an application cache. An application cache is a group
of resources, the group being identified by a URI (which typically happens
to resolve to a manifest). Resources in a cache are either top-level or
not; top-level resources are those that are HTML or XML and when parsed
with scripting disabled have with the value of
the attribute pointing to the same URI as identifies the cache.

When you visit a page you first check to see if you have that page in a
cache as a known top-level page.”
Future


                 Present
                                                 Ab
                                                    l
                                               edg eeding
                                                   ev
                                               of H ersion
                                                   TML
                  Past                                 5!



HTML 5                           Gears


• Standards                •   Implementation
• Long term                •   Battle hardened
• All browsers             •   A place for innovation
                           •   Cross browser
• No plugin                •   Plugin
Mouse Moved

                                 Mouse Pressed

                                 Mouse Released

                                  Key Pressed

Operating System                  Key Released


                                 Event Queue




                           al
                       enti ck
                   Pot lene
                       t
                   Bot




    JavaScript                                    Web Browsing



                                    Browser
1




                                     Browser




User Interface                    Message Passing




                 2                              3




                     WorkerPool                     WorkerPool
Worker Pool Code
function nextPrime(n) {
   // TODO: New top-secret prime-finding algorithm goes here.
   google.gears.workerPool.sendMessage(result);
}

var pool = google.gears.factory.create('beta.workerpool', '1.0');
pool.onmessage = function(message) {
   alert('next prime is: ' + message);
}

var worker = pool.createWorker(String(nextPrime) + '; nextPrime()');
JavaScript Read Write APIs
Desktop
                                   Shortcuts




var desktop = google.gears.factory.create('beta.desktop');
desktop.createShortcut(quot;Test Applicationquot;,
               quot;An application at http://www.test.com/index.htmlquot;,
               quot;http://www.test.com/index.htmlquot;,
               {quot;16x16quot;: quot;http://www.test.com/icon16x16.pngquot;,
                quot;32x32quot;: quot;http://www.test.com/icon32x32.pngquot;,
                quot;48x48quot;: quot;http://www.test.com/icon48x48.pngquot;,
                quot;128x128quot;: quot;http://www.test.com/icon128x128.pngquot;});
Notification API
                                  Growl for the Web



var notifier = google.gears.factory.create('beta.notifier', '1.0');

notifier.notify({
     application: quot;My Appquot;,
     title: 'warning',
     description: 'some text',
     priority: 2,
     sticky: 'True',
     password: 'Really Secure',
});
Location API
                                      Even on a laptop?


// Getting the object
var location = google.gears.factory.create( quot;beta.locationquot;, quot;1.0quot; );

// Setting up a callback to handle quot;location changedquot; events
location.onlocationstatechanged = function() {
   if (this.state == COMPLETE) {
         SetStatusText(quot;Location accuracy:quot;, this.accuracy);
         MoveMap(this.latitude, this.longitude);
   }
}

location.startLocationUpdates();
Audio API
                                    Play and Record


// play
var audio = google.gears.factory.create('beta.audio');
audio.src = 'http://blahblahblob.com/sampleaudio.wav';
audio.load();
audio.play();

// record
var recorder = google.gears.factory.create('beta.audiorecorder');
recorder.destination = <http post url>
recorder.autoStream = true;
recorder.record(); //asynchronous call
File System API



                Blob API




            Resumable HTTP




Don’t you want a better File Upload?
Gears: Open Source Update
  Mechanism for the Web
Don't forget, RIA's have rich
    internet back-ends (RIBs?)




Jonathan Schwartz
CEO, Sun Microsystems
Act Two
The Server
Google App Engine
Running Web Apps on Google’s Infrastructure




                                              • Fully-integrated
                                                application environment

                                              • Language agnostic runtime
                                                  Python for now

                                              • Free quota of 5M
                                                pageviews per month




code.google.com/appengine
Google App Engine
Challenges
Google App Engine
Easy to use, Easy to scale, Free to start
Develop locally. Deploy to Google. Launch.
Develop locally. Deploy to Google. Launch.




                                   Deploy
Develop locally. Deploy to Google. Launch.
Develop locally.




     • Google App Engine SDK is open source
     • Simulates production environment
     •dev_appserver.py myapp
     •appcfg.py update myapp
Hello World
Simplest output, simplest config




# helloworld.py
print quot;Content-Type: text/htmlquot;
print
print quot;Hello, world!quot;

# app.yaml
application: dalmaer-helloworld
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
  script: helloworld.py
loadcontacts

                          var contacts = [
                            { id: 1, name: ‘Dion Almaer’, ... },
                            { id: 2, name: ‘Ben Galbraith’, ... },
      savecontact         ]

name=’Dion A Lamer’
email=’dion@almaer.com’

                                      Web Services
threads
                  sockets
                    files
                foreground




the snake is almost there
from django import v0_96 as django
Store data
Scalable, and not like a RDBMS




                                 Wow, that's a
                                 big table!
Data Model
 Just an object




from google.appengine.ext import db

class Story(db.Model):
  title = db.StringProperty()
  body = db.TextProperty(required=True)
  author = db.UserProperty(required=True)
  created = db.DateTimeProperty(auto_now_add=True)
  rating = db.RatingProperty()
# Many other types: BlobProperty, ReferenceProperty, EmailProperty, PhoneProperty, IMProperty,
PostallAddressProperty, etc.
GQL
Our query language




 SELECT *
 FROM Story
 WHERE title = 'App Engine Launch'
 AND author = :current_user
 AND rating >= 10
 ORDER BY rating, created DESC
Run the queries
Beyond GQL




 Story.gql(GQL_FROM_BEFORE,
   current_user = users.get_current_user())

 query = Story.all()

 query.filter('title =', 'Foo')
      .order('-date')
      .ancestor(key)
Inserts
Manipulating the data




 story = Story(
   title = 'Morning Glory',
   body = '....',
   author = users.get_current_user(),
 )

 story.put()            # save or update


 story.delete()         # delete if saved
Call Web Services
URL Fetch API
  Aint no urllib2




from google.appengine.api import urlfetch

some_feed = urlfetch.fetch('http://somesite.com/rss')

if some_feed.status_code == 200:
  self.response.out.write(some_feed.content)




                                               53
                                                421
Authenticate to Google
OpenID provider.... available
Users API
But you can do your own thing too of course...




 from google.appengine.api import users

 current_user = users.get_current_user()

 if not current_user:
   self.redirect(users.create_login_url('/
 current_url'))

 nickname = current_user.nickname()
 email = current_user.email()

 if users.is_current_user_admin():
   ...
Send Email
Email API
 No SMTP config required




from google.appengine.api import mail

def post(self):
  email_body = self.request.get('email_body')
  sender = users.get_current_user().email

  mail.send_mail(sender=sender,
                 to='marce@google.com',
                 subject='Wiki Page',
                 body=email_body)

self.response.out.write('Email Sent')
Manipulate Images
Image Manipulation API
 No SMTP config required




# in model
avatar = db.BlobProperty()

# in handler
avatar = images.resize(self.request.get(quot;imgquot;), 32,
32)

# available
resize
crop
rotate
horizontal_flip
vertical_flip
im_feeling_lucky :)
Memcache Support
In-memory distributed cache
Memcache API
    In-memory distributed cache


from google.appengine.api import memcache

def get_data():
  data = memcache.get(quot;keyquot;)
  if data is not None:
    return data
  else:
    data = self.query_for_data()
    memcache.add(quot;keyquot;, data, 60)
    return data
# Set several values, overwriting any existing values for these keys.
memcache.set_multi({ quot;USA_98105quot;: quot;rainingquot;,
                     quot;USA_94105quot;: quot;foggyquot;,
                     quot;USA_94043quot;: quot;sunnyquot; },
                     key_prefix=quot;weather_quot;, time=3600)

# Atomically increment an integer value.
memcache.set(key=quot;counterquot;, 0)
memcache.incr(quot;counterquot;)
memcache.incr(quot;counterquot;)
memcache.incr(quot;counterquot;)
Google App Engine
Areas of Work, Including…



• Offline Processing
• Rich Media Support
  – e.g., large file upload / download
• Add’l Infrastructure Services



• What would you like to see?



                                         74
Use it as you will
No need to go whole hog
Your Application




                   Web Services
Python
                              Runtime



                                             Web
        Configuration
                                          Applications




Static Files                                        URL Fetch API




                         Google App
                           Engine
 Email API                                           Users API




               Memcache API             Image API
Act Three
And there’s more
What if popular JavaScript libraries
      were available and shared in the browser?


1   Now hosting open source JavaScript libraries at Google
         Starting with: Prototype, Script.aculo.us, jQuery, Dojo, Mootools
         Accepting requests for other open source libraries
         Can access directly:
             ajax.googleapis.com/ajax/lib/prototype?v=1.6.0.2&packed=false
         Can access via AJAX API Loader:
            google.load(“prototype”, “1.6”);


2   Other features
          Automatic compression
          Minification of libraries
          Not tied to Google Code
Google Back To Front: From Gears to App Engine and Beyond
Google Back To Front: From Gears to App Engine and Beyond
Google Back To Front: From Gears to App Engine and Beyond

Contenu connexe

Tendances

Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr VronskiyFwdays
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript EverywherePascal Rettig
 
Testing Ember Apps: Managing Dependency
Testing Ember Apps: Managing DependencyTesting Ember Apps: Managing Dependency
Testing Ember Apps: Managing DependencyMatthew Beale
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.Graham Dumpleton
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript FrameworkAll Things Open
 
Django Celery - A distributed task queue
Django Celery - A distributed task queueDjango Celery - A distributed task queue
Django Celery - A distributed task queueAlex Eftimie
 
Sane Sharding with Akka Cluster
Sane Sharding with Akka ClusterSane Sharding with Akka Cluster
Sane Sharding with Akka Clustermiciek
 
Web Crawling with NodeJS
Web Crawling with NodeJSWeb Crawling with NodeJS
Web Crawling with NodeJSSylvain Zimmer
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Eric Palakovich Carr
 
Europython 2011 - Playing tasks with Django & Celery
Europython 2011 - Playing tasks with Django & CeleryEuropython 2011 - Playing tasks with Django & Celery
Europython 2011 - Playing tasks with Django & CeleryMauro Rocco
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Andres Almiray
 
React, Redux and es6/7
React, Redux and es6/7React, Redux and es6/7
React, Redux and es6/7Dongho Cho
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to CeleryIdan Gazit
 
Revolution or Evolution in Page Object
Revolution or Evolution in Page ObjectRevolution or Evolution in Page Object
Revolution or Evolution in Page ObjectArtem Sokovets
 
Hopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherHopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherMichele Orselli
 
InterConnect: Java, Node.js and Swift - Which, Why and When
InterConnect: Java, Node.js and Swift - Which, Why and WhenInterConnect: Java, Node.js and Swift - Which, Why and When
InterConnect: Java, Node.js and Swift - Which, Why and WhenChris Bailey
 

Tendances (20)

Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 
Testing Ember Apps: Managing Dependency
Testing Ember Apps: Managing DependencyTesting Ember Apps: Managing Dependency
Testing Ember Apps: Managing Dependency
 
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
PyCon AU 2010 - Getting Started With Apache/mod_wsgi.
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript Framework
 
Django Celery - A distributed task queue
Django Celery - A distributed task queueDjango Celery - A distributed task queue
Django Celery - A distributed task queue
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
 
Sane Sharding with Akka Cluster
Sane Sharding with Akka ClusterSane Sharding with Akka Cluster
Sane Sharding with Akka Cluster
 
Web Crawling with NodeJS
Web Crawling with NodeJSWeb Crawling with NodeJS
Web Crawling with NodeJS
 
Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!Django Rest Framework and React and Redux, Oh My!
Django Rest Framework and React and Redux, Oh My!
 
Europython 2011 - Playing tasks with Django & Celery
Europython 2011 - Playing tasks with Django & CeleryEuropython 2011 - Playing tasks with Django & Celery
Europython 2011 - Playing tasks with Django & Celery
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
React, Redux and es6/7
React, Redux and es6/7React, Redux and es6/7
React, Redux and es6/7
 
An Introduction to Celery
An Introduction to CeleryAn Introduction to Celery
An Introduction to Celery
 
Revolution or Evolution in Page Object
Revolution or Evolution in Page ObjectRevolution or Evolution in Page Object
Revolution or Evolution in Page Object
 
Hopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherHopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to another
 
InterConnect: Java, Node.js and Swift - Which, Why and When
InterConnect: Java, Node.js and Swift - Which, Why and WhenInterConnect: Java, Node.js and Swift - Which, Why and When
InterConnect: Java, Node.js and Swift - Which, Why and When
 

En vedette

So tay xay dung chien luoc phat trien ben vung (danh cho doanh nghiep)
So tay xay dung chien luoc phat trien ben vung (danh cho doanh nghiep)So tay xay dung chien luoc phat trien ben vung (danh cho doanh nghiep)
So tay xay dung chien luoc phat trien ben vung (danh cho doanh nghiep)foreman
 
Sociedad De La Información
Sociedad De La InformaciónSociedad De La Información
Sociedad De La InformaciónDiego Peralta
 
Formulación Y Planeación
Formulación Y PlaneaciónFormulación Y Planeación
Formulación Y PlaneaciónDiego Peralta
 

En vedette (6)

OpenSolaris
OpenSolarisOpenSolaris
OpenSolaris
 
So tay xay dung chien luoc phat trien ben vung (danh cho doanh nghiep)
So tay xay dung chien luoc phat trien ben vung (danh cho doanh nghiep)So tay xay dung chien luoc phat trien ben vung (danh cho doanh nghiep)
So tay xay dung chien luoc phat trien ben vung (danh cho doanh nghiep)
 
Sociedad De La Información
Sociedad De La InformaciónSociedad De La Información
Sociedad De La Información
 
Formulación Y Planeación
Formulación Y PlaneaciónFormulación Y Planeación
Formulación Y Planeación
 
Paper(repositorio)
Paper(repositorio)Paper(repositorio)
Paper(repositorio)
 
幸福来不来
幸福来不来幸福来不来
幸福来不来
 

Similaire à Google Back To Front: From Gears to App Engine and Beyond

Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...BradNeuberg
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOSfpatton
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureSimon Willison
 
Bubbles & Trees with jQuery
Bubbles & Trees with jQueryBubbles & Trees with jQuery
Bubbles & Trees with jQueryBastian Feder
 
Progressive Web Apps. What, why and how
Progressive Web Apps. What, why and howProgressive Web Apps. What, why and how
Progressive Web Apps. What, why and howRiza Fahmi
 
"Progressive Web Apps" by Riza Fahmi (Hacktiv8)
"Progressive Web Apps" by Riza Fahmi	(Hacktiv8)"Progressive Web Apps" by Riza Fahmi	(Hacktiv8)
"Progressive Web Apps" by Riza Fahmi (Hacktiv8)Tech in Asia ID
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Enginecatherinewall
 
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07Frédéric Harper
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSRobert Nyman
 
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...Frédéric Harper
 
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12Frédéric Harper
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterHaehnchen
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Frédéric Harper
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Puppet
 
IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009Christopher Judd
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication developmentGanesh Gembali
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)Woonsan Ko
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineAndy McKay
 

Similaire à Google Back To Front: From Gears to App Engine and Beyond (20)

Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
JavaScript Libraries: The Big Picture
JavaScript Libraries: The Big PictureJavaScript Libraries: The Big Picture
JavaScript Libraries: The Big Picture
 
Bubbles & Trees with jQuery
Bubbles & Trees with jQueryBubbles & Trees with jQuery
Bubbles & Trees with jQuery
 
Progressive Web Apps. What, why and how
Progressive Web Apps. What, why and howProgressive Web Apps. What, why and how
Progressive Web Apps. What, why and how
 
"Progressive Web Apps" by Riza Fahmi (Hacktiv8)
"Progressive Web Apps" by Riza Fahmi	(Hacktiv8)"Progressive Web Apps" by Riza Fahmi	(Hacktiv8)
"Progressive Web Apps" by Riza Fahmi (Hacktiv8)
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
 
Mozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJSMozilla Web Apps - Super-VanJS
Mozilla Web Apps - Super-VanJS
 
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
 
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
 
Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)Getting started with puppet and vagrant (1)
Getting started with puppet and vagrant (1)
 
IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009
 
Mobile webapplication development
Mobile webapplication developmentMobile webapplication development
Mobile webapplication development
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 

Plus de dion

Palm Developer Day: Opening Keynote
Palm Developer Day: Opening KeynotePalm Developer Day: Opening Keynote
Palm Developer Day: Opening Keynotedion
 
The Mobile Web @ 2010 JSConf
The Mobile Web @ 2010 JSConfThe Mobile Web @ 2010 JSConf
The Mobile Web @ 2010 JSConfdion
 
Google Developer Day: State of Ajax
Google Developer Day: State of AjaxGoogle Developer Day: State of Ajax
Google Developer Day: State of Ajaxdion
 
Gears and HTML 5 @media Ajax London 2008
Gears and HTML 5 @media Ajax London 2008Gears and HTML 5 @media Ajax London 2008
Gears and HTML 5 @media Ajax London 2008dion
 
App Engine On Air: Munich
App Engine On Air: MunichApp Engine On Air: Munich
App Engine On Air: Munichdion
 
Google I/O State Of Ajax
Google I/O State Of AjaxGoogle I/O State Of Ajax
Google I/O State Of Ajaxdion
 
Javaone 2008: What’s New In Ajax
Javaone 2008: What’s New In AjaxJavaone 2008: What’s New In Ajax
Javaone 2008: What’s New In Ajaxdion
 
Web 2.0 Expo Ria Offline Desktop
Web 2.0 Expo Ria Offline DesktopWeb 2.0 Expo Ria Offline Desktop
Web 2.0 Expo Ria Offline Desktopdion
 

Plus de dion (8)

Palm Developer Day: Opening Keynote
Palm Developer Day: Opening KeynotePalm Developer Day: Opening Keynote
Palm Developer Day: Opening Keynote
 
The Mobile Web @ 2010 JSConf
The Mobile Web @ 2010 JSConfThe Mobile Web @ 2010 JSConf
The Mobile Web @ 2010 JSConf
 
Google Developer Day: State of Ajax
Google Developer Day: State of AjaxGoogle Developer Day: State of Ajax
Google Developer Day: State of Ajax
 
Gears and HTML 5 @media Ajax London 2008
Gears and HTML 5 @media Ajax London 2008Gears and HTML 5 @media Ajax London 2008
Gears and HTML 5 @media Ajax London 2008
 
App Engine On Air: Munich
App Engine On Air: MunichApp Engine On Air: Munich
App Engine On Air: Munich
 
Google I/O State Of Ajax
Google I/O State Of AjaxGoogle I/O State Of Ajax
Google I/O State Of Ajax
 
Javaone 2008: What’s New In Ajax
Javaone 2008: What’s New In AjaxJavaone 2008: What’s New In Ajax
Javaone 2008: What’s New In Ajax
 
Web 2.0 Expo Ria Offline Desktop
Web 2.0 Expo Ria Offline DesktopWeb 2.0 Expo Ria Offline Desktop
Web 2.0 Expo Ria Offline Desktop
 

Dernier

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Dernier (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

Google Back To Front: From Gears to App Engine and Beyond

  • 1. Google Back to Front From Gears to App Engine, and beyond
  • 2.
  • 3.
  • 5.
  • 6. We Believe... The Web is the platform of today, and of the future
  • 7.
  • 9. Top Grossing Film of 1957 Top Grossing Film of 2007
  • 10.
  • 11.
  • 13. It takes too long to update the Web
  • 14.
  • 15.
  • 16. What is the philosophy? Do for offline what XMLHttpRequest did for web apps Ajax Libraries Gears Libraries Dojo, jQuery, Prototype, GWT Dojo Offline, GWT XMLHttpRequest Gears Open Web Open Web
  • 17. Database Embedded using SQLite Contributed Full Text Search var db = google.gears.factory.create('beta.database', '1.0'); db.open('database-demo'); db.execute('create table if not exists Demo (Phrase varchar(255), Timestamp int)'); db.execute('insert into Demo values (?, ?)', [phrase, currTime]);
  • 18. GearsDB Abstract over the API var bob = {id: 3, name: 'Bob', url: 'http://bob.com', description: 'whee'}; db.insertRow('person', bob); db.insertRow('person', bob, 'name = ?', ['Bob']); db.selectAll('select * from person', null, function(person) { document.getElementById('selectAll').innerHTML += ' ' + person.name; }); var person = db.selectRow('person', 'id = 1'); // update person.name = 'Harry'; db.updateRow('person', person); person = db.selectRow('person', 'id = 1'); // force person.name = 'Sally'; db.forceRow('person', person); person = db.selectRow('person', 'id = 1'); db.deleteRow('person', bob);
  • 19. GearsORM Are we going to get a GearsHibernate? var Person = new GearsOrm.Model(quot;Personquot;, { firstName: GearsOrm.Fields.String({maxLength:25}), lastName: GearsOrm.Fields.String({maxLength:25}) }); GearsORM.Transaction(function() { “While developing transaction support for new Person({name:quot;Johnquot;}).save(); GearsORM i had to write a test, in that test it execute 100 inserts and 100 updates, this test take new Person({name:quot;Doequot;}).save(); about 15 seconds for the inserts and about 10 seconds for the updates without transactions,when }); using transactions for each set it takes about 377ms for the inserts and 200ms for the updates that is about Person.select(quot;firstName = 'Uriel'quot;); 39 times faster!” Person.count(quot;lastName = ?quot;,[quot;Katzquot;])
  • 20. GearShift DB Migrations for Gears Gearshift.rules[1] = { // create the demo table up: function() { return this.e(quot;CREATE TABLE demo_table ( id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(30), movie VARCHAR(30) )quot;).success; }, down: function() { return this.e(quot;DROP TABLE demo_tablequot;).success; } };
  • 23. Full Text Search • Gears added FTS2 to SQLite • Create the database db.execute('CREATE VIRTUAL TABLE recipe USING fts2 (dish, ingredients)'); • Search the database db.execute('SELECT dish FROM recipe WHERE recipe MATCH ?', ['tomatoes']); Fun queries: dish:stew tomatoes Find rows with 'stew' in the dish field, and 'tomatoes' in any field.
  • 25.
  • 26. Local Server A mini-web server that groks 200 and 304
  • 27. ResourceStore Manually Capturing var pageFiles = [ location.pathname, 'gears_base.js', '../scripts/gears_db.js', ‘foo.html’ ]; try { localServer = google.gears.factory.create('beta.localserver', '1.0'); } catch (e) { alert('Could not create local server: ' + e.message); return; } var store = localServer.openStore(this.storeName) || localServer.createStore(this.storeName); store.capture(pageFiles, function(url, success, captureId) { console.log(url + ' capture ' + (success ? 'succeeded' : 'failed')); });
  • 28. ManagedResourceStore JSON Me { // version of the manifest file format quot;betaManifestVersionquot;: 1, // version of the set of resources described in this manifest file quot;versionquot;: quot;my_version_stringquot;, // optional // If the store specifies a requiredCookie, when a request would hit // an entry contained in the manifest except the requiredCookie is // not present, the local server responds with a redirect to this URL. quot;redirectUrlquot;: quot;login.htmlquot;, // URLs to be cached (URLs are given relative to the manifest URL) quot;entriesquot;: [ { quot;urlquot;: quot;main.htmlquot;, quot;srcquot;: quot;main_offline.htmlquot; }, { quot;urlquot;: quot;.quot;, quot;redirectquot;: quot;main.htmlquot; }, { quot;urlquot;: quot;main.jsquot; } { quot;urlquot;: quot;formHandler.htmlquot;, quot;ignoreQueryquot;: true }, ] }
  • 29.
  • 30. HTML 5 Offline in General <html application=”manifest-of-urls.txt”> <html application> “There’s a concept of an application cache. An application cache is a group of resources, the group being identified by a URI (which typically happens to resolve to a manifest). Resources in a cache are either top-level or not; top-level resources are those that are HTML or XML and when parsed with scripting disabled have with the value of the attribute pointing to the same URI as identifies the cache. When you visit a page you first check to see if you have that page in a cache as a known top-level page.”
  • 31. Future Present Ab l edg eeding ev of H ersion TML Past 5! HTML 5 Gears • Standards • Implementation • Long term • Battle hardened • All browsers • A place for innovation • Cross browser • No plugin • Plugin
  • 32. Mouse Moved Mouse Pressed Mouse Released Key Pressed Operating System Key Released Event Queue al enti ck Pot lene t Bot JavaScript Web Browsing Browser
  • 33. 1 Browser User Interface Message Passing 2 3 WorkerPool WorkerPool
  • 34. Worker Pool Code function nextPrime(n) { // TODO: New top-secret prime-finding algorithm goes here. google.gears.workerPool.sendMessage(result); } var pool = google.gears.factory.create('beta.workerpool', '1.0'); pool.onmessage = function(message) { alert('next prime is: ' + message); } var worker = pool.createWorker(String(nextPrime) + '; nextPrime()');
  • 35.
  • 37. Desktop Shortcuts var desktop = google.gears.factory.create('beta.desktop'); desktop.createShortcut(quot;Test Applicationquot;, quot;An application at http://www.test.com/index.htmlquot;, quot;http://www.test.com/index.htmlquot;, {quot;16x16quot;: quot;http://www.test.com/icon16x16.pngquot;, quot;32x32quot;: quot;http://www.test.com/icon32x32.pngquot;, quot;48x48quot;: quot;http://www.test.com/icon48x48.pngquot;, quot;128x128quot;: quot;http://www.test.com/icon128x128.pngquot;});
  • 38. Notification API Growl for the Web var notifier = google.gears.factory.create('beta.notifier', '1.0'); notifier.notify({ application: quot;My Appquot;, title: 'warning', description: 'some text', priority: 2, sticky: 'True', password: 'Really Secure', });
  • 39. Location API Even on a laptop? // Getting the object var location = google.gears.factory.create( quot;beta.locationquot;, quot;1.0quot; ); // Setting up a callback to handle quot;location changedquot; events location.onlocationstatechanged = function() { if (this.state == COMPLETE) { SetStatusText(quot;Location accuracy:quot;, this.accuracy); MoveMap(this.latitude, this.longitude); } } location.startLocationUpdates();
  • 40. Audio API Play and Record // play var audio = google.gears.factory.create('beta.audio'); audio.src = 'http://blahblahblob.com/sampleaudio.wav'; audio.load(); audio.play(); // record var recorder = google.gears.factory.create('beta.audiorecorder'); recorder.destination = <http post url> recorder.autoStream = true; recorder.record(); //asynchronous call
  • 41. File System API Blob API Resumable HTTP Don’t you want a better File Upload?
  • 42.
  • 43. Gears: Open Source Update Mechanism for the Web
  • 44. Don't forget, RIA's have rich internet back-ends (RIBs?) Jonathan Schwartz CEO, Sun Microsystems
  • 46. Google App Engine Running Web Apps on Google’s Infrastructure • Fully-integrated application environment • Language agnostic runtime Python for now • Free quota of 5M pageviews per month code.google.com/appengine
  • 48. Google App Engine Easy to use, Easy to scale, Free to start
  • 49. Develop locally. Deploy to Google. Launch.
  • 50. Develop locally. Deploy to Google. Launch. Deploy
  • 51.
  • 52. Develop locally. Deploy to Google. Launch.
  • 53. Develop locally. • Google App Engine SDK is open source • Simulates production environment •dev_appserver.py myapp •appcfg.py update myapp
  • 54. Hello World Simplest output, simplest config # helloworld.py print quot;Content-Type: text/htmlquot; print print quot;Hello, world!quot; # app.yaml application: dalmaer-helloworld version: 1 runtime: python api_version: 1 handlers: - url: /.* script: helloworld.py
  • 55.
  • 56. loadcontacts var contacts = [ { id: 1, name: ‘Dion Almaer’, ... }, { id: 2, name: ‘Ben Galbraith’, ... }, savecontact ] name=’Dion A Lamer’ email=’dion@almaer.com’ Web Services
  • 57. threads sockets files foreground the snake is almost there
  • 58. from django import v0_96 as django
  • 59. Store data Scalable, and not like a RDBMS Wow, that's a big table!
  • 60. Data Model Just an object from google.appengine.ext import db class Story(db.Model): title = db.StringProperty() body = db.TextProperty(required=True) author = db.UserProperty(required=True) created = db.DateTimeProperty(auto_now_add=True) rating = db.RatingProperty() # Many other types: BlobProperty, ReferenceProperty, EmailProperty, PhoneProperty, IMProperty, PostallAddressProperty, etc.
  • 61. GQL Our query language SELECT * FROM Story WHERE title = 'App Engine Launch' AND author = :current_user AND rating >= 10 ORDER BY rating, created DESC
  • 62. Run the queries Beyond GQL Story.gql(GQL_FROM_BEFORE, current_user = users.get_current_user()) query = Story.all() query.filter('title =', 'Foo') .order('-date') .ancestor(key)
  • 63. Inserts Manipulating the data story = Story( title = 'Morning Glory', body = '....', author = users.get_current_user(), ) story.put() # save or update story.delete() # delete if saved
  • 65. URL Fetch API Aint no urllib2 from google.appengine.api import urlfetch some_feed = urlfetch.fetch('http://somesite.com/rss') if some_feed.status_code == 200: self.response.out.write(some_feed.content) 53 421
  • 66. Authenticate to Google OpenID provider.... available
  • 67. Users API But you can do your own thing too of course... from google.appengine.api import users current_user = users.get_current_user() if not current_user: self.redirect(users.create_login_url('/ current_url')) nickname = current_user.nickname() email = current_user.email() if users.is_current_user_admin(): ...
  • 69. Email API No SMTP config required from google.appengine.api import mail def post(self): email_body = self.request.get('email_body') sender = users.get_current_user().email mail.send_mail(sender=sender, to='marce@google.com', subject='Wiki Page', body=email_body) self.response.out.write('Email Sent')
  • 71. Image Manipulation API No SMTP config required # in model avatar = db.BlobProperty() # in handler avatar = images.resize(self.request.get(quot;imgquot;), 32, 32) # available resize crop rotate horizontal_flip vertical_flip im_feeling_lucky :)
  • 73. Memcache API In-memory distributed cache from google.appengine.api import memcache def get_data(): data = memcache.get(quot;keyquot;) if data is not None: return data else: data = self.query_for_data() memcache.add(quot;keyquot;, data, 60) return data # Set several values, overwriting any existing values for these keys. memcache.set_multi({ quot;USA_98105quot;: quot;rainingquot;, quot;USA_94105quot;: quot;foggyquot;, quot;USA_94043quot;: quot;sunnyquot; }, key_prefix=quot;weather_quot;, time=3600) # Atomically increment an integer value. memcache.set(key=quot;counterquot;, 0) memcache.incr(quot;counterquot;) memcache.incr(quot;counterquot;) memcache.incr(quot;counterquot;)
  • 74. Google App Engine Areas of Work, Including… • Offline Processing • Rich Media Support – e.g., large file upload / download • Add’l Infrastructure Services • What would you like to see? 74
  • 75. Use it as you will No need to go whole hog
  • 76. Your Application Web Services
  • 77.
  • 78.
  • 79. Python Runtime Web Configuration Applications Static Files URL Fetch API Google App Engine Email API Users API Memcache API Image API
  • 81. What if popular JavaScript libraries were available and shared in the browser? 1 Now hosting open source JavaScript libraries at Google Starting with: Prototype, Script.aculo.us, jQuery, Dojo, Mootools Accepting requests for other open source libraries Can access directly: ajax.googleapis.com/ajax/lib/prototype?v=1.6.0.2&packed=false Can access via AJAX API Loader: google.load(“prototype”, “1.6”); 2 Other features Automatic compression Minification of libraries Not tied to Google Code