SlideShare a Scribd company logo
1 of 111
Download to read offline
In depth with HTML5


          Andrew Lombardi
          Owner, Tech Evangelist
          Mystic Coders, LLC
          andrew AT mysticcoders DOT com

          kinabalu @ irc://irc.freenode.net - ##wicket, ##java
          kinabalu @ twitter




Friday, October 8, 2010
Friday, October 8, 2010
10 Years in business




Friday, October 8, 2010
10 Years in business
    Software Consultants




Friday, October 8, 2010
10 Years in business
    Software Consultants
    International Speaker




Friday, October 8, 2010
10 Years in business
    Software Consultants
    International Speaker
    Training




Friday, October 8, 2010
10 Years in business
    Software Consultants
    International Speaker
    Training
    Apache Wicket Contributor




Friday, October 8, 2010
10 Years in business
    Software Consultants
    International Speaker
    Training
    Apache Wicket Contributor


                            To our success!



Friday, October 8, 2010
Friday, October 8, 2010
Friday, October 8, 2010
What is HTML5?




Friday, October 8, 2010
A brief history of time (HTML)




Friday, October 8, 2010
A brief history of time (HTML)

                 1991 - First version of HTML




Friday, October 8, 2010
A brief history of time (HTML)

                 1991 - First version of HTML
                 1994 - HTML2 is born




Friday, October 8, 2010
A brief history of time (HTML)

                 1991 - First version of HTML
                 1994 - HTML2 is born
                 1996 - CSS1 + JavaScript



Friday, October 8, 2010
A brief history of time (HTML)

                 1991 - First version of HTML
                 1994 - HTML2 is born
                 1996 - CSS1 + JavaScript
                 1996 - First “developer”
                 mistakes Javascript for Java

Friday, October 8, 2010
A brief history of time (HTML)




Friday, October 8, 2010
A brief history of time (HTML)

                 1997 - HTML4




Friday, October 8, 2010
A brief history of time (HTML)

                 1997 - HTML4
                 1998 - CSS2




Friday, October 8, 2010
A brief history of time (HTML)

                 1997 - HTML4
                 1998 - CSS2
                 2000 - XHTML is hatched



Friday, October 8, 2010
A brief history of time (HTML)

                 1997 - HTML4
                 1998 - CSS2
                 2000 - XHTML is hatched
                 2000 - Malformed HTML
                 writers are burned at stake

Friday, October 8, 2010
A brief history of time (HTML)




Friday, October 8, 2010
A brief history of time (HTML)

                 2002 - Tableless Web Design




Friday, October 8, 2010
A brief history of time (HTML)

                 2002 - Tableless Web Design
                 2002 - Average HTML page
                 creation 5x longer




Friday, October 8, 2010
A brief history of time (HTML)

                 2002 - Tableless Web Design
                 2002 - Average HTML page
                 creation 5x longer
                 2005 - AJAX


Friday, October 8, 2010
A brief history of time (HTML)

                 2002 - Tableless Web Design
                 2002 - Average HTML page
                 creation 5x longer
                 2005 - AJAX
                 2009 - HTML5

Friday, October 8, 2010
HTML5 is...


           HTML5 is a replacement for HTML
           4.01, XHTML 1.0, and XHTML 1.1




Friday, October 8, 2010
WHATWG vs W3C deathmatch




Friday, October 8, 2010
WHATWG vs W3C deathmatch

                             Draconian Error Handling




Friday, October 8, 2010
WHATWG vs W3C deathmatch

                             Draconian Error Handling
                             Backwards Compatibility


Friday, October 8, 2010
What we’ll cover




Friday, October 8, 2010
What we’ll cover
               1. The Setup




Friday, October 8, 2010
What we’ll cover
               1. The Setup
               2. Video and Audio




Friday, October 8, 2010
What we’ll cover
               1. The Setup
               2. Video and Audio
               3. Canvas




Friday, October 8, 2010
What we’ll cover
               1. The Setup
               2. Video and Audio
               3. Canvas
               4. Forms




Friday, October 8, 2010
What we’ll cover
               1. The Setup
               2. Video and Audio
               3. Canvas
               4. Forms
               5. Local Storage




Friday, October 8, 2010
What we’ll cover
               1. The Setup
               2. Video and Audio
               3. Canvas
               4. Forms
               5. Local Storage
               6. Web Workers



Friday, October 8, 2010
What we’ll cover
               1. The Setup
               2. Video and Audio
               3. Canvas
               4. Forms
               5. Local Storage
               6. Web Workers
               7. Geolocation


Friday, October 8, 2010
The Cooking show model




Friday, October 8, 2010
?
                          Why
                          HTML5

Friday, October 8, 2010
Friday, October 8, 2010
Friday, October 8, 2010
Support coming in 2015




Friday, October 8, 2010
The Setup

Friday, October 8, 2010
The Old Way


              <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
              “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>




Friday, October 8, 2010
The New Way


                          <!DOCTYPE html>




Friday, October 8, 2010
The New Way


                                 <!DOCTYPE html>




                          Miss the DOCTYPE and get Quirks mode



Friday, October 8, 2010
The Old Way


           <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">




Friday, October 8, 2010
The New Way


                          <html lang="en">




Friday, October 8, 2010
The Old Way


                          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">




Friday, October 8, 2010
The New Way


                           <meta charset="utf-8">




Friday, October 8, 2010
Typing is so 2009




Friday, October 8, 2010
Typing is so 2009
                                      Instead of
               <link rel="stylesheet" href="style.css" type="text/css" />

               <script type="text/javascript"> ... </script>




Friday, October 8, 2010
Typing is so 2009
                                           Instead of
               <link rel="stylesheet" href="style.css" type="text/css" />

               <script type="text/javascript"> ... </script>

                                           Just do
                          <link rel="stylesheet" href="style.css" />

                          <script> ... </script>




Friday, October 8, 2010
Typing is so 2009
                                           Instead of
               <link rel="stylesheet" href="style.css" type="text/css" />

               <script type="text/javascript"> ... </script>

                                           Just do
                          <link rel="stylesheet" href="style.css" />

                          <script> ... </script>


                                  We know what you mean.




Friday, October 8, 2010
Boolean Types in Tags


                     <input type="text" name="email" required />




Friday, October 8, 2010
Boolean Types in Tags


                     <input type="text" name="email" required />




                          If you reference it in the markup, it’s true.




Friday, October 8, 2010
Browser Support




Friday, October 8, 2010
Browser Support




Friday, October 8, 2010
Video and Audio in HTML5 has a lot of
        promise, but patent hippos get in the way


Friday, October 8, 2010
HTML5 Video

                 Ogg - Not patent encumbered but quality is not there

                 H.264 - Only pay royalties if end-user video is not free
                 WebM / VP8 - Google released as royalty free after
                 purchasing from On2




Friday, October 8, 2010
HTML5 Video

                 Ogg - Not patent encumbered but quality is not there

                 H.264 - Only pay royalties if end-user video is not free
                 WebM / VP8 - Google released as royalty free after
                 purchasing from On2



                          Patent landscape for video is unclear




Friday, October 8, 2010
HTML5 Video
                   <video
                   ! id=”video”
                   ! width="640"
                   ! height="360"
                   ! src="big_buck_bunny.mp4"
                   ! controls
                   ! poster="poster.jpg">
                   </video>

                   document.getElementById("video").play();




Friday, October 8, 2010
Video Attributes
    autoplay - video starts playing as soon as it’s ready
    controls - browser-specific controls for video displayed
    height - height of video
    width - width of video
    loop - replay video on end
    src - location of video
    poster - image to show before video plays



Friday, October 8, 2010
HTML5 Video

      <video width="640" height="360" controls poster="poster.jpg">
      ! <source src="big_buck_bunny.mp4" type="video/mp4" />
      ! <source src="big_buck_bunny.webm" type="video/webm" />
      ! <source src="big_buck_bunny.ogv" type="video/ogg" />
      ! <object width="640" height="384" type="application/x-shockwave-flash" data="player.swf">
      ! !         <param name="movie" value="player.swf" />
      ! !         <param name="flashvars" value="controlbar=over&amp;image=poster.jpg&amp;file=big_buck_bunny.mp4" />
      ! !         <img src="poster.jpg" width="640" height="360" alt="Big Buck Bunny"
      ! !         title="No video playback capabilities, please download the video below" />
      ! </object>
      </video>




Friday, October 8, 2010
HTML5 Video




Friday, October 8, 2010
Video Support


          Internet Explorer   Mozilla Firefox   Apple Safari   Google Chrome



            Flash only            Ogg            H.264         H.264 + Ogg




Friday, October 8, 2010
Video Support


          Internet Explorer   Mozilla Firefox   Apple Safari   Google Chrome



                      9.0          3.5             3.2             4.0




Friday, October 8, 2010
Checking Video Support


         function supports_video() {
         ! return !document.createElement('video').canPlayType;
         }




Friday, October 8, 2010
Modernizr Library


                          if(Modernizr.video) {
                          ! // let's play some video!
                          }




Friday, October 8, 2010
Modernizr Library


                          if(Modernizr.video) {
                          ! // let's play some video!
                          }




Friday, October 8, 2010
HTML5 Audio

                     <audio
                     ! id="audio"
                     ! src="elvis.mp3"
                     ! controls
                     ! autobuffer />

                     document.getElementById("audio").play();




Friday, October 8, 2010
Audio Attributes
    autoplay - audio starts playing as soon as it’s ready
    controls - browser-specific controls for audio displayed
    preload - should browser preload audio? if autoplay -ignored
    loop - replay audio on end
    src - location of audio




Friday, October 8, 2010
HTML5 Audio


                          <audio controls autobuffer>
                          ! <source src="elvis.ogg" />
                          ! <source src="elvis.mp3" />
                          </audio>




Friday, October 8, 2010
Audio Support


          Internet Explorer   Mozilla Firefox   Apple Safari   Google Chrome



            Flash only        Ogg, WAV            MP3          Ogg, MP3




Friday, October 8, 2010
Audio Support


          Internet Explorer   Mozilla Firefox   Apple Safari   Google Chrome



                      9.0          3.5             3.2             4.0




Friday, October 8, 2010
Nothing to do with HTML5 Canvas but
        who’s complaining?


Friday, October 8, 2010
Canvas

     <canvas id="someshape" width="150" height="150"></canvas>
     var shape = document.getElementById('someshape');
     var context = shape.getContext('2d');
     context.fillStyle = "rgb(255,0,0)";
     context.fillRect(0, 0, 150, 150);




Friday, October 8, 2010
Canvas
                          <canvas id="j2dlogo">
                          <p>Your browser doesn't support canvas.</p>
                          </canvas>

                          <script>

                          var canvas = document.getElementById('j2dlogo');
                          if(canvas.getContext) {
                          ! !      var context = canvas.getContext('2d');

                          !   !      var myImage = new Image();
                          !   !      myImage.onload = function() {
                          !   !      canvas.setAttribute('width', myImage.width);
                          !   !      canvas.setAttribute('height', myImage.height);
                          !   !      context.drawImage(myImage, 0, 0);
                          !   }
                          !   myImage.src = "j2dlogo.png";!

                          }

                          </script>




Friday, October 8, 2010
Canvas Extreme




                          http://www.nihilogic.dk/labs/wolf/



Friday, October 8, 2010
Canvas Browser Support


          Internet Explorer    Mozilla Firefox   Apple Safari   Google Chrome



                      9.0           3.0             3.2             4.0




Friday, October 8, 2010
Forms in Wicket allow you to accept,
        process and validate user input.




Friday, October 8, 2010
HTML5 Forms

             Tag                         Description


             type=”date”                 Represents a UTC formatted date




             type=”color”                Represents a hexadecimal RGB color value




             type=”number”               Represents a numeric value




             type=”search”               Simple text box but browser can choose to provide custom control



             type=”email”, type=”url”,   Represents contact details. Browser can choose to represent our handle input differently (i.e.
             type=”tel”                  Mobile Safari)



             type=”range”                Represents a range of values with min/max




Friday, October 8, 2010
HTML5 Forms (more)

             Tag                      Description

             pattern=”some.regex”     Use a regex to validate against the input without requiring Javascript involvement


             placeholder=”Insert
                                      Attached to input type=”text” to show placeholder text before user clicks
             placeholder text here”

                                      Boolean value used only once per page identifying the form component that should receive
             autofocus                immediate focus after page load


             autocomplete             on/off switch used to tell browser if it’s okay to autocomplete this field with saved data


                                      Boolean value for semantically and functionally marking a field as requiring input before valid
             required                 submission


             <datalist>               A combo box allowing selection via preselected values or entering custom


             placeholder=”Insert
                                      Attached to input type=”text” to show placeholder text before user clicks
             placeholder text here”




Friday, October 8, 2010
New Form Tags Browser Support


          Internet Explorer   Mozilla Firefox   Apple Safari   Google Chrome



                          ?        4.0             4.0             4.0




Friday, October 8, 2010
Semantic markup in HTML5 identifies
        based on meaning rather than layout




Friday, October 8, 2010
New Semantic Tags

             Tag          Description


             <section>    A generic section of a document or application, a grouping of content typically with a header




             <nav>        Used to identify major navigation links on the page, usually in the header of a page




             <article>    A reusable, independently distributable composition in a document, page, application or site




             <aside>      Tangentially related content to the main article (sidebars, pull quotes, advertising)




             <hgroup>     Used to group h1-h6 elements when heading has multiple levels




             <header>     Represents a group of introductory or navigational aids




Friday, October 8, 2010
New Semantic Tags (more)

             Tag          Description

                          Represents a footer for its nearest ancestor sectioning content or root element. Bottom of a
             <footer>     page as well as <section>’s of a page are relevant here



             <time>       Represents time on a 24-hour clock, or precise date optionally with timezone




             <mark>       Represents a run of text in one document marked or highlighted for reference purposes




             <meter>      Can be used to mark up measurements, part of a scale with min/max values




             <progress>   Markup denoting a value that is in the process of changing




Friday, October 8, 2010
Semantic Browser Support


          Internet Explorer    Mozilla Firefox   Apple Safari   Google Chrome



                      9.0           3.0             3.2             4.0




Friday, October 8, 2010
Semantic Tag Browser Support




          <!--[if lt IE 9]>
          <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
          <![endif]-->




Friday, October 8, 2010
Semantic Tag Browser Support




          <!--[if lt IE 9]>
          <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
          <![endif]-->




Friday, October 8, 2010
Local Storage allows you to save up to
        5MB of data for your web application
Friday, October 8, 2010
Local Storage

              textarea.addEventListener('keyup', function () {
              ! window.localStorage['value'] = area.value;
              ! window.localStorage['timestamp'] = (new Date()).getTime();
              }, false);
              textarea.value = window.localStorage['value'];




             http://www.mysticcoders.com/html5/webstorage.html




Friday, October 8, 2010
Local Storage Browser Support


          Internet Explorer   Mozilla Firefox   Apple Safari   Google Chrome



                      8.0          3.0             4.0             4.0




Friday, October 8, 2010
Workers at it’s simplest enable performing
        computationally expensive tasks without
        interrupting the user interface


Friday, October 8, 2010
Web Workers
             <!DOCTYPE HTML>
             <html>
              <head>
               <title>Worker example: One-core computation</title>
              </head>
              <body>
               <p>The highest prime number discovered so far is: <output
             id="result"></output></p>
               <script>
                var worker = new Worker('worker.js');
                worker.onmessage = function (event) {
                   document.getElementById('result').textContent = event.data;
                };
               </script>
              </body>
             </html>




Friday, October 8, 2010
Web Workers
          var n = 1;
          search: while (true) {
            n += 1;
            for (var i = 2; i <= Math.sqrt(n); i += 1)
              if (n % i == 0)
               continue search;
            // found a prime!
            postMessage(n);
          }




Friday, October 8, 2010
Web Workers
          var n = 1;
          search: while (true) {
            n += 1;
            for (var i = 2; i <= Math.sqrt(n); i += 1)
              if (n % i == 0)
               continue search;
            // found a prime!
            postMessage(n);
          }

      http://www.mysticcoders.com/html5/worker-example.html



Friday, October 8, 2010
Web Workers Browser Support


          Internet Explorer   Mozilla Firefox   Apple Safari   Google Chrome



              Unknown              3.5             4.0             4.0




Friday, October 8, 2010
Geolocation let’s you tell the browser
        where you are


Friday, October 8, 2010
Geolocation
           if (navigator.geolocation) {
           ! navigator.geolocation.getCurrentPosition(function(position) {
           ! var lat = position.coords.latitude;
           ! var lng = position.coords.longitude;
           ! alert('Your currently @ ('+lat+', '+lng+')');
           ! });
           }




Friday, October 8, 2010
Geolocation
           if (navigator.geolocation) {
           ! navigator.geolocation.getCurrentPosition(function(position) {
           ! var lat = position.coords.latitude;
           ! var lng = position.coords.longitude;
           ! alert('Your currently @ ('+lat+', '+lng+')');
           ! });
           }




                     http://www.mysticcoders.com/html5/geolocation.html



Friday, October 8, 2010
Geolocation
                          if (navigator.geolocation) {
                          ! navigator.geolocation.getCurrentPosition(function(position) {
                          ! var lat = position.coords.latitude;
                          ! var lng = position.coords.longitude;
                          ! var options = { position: new google.maps.LatLng(lat, lng) }
                          ! var marker = new google.maps.Marker(options);
                          ! marker.setMap(map);
                          ! });
                          }




Friday, October 8, 2010
Geolocation Browser Support


          Internet Explorer   Mozilla Firefox   Apple Safari   Google Chrome



              Unknown              3.5             5.0             5.0




Friday, October 8, 2010
More HTML5
    application cache - specify with a cache.manifest files you’d like
    the browser to eagerly cache for offline use
    web database - embedded SQL database which most browsers
    have chosen to use sqlite
    cross document messaging - allows documents to communicate
    regardless of source domain (no XSS script attacks)
    drag and drop - allows elements to be draggable and droppable




Friday, October 8, 2010
More HTML5
    webgl - provides an API for writing web applications utilizing
    hardware accelerated 3D graphics
    web notifications - provides an API for alerting users outside
    of a web page via notifications




Friday, October 8, 2010
More websites for
                          HTML5 knowledge
                                       C E S
                              U R
  E SO
R
Friday, October 8, 2010
http://whatwg.org/html5

                                 http://validator.nu

                               http://validator.w3.org/

          http://www.brucelawson.co.uk/category/html5/

                               http://html5doctor.com/

                              http://diveintohtml5.org/

                             http://www.modernizr.com/

                          http://code.google.com/p/html5shiv/


Friday, October 8, 2010
Friday, October 8, 2010
HTML5
                          Rocks!!




Friday, October 8, 2010
Q&A
                            Thanks for listening!



          Andrew Lombardi
          Owner, Tech Evangelist
          Mystic Coders, LLC
          andrew AT mysticcoders DOT com

          kinabalu @ irc://irc.freenode.net - ##wicket, ##java
Friday, October 8, 2010

More Related Content

Similar to In depth with html5 java2days 2010

Html5/CSS3 in shanghai 2010
Html5/CSS3 in shanghai 2010Html5/CSS3 in shanghai 2010
Html5/CSS3 in shanghai 2010
Zi Bin Cheah
 
Html5 apps nikolaionken-08-06
Html5 apps nikolaionken-08-06Html5 apps nikolaionken-08-06
Html5 apps nikolaionken-08-06
Skills Matter
 
IE9 для разработчиков
IE9 для разработчиковIE9 для разработчиков
IE9 для разработчиков
Yuriy Artyukh
 
Browsers & Web Technology - an Opera talk
Browsers & Web Technology - an Opera talkBrowsers & Web Technology - an Opera talk
Browsers & Web Technology - an Opera talk
Zi Bin Cheah
 
Large problems, Mostly Solved
Large problems, Mostly SolvedLarge problems, Mostly Solved
Large problems, Mostly Solved
ericholscher
 
RIA Unleashed - Developing for the TV with litl os
RIA Unleashed - Developing for the TV with litl osRIA Unleashed - Developing for the TV with litl os
RIA Unleashed - Developing for the TV with litl os
ryancanulla
 
WebShell - confoo 2011 - sean coates
WebShell - confoo 2011 - sean coatesWebShell - confoo 2011 - sean coates
WebShell - confoo 2011 - sean coates
Bachkoutou Toutou
 

Similar to In depth with html5 java2days 2010 (20)

Html5/CSS3 in shanghai 2010
Html5/CSS3 in shanghai 2010Html5/CSS3 in shanghai 2010
Html5/CSS3 in shanghai 2010
 
Html5 apps nikolaionken-08-06
Html5 apps nikolaionken-08-06Html5 apps nikolaionken-08-06
Html5 apps nikolaionken-08-06
 
HTML5 - Yeah!
HTML5 - Yeah!HTML5 - Yeah!
HTML5 - Yeah!
 
Html5 Development
Html5 DevelopmentHtml5 Development
Html5 Development
 
Html5 Apps
Html5 AppsHtml5 Apps
Html5 Apps
 
Building Brilliant APIs
Building Brilliant APIsBuilding Brilliant APIs
Building Brilliant APIs
 
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScript
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScriptSencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScript
Sencha Touch beta — Amazing Mobile Web Apps with HTML5, CSS3 & JavaScript
 
Web App Scaffolding - FOWA London 2010
Web App Scaffolding - FOWA London 2010Web App Scaffolding - FOWA London 2010
Web App Scaffolding - FOWA London 2010
 
IE9 для разработчиков
IE9 для разработчиковIE9 для разработчиков
IE9 для разработчиков
 
Browsers & Web Technology - an Opera talk
Browsers & Web Technology - an Opera talkBrowsers & Web Technology - an Opera talk
Browsers & Web Technology - an Opera talk
 
Html5 coredevsummit
Html5 coredevsummitHtml5 coredevsummit
Html5 coredevsummit
 
Is these a bug
Is these a bugIs these a bug
Is these a bug
 
Debugging your JavaScript
Debugging your JavaScriptDebugging your JavaScript
Debugging your JavaScript
 
Html5 sing, dance and show mary
Html5   sing, dance and show maryHtml5   sing, dance and show mary
Html5 sing, dance and show mary
 
Large problems, Mostly Solved
Large problems, Mostly SolvedLarge problems, Mostly Solved
Large problems, Mostly Solved
 
RIA Unleashed - Developing for the TV with litl os
RIA Unleashed - Developing for the TV with litl osRIA Unleashed - Developing for the TV with litl os
RIA Unleashed - Developing for the TV with litl os
 
CSS Bloat!
CSS Bloat!CSS Bloat!
CSS Bloat!
 
Please Don't Touch the Slow Parts
Please Don't Touch the Slow PartsPlease Don't Touch the Slow Parts
Please Don't Touch the Slow Parts
 
WebShell - confoo 2011 - sean coates
WebShell - confoo 2011 - sean coatesWebShell - confoo 2011 - sean coates
WebShell - confoo 2011 - sean coates
 
QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!
 

More from Mystic Coders, LLC

More from Mystic Coders, LLC (6)

Infrastructure As Code With Terraform
Infrastructure As Code With TerraformInfrastructure As Code With Terraform
Infrastructure As Code With Terraform
 
Privacy in the Age of Analytica
Privacy in the Age of AnalyticaPrivacy in the Age of Analytica
Privacy in the Age of Analytica
 
The Three Keys To Remote Team Success
The Three Keys To Remote Team SuccessThe Three Keys To Remote Team Success
The Three Keys To Remote Team Success
 
Privacy in the Age of Analytica
Privacy in the Age of AnalyticaPrivacy in the Age of Analytica
Privacy in the Age of Analytica
 
React and redux
React and reduxReact and redux
React and redux
 
Architecting Applications Using Apache Wicket Java2 Days 2009
Architecting Applications Using Apache Wicket   Java2 Days 2009Architecting Applications Using Apache Wicket   Java2 Days 2009
Architecting Applications Using Apache Wicket Java2 Days 2009
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

In depth with html5 java2days 2010

  • 1. In depth with HTML5 Andrew Lombardi Owner, Tech Evangelist Mystic Coders, LLC andrew AT mysticcoders DOT com kinabalu @ irc://irc.freenode.net - ##wicket, ##java kinabalu @ twitter Friday, October 8, 2010
  • 3. 10 Years in business Friday, October 8, 2010
  • 4. 10 Years in business Software Consultants Friday, October 8, 2010
  • 5. 10 Years in business Software Consultants International Speaker Friday, October 8, 2010
  • 6. 10 Years in business Software Consultants International Speaker Training Friday, October 8, 2010
  • 7. 10 Years in business Software Consultants International Speaker Training Apache Wicket Contributor Friday, October 8, 2010
  • 8. 10 Years in business Software Consultants International Speaker Training Apache Wicket Contributor To our success! Friday, October 8, 2010
  • 11. What is HTML5? Friday, October 8, 2010
  • 12. A brief history of time (HTML) Friday, October 8, 2010
  • 13. A brief history of time (HTML) 1991 - First version of HTML Friday, October 8, 2010
  • 14. A brief history of time (HTML) 1991 - First version of HTML 1994 - HTML2 is born Friday, October 8, 2010
  • 15. A brief history of time (HTML) 1991 - First version of HTML 1994 - HTML2 is born 1996 - CSS1 + JavaScript Friday, October 8, 2010
  • 16. A brief history of time (HTML) 1991 - First version of HTML 1994 - HTML2 is born 1996 - CSS1 + JavaScript 1996 - First “developer” mistakes Javascript for Java Friday, October 8, 2010
  • 17. A brief history of time (HTML) Friday, October 8, 2010
  • 18. A brief history of time (HTML) 1997 - HTML4 Friday, October 8, 2010
  • 19. A brief history of time (HTML) 1997 - HTML4 1998 - CSS2 Friday, October 8, 2010
  • 20. A brief history of time (HTML) 1997 - HTML4 1998 - CSS2 2000 - XHTML is hatched Friday, October 8, 2010
  • 21. A brief history of time (HTML) 1997 - HTML4 1998 - CSS2 2000 - XHTML is hatched 2000 - Malformed HTML writers are burned at stake Friday, October 8, 2010
  • 22. A brief history of time (HTML) Friday, October 8, 2010
  • 23. A brief history of time (HTML) 2002 - Tableless Web Design Friday, October 8, 2010
  • 24. A brief history of time (HTML) 2002 - Tableless Web Design 2002 - Average HTML page creation 5x longer Friday, October 8, 2010
  • 25. A brief history of time (HTML) 2002 - Tableless Web Design 2002 - Average HTML page creation 5x longer 2005 - AJAX Friday, October 8, 2010
  • 26. A brief history of time (HTML) 2002 - Tableless Web Design 2002 - Average HTML page creation 5x longer 2005 - AJAX 2009 - HTML5 Friday, October 8, 2010
  • 27. HTML5 is... HTML5 is a replacement for HTML 4.01, XHTML 1.0, and XHTML 1.1 Friday, October 8, 2010
  • 28. WHATWG vs W3C deathmatch Friday, October 8, 2010
  • 29. WHATWG vs W3C deathmatch Draconian Error Handling Friday, October 8, 2010
  • 30. WHATWG vs W3C deathmatch Draconian Error Handling Backwards Compatibility Friday, October 8, 2010
  • 31. What we’ll cover Friday, October 8, 2010
  • 32. What we’ll cover 1. The Setup Friday, October 8, 2010
  • 33. What we’ll cover 1. The Setup 2. Video and Audio Friday, October 8, 2010
  • 34. What we’ll cover 1. The Setup 2. Video and Audio 3. Canvas Friday, October 8, 2010
  • 35. What we’ll cover 1. The Setup 2. Video and Audio 3. Canvas 4. Forms Friday, October 8, 2010
  • 36. What we’ll cover 1. The Setup 2. Video and Audio 3. Canvas 4. Forms 5. Local Storage Friday, October 8, 2010
  • 37. What we’ll cover 1. The Setup 2. Video and Audio 3. Canvas 4. Forms 5. Local Storage 6. Web Workers Friday, October 8, 2010
  • 38. What we’ll cover 1. The Setup 2. Video and Audio 3. Canvas 4. Forms 5. Local Storage 6. Web Workers 7. Geolocation Friday, October 8, 2010
  • 39. The Cooking show model Friday, October 8, 2010
  • 40. ? Why HTML5 Friday, October 8, 2010
  • 43. Support coming in 2015 Friday, October 8, 2010
  • 45. The Old Way <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> Friday, October 8, 2010
  • 46. The New Way <!DOCTYPE html> Friday, October 8, 2010
  • 47. The New Way <!DOCTYPE html> Miss the DOCTYPE and get Quirks mode Friday, October 8, 2010
  • 48. The Old Way <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> Friday, October 8, 2010
  • 49. The New Way <html lang="en"> Friday, October 8, 2010
  • 50. The Old Way <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> Friday, October 8, 2010
  • 51. The New Way <meta charset="utf-8"> Friday, October 8, 2010
  • 52. Typing is so 2009 Friday, October 8, 2010
  • 53. Typing is so 2009 Instead of <link rel="stylesheet" href="style.css" type="text/css" /> <script type="text/javascript"> ... </script> Friday, October 8, 2010
  • 54. Typing is so 2009 Instead of <link rel="stylesheet" href="style.css" type="text/css" /> <script type="text/javascript"> ... </script> Just do <link rel="stylesheet" href="style.css" /> <script> ... </script> Friday, October 8, 2010
  • 55. Typing is so 2009 Instead of <link rel="stylesheet" href="style.css" type="text/css" /> <script type="text/javascript"> ... </script> Just do <link rel="stylesheet" href="style.css" /> <script> ... </script> We know what you mean. Friday, October 8, 2010
  • 56. Boolean Types in Tags <input type="text" name="email" required /> Friday, October 8, 2010
  • 57. Boolean Types in Tags <input type="text" name="email" required /> If you reference it in the markup, it’s true. Friday, October 8, 2010
  • 60. Video and Audio in HTML5 has a lot of promise, but patent hippos get in the way Friday, October 8, 2010
  • 61. HTML5 Video Ogg - Not patent encumbered but quality is not there H.264 - Only pay royalties if end-user video is not free WebM / VP8 - Google released as royalty free after purchasing from On2 Friday, October 8, 2010
  • 62. HTML5 Video Ogg - Not patent encumbered but quality is not there H.264 - Only pay royalties if end-user video is not free WebM / VP8 - Google released as royalty free after purchasing from On2 Patent landscape for video is unclear Friday, October 8, 2010
  • 63. HTML5 Video <video ! id=”video” ! width="640" ! height="360" ! src="big_buck_bunny.mp4" ! controls ! poster="poster.jpg"> </video> document.getElementById("video").play(); Friday, October 8, 2010
  • 64. Video Attributes autoplay - video starts playing as soon as it’s ready controls - browser-specific controls for video displayed height - height of video width - width of video loop - replay video on end src - location of video poster - image to show before video plays Friday, October 8, 2010
  • 65. HTML5 Video <video width="640" height="360" controls poster="poster.jpg"> ! <source src="big_buck_bunny.mp4" type="video/mp4" /> ! <source src="big_buck_bunny.webm" type="video/webm" /> ! <source src="big_buck_bunny.ogv" type="video/ogg" /> ! <object width="640" height="384" type="application/x-shockwave-flash" data="player.swf"> ! ! <param name="movie" value="player.swf" /> ! ! <param name="flashvars" value="controlbar=over&amp;image=poster.jpg&amp;file=big_buck_bunny.mp4" /> ! ! <img src="poster.jpg" width="640" height="360" alt="Big Buck Bunny" ! ! title="No video playback capabilities, please download the video below" /> ! </object> </video> Friday, October 8, 2010
  • 67. Video Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome Flash only Ogg H.264 H.264 + Ogg Friday, October 8, 2010
  • 68. Video Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome 9.0 3.5 3.2 4.0 Friday, October 8, 2010
  • 69. Checking Video Support function supports_video() { ! return !document.createElement('video').canPlayType; } Friday, October 8, 2010
  • 70. Modernizr Library if(Modernizr.video) { ! // let's play some video! } Friday, October 8, 2010
  • 71. Modernizr Library if(Modernizr.video) { ! // let's play some video! } Friday, October 8, 2010
  • 72. HTML5 Audio <audio ! id="audio" ! src="elvis.mp3" ! controls ! autobuffer /> document.getElementById("audio").play(); Friday, October 8, 2010
  • 73. Audio Attributes autoplay - audio starts playing as soon as it’s ready controls - browser-specific controls for audio displayed preload - should browser preload audio? if autoplay -ignored loop - replay audio on end src - location of audio Friday, October 8, 2010
  • 74. HTML5 Audio <audio controls autobuffer> ! <source src="elvis.ogg" /> ! <source src="elvis.mp3" /> </audio> Friday, October 8, 2010
  • 75. Audio Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome Flash only Ogg, WAV MP3 Ogg, MP3 Friday, October 8, 2010
  • 76. Audio Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome 9.0 3.5 3.2 4.0 Friday, October 8, 2010
  • 77. Nothing to do with HTML5 Canvas but who’s complaining? Friday, October 8, 2010
  • 78. Canvas <canvas id="someshape" width="150" height="150"></canvas> var shape = document.getElementById('someshape'); var context = shape.getContext('2d'); context.fillStyle = "rgb(255,0,0)"; context.fillRect(0, 0, 150, 150); Friday, October 8, 2010
  • 79. Canvas <canvas id="j2dlogo"> <p>Your browser doesn't support canvas.</p> </canvas> <script> var canvas = document.getElementById('j2dlogo'); if(canvas.getContext) { ! ! var context = canvas.getContext('2d'); ! ! var myImage = new Image(); ! ! myImage.onload = function() { ! ! canvas.setAttribute('width', myImage.width); ! ! canvas.setAttribute('height', myImage.height); ! ! context.drawImage(myImage, 0, 0); ! } ! myImage.src = "j2dlogo.png";! } </script> Friday, October 8, 2010
  • 80. Canvas Extreme http://www.nihilogic.dk/labs/wolf/ Friday, October 8, 2010
  • 81. Canvas Browser Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome 9.0 3.0 3.2 4.0 Friday, October 8, 2010
  • 82. Forms in Wicket allow you to accept, process and validate user input. Friday, October 8, 2010
  • 83. HTML5 Forms Tag Description type=”date” Represents a UTC formatted date type=”color” Represents a hexadecimal RGB color value type=”number” Represents a numeric value type=”search” Simple text box but browser can choose to provide custom control type=”email”, type=”url”, Represents contact details. Browser can choose to represent our handle input differently (i.e. type=”tel” Mobile Safari) type=”range” Represents a range of values with min/max Friday, October 8, 2010
  • 84. HTML5 Forms (more) Tag Description pattern=”some.regex” Use a regex to validate against the input without requiring Javascript involvement placeholder=”Insert Attached to input type=”text” to show placeholder text before user clicks placeholder text here” Boolean value used only once per page identifying the form component that should receive autofocus immediate focus after page load autocomplete on/off switch used to tell browser if it’s okay to autocomplete this field with saved data Boolean value for semantically and functionally marking a field as requiring input before valid required submission <datalist> A combo box allowing selection via preselected values or entering custom placeholder=”Insert Attached to input type=”text” to show placeholder text before user clicks placeholder text here” Friday, October 8, 2010
  • 85. New Form Tags Browser Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome ? 4.0 4.0 4.0 Friday, October 8, 2010
  • 86. Semantic markup in HTML5 identifies based on meaning rather than layout Friday, October 8, 2010
  • 87. New Semantic Tags Tag Description <section> A generic section of a document or application, a grouping of content typically with a header <nav> Used to identify major navigation links on the page, usually in the header of a page <article> A reusable, independently distributable composition in a document, page, application or site <aside> Tangentially related content to the main article (sidebars, pull quotes, advertising) <hgroup> Used to group h1-h6 elements when heading has multiple levels <header> Represents a group of introductory or navigational aids Friday, October 8, 2010
  • 88. New Semantic Tags (more) Tag Description Represents a footer for its nearest ancestor sectioning content or root element. Bottom of a <footer> page as well as <section>’s of a page are relevant here <time> Represents time on a 24-hour clock, or precise date optionally with timezone <mark> Represents a run of text in one document marked or highlighted for reference purposes <meter> Can be used to mark up measurements, part of a scale with min/max values <progress> Markup denoting a value that is in the process of changing Friday, October 8, 2010
  • 89. Semantic Browser Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome 9.0 3.0 3.2 4.0 Friday, October 8, 2010
  • 90. Semantic Tag Browser Support <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> Friday, October 8, 2010
  • 91. Semantic Tag Browser Support <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> Friday, October 8, 2010
  • 92. Local Storage allows you to save up to 5MB of data for your web application Friday, October 8, 2010
  • 93. Local Storage textarea.addEventListener('keyup', function () { ! window.localStorage['value'] = area.value; ! window.localStorage['timestamp'] = (new Date()).getTime(); }, false); textarea.value = window.localStorage['value']; http://www.mysticcoders.com/html5/webstorage.html Friday, October 8, 2010
  • 94. Local Storage Browser Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome 8.0 3.0 4.0 4.0 Friday, October 8, 2010
  • 95. Workers at it’s simplest enable performing computationally expensive tasks without interrupting the user interface Friday, October 8, 2010
  • 96. Web Workers <!DOCTYPE HTML> <html> <head> <title>Worker example: One-core computation</title> </head> <body> <p>The highest prime number discovered so far is: <output id="result"></output></p> <script> var worker = new Worker('worker.js'); worker.onmessage = function (event) { document.getElementById('result').textContent = event.data; }; </script> </body> </html> Friday, October 8, 2010
  • 97. Web Workers var n = 1; search: while (true) { n += 1; for (var i = 2; i <= Math.sqrt(n); i += 1) if (n % i == 0) continue search; // found a prime! postMessage(n); } Friday, October 8, 2010
  • 98. Web Workers var n = 1; search: while (true) { n += 1; for (var i = 2; i <= Math.sqrt(n); i += 1) if (n % i == 0) continue search; // found a prime! postMessage(n); } http://www.mysticcoders.com/html5/worker-example.html Friday, October 8, 2010
  • 99. Web Workers Browser Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome Unknown 3.5 4.0 4.0 Friday, October 8, 2010
  • 100. Geolocation let’s you tell the browser where you are Friday, October 8, 2010
  • 101. Geolocation if (navigator.geolocation) { ! navigator.geolocation.getCurrentPosition(function(position) { ! var lat = position.coords.latitude; ! var lng = position.coords.longitude; ! alert('Your currently @ ('+lat+', '+lng+')'); ! }); } Friday, October 8, 2010
  • 102. Geolocation if (navigator.geolocation) { ! navigator.geolocation.getCurrentPosition(function(position) { ! var lat = position.coords.latitude; ! var lng = position.coords.longitude; ! alert('Your currently @ ('+lat+', '+lng+')'); ! }); } http://www.mysticcoders.com/html5/geolocation.html Friday, October 8, 2010
  • 103. Geolocation if (navigator.geolocation) { ! navigator.geolocation.getCurrentPosition(function(position) { ! var lat = position.coords.latitude; ! var lng = position.coords.longitude; ! var options = { position: new google.maps.LatLng(lat, lng) } ! var marker = new google.maps.Marker(options); ! marker.setMap(map); ! }); } Friday, October 8, 2010
  • 104. Geolocation Browser Support Internet Explorer Mozilla Firefox Apple Safari Google Chrome Unknown 3.5 5.0 5.0 Friday, October 8, 2010
  • 105. More HTML5 application cache - specify with a cache.manifest files you’d like the browser to eagerly cache for offline use web database - embedded SQL database which most browsers have chosen to use sqlite cross document messaging - allows documents to communicate regardless of source domain (no XSS script attacks) drag and drop - allows elements to be draggable and droppable Friday, October 8, 2010
  • 106. More HTML5 webgl - provides an API for writing web applications utilizing hardware accelerated 3D graphics web notifications - provides an API for alerting users outside of a web page via notifications Friday, October 8, 2010
  • 107. More websites for HTML5 knowledge C E S U R E SO R Friday, October 8, 2010
  • 108. http://whatwg.org/html5 http://validator.nu http://validator.w3.org/ http://www.brucelawson.co.uk/category/html5/ http://html5doctor.com/ http://diveintohtml5.org/ http://www.modernizr.com/ http://code.google.com/p/html5shiv/ Friday, October 8, 2010
  • 110. HTML5 Rocks!! Friday, October 8, 2010
  • 111. Q&A Thanks for listening! Andrew Lombardi Owner, Tech Evangelist Mystic Coders, LLC andrew AT mysticcoders DOT com kinabalu @ irc://irc.freenode.net - ##wicket, ##java Friday, October 8, 2010