Online Multimedia Winter semester 2015/16



Similar documents
ANGULAR JS SOFTWARE ENGINEERING FOR WEB SERVICES HASAN FAIZAL K APRIL,2014

Online Multimedia Winter semester 2015/16

Mul$media im Netz (Online Mul$media) Wintersemester 2014/15. Übung 06 (Nebenfach)

the intro for RPG programmers Making mobile app development easier... of KrengelTech by Aaron Bartell

PLAYER DEVELOPER GUIDE

Multimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 03 Major Subject

c. Write a JavaScript statement to print out as an alert box the value of the third Radio button (whether or not selected) in the second form.

Making Web Application using Tizen Web UI Framework. Koeun Choi

Mobile Web Applications. Gary Dubuque IT Research Architect Department of Revenue

Continue Your Learning with STC Education!

HTML Application Creation. Rich Loen CTO, InGenius June 26, 2007

Website Login Integration

JavaScript and Dreamweaver Examples

Configuring iplanet 6.0 Web Server For SSL and non-ssl Redirect

Building Web Applications with HTML5, CSS3, and Javascript: An Introduction to HTML5

Yandex.Widgets Quick start

Outline. 1.! Development Platforms for Multimedia Programming!

JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

Copyright by Object Computing, Inc. (OCI). All rights reserved. AngularJS Testing

Script Handbook for Interactive Scientific Website Building

1. About the Denver LAMP meetup group. 2. The purpose of Denver LAMP meetups. 3. Volunteers needed for several positions

Web Development 1 A4 Project Description Web Architecture

MASTERTAG DEVELOPER GUIDE

React+d3.js. Build data visualizations with React and d3.js. Swizec Teller. This book is for sale at

Website Planning Checklist

Visualizing an OrientDB Graph Database with KeyLines

Intell-a-Keeper Reporting System Technical Programming Guide. Tracking your Bookings without going Nuts!

Hello World RESTful web service tutorial

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Design Pa*erns for JavaScript Web Apps. Stefan Scheidt OPITZ CONSULTING GmbH

Chapter 2 HTML Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Peers Technologies Pvt. Ltd. Web Application Development

WebRTC_call. Authorization. function logintowsc() { var wscdemobaseurl = " window.location.href =

The Google Web Toolkit (GWT): Declarative Layout with UiBinder Basics

Visualizing a Neo4j Graph Database with KeyLines

Building Rich Internet Applications with PHP and Zend Framework

ecommercesoftwareone Advance User s Guide -

Fortigate SSL VPN 4 With PINsafe Installation Notes

WIRIS quizzes web services Getting started with PHP and Java

Introduction to PhoneGap

Your First Web Page. It all starts with an idea. Create an Azure Web App

MOBILE DEVELOPMENT. With jquery Mobile & PhoneGap by Pete Freitag / Foundeo Inc. petefreitag.com / foundeo.com

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

ACCESSING THE PROGRESS OPENEDGE APPSERVER FROM PROGRESS ROLLBASE USING JSDO CODE

Fortigate SSL VPN 3.x With PINsafe Installation Notes

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

CSC309 Winter 2016 Lecture 3. Larry Zhang

CS412 Interactive Lab Creating a Simple Web Form

Learn. JavaScript. Steve Suehring

Chapter 1 Programming Languages for Web Applications

Advanced Tornado TWENTYONE Advanced Tornado Accessing MySQL from Python LAB

JavaScript Basics & HTML DOM. Sang Shin Java Technology Architect Sun Microsystems, Inc. sang.shin@sun.com

Instructions for Embedding a Kudos Display within Your Website

The purpose of jquery is to make it much easier to use JavaScript on your website.

CIS 467/602-01: Data Visualization

InPost UK Limited GeoWidget Integration Guide Version 1.1

Slide.Show Quick Start Guide

Client-side Web Engineering From HTML to AJAX

Spectrum Technology Platform

JavaScript: Introduction to Scripting Pearson Education, Inc. All rights reserved.

AngularJS for the enterprise

Step by step guides. Deploying your first web app to your FREE Azure Subscription with Visual Studio 2015

Example. Represent this as XML

Abusing HTML5. DEF CON 19 Ming Chow Lecturer, Department of Computer Science TuCs University Medford, MA

IBM Digital Experience. Using Modern Web Development Tools and Technology with IBM Digital Experience

1 of 8 9/14/2011 5:40 PM

Reading an sent with Voltage Secur . Using the Voltage Secur Zero Download Messenger (ZDM)

Chapter 22 How to send and access other web sites

Professional & Workgroup Editions

Lab 5 Introduction to Java Scripts

LAB MANUAL CS (22): Web Technology

jquery Programming Cookbook jquery Programming Cookbook

Using HTML5 Pack for ADOBE ILLUSTRATOR CS5

Overview. In the beginning. Issues with Client Side Scripting What is JavaScript? Syntax and the Document Object Model Moving forward with JavaScript

Getting Started Developing JavaScript Web Apps. this = that. VT Geospatial Forum 2015

Further web design: HTML forms

Introduction to WebGL

INTRODUCTION WHY WEB APPLICATIONS?

Modern Web Apps with HTML5 Web Components, Polymer, and Java EE MVC 1.0. Kito Mann Virtua, Inc.

Getting Started Guide: Transaction Download for QuickBooks Windows. Information You ll Need to Get Started

Short notes on webpage programming languages

Website Implementation

Concordion. Concordion. Tomo Popovic, tp0x45 [at] gmail.com

<script type="text/javascript"> var _gaq = _gaq []; _gaq.push(['_setaccount', 'UA ']); _gaq.push(['_trackpageview']);

shweclassifieds v 3.3 Php Classifieds Script (Joomla Extension) User Manual (Revision 2.0)

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

HTTP is Stateless. it simply allows a browser to request a single document from a web server. it remembers nothing between invoca9ons.

Introduction to Web Design Curriculum Sample

Content Editor for Personal Web Pages

CHOOSING THE RIGHT HTML5 FRAMEWORK To Build Your Mobile Web Application

Integration Guide. Integrating Extole with Adobe Target. Overview. Before You Begin. Advantages of A/B Testing

Implementing Specialized Data Capture Applications with InVision Development Tools (Part 2)

Dashbuilder Documentation Version Final

SUHAIL DAWOOD Toronto, Ontario

Write a Web Application for Free Edition 2

Ansible. Configuration management tool and ad hoc solution. Marcel Nijenhof

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

«W3Schools Home Next Chapter» JavaScript is THE scripting language of the Web.

QQ WebAgent Quick Start Guide

Web and e-business Technologies

Transcription:

Multimedia im Netz Online Multimedia Winter semester 2015/16 Tutorial 12 Major Subject Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-1

Today s Agenda Imperative vs. Declarative programming WebComponents with Polymer Getting Started / Code-Along Using Components Google Map Components Databinding in Polymer Quiz Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-2

Assignment 12 Segment Image Is composed of Component: People Component: Trashcan Component: Wall Is composed of In front of Is composed of Component: Woman Component: Ball and Chain Right of above Component: Man Component: Fascist Ronald Component: HappyCat Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-3 Right of

Imperative vs. Declarative Imperative: Specify how to do something Declarative: Specify what should be done other definition: a programming paradigm that expresses the logic of a computation without describing its control flow Often (not always), you ll find these concepts alongside declarative programming Functional programming Reactive programming Databinding (see following slides) http://latentflip.com/imperative-vs-declarative/ Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-4

Example: Imperative Input Handling <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"><title>imperative vs Declarative Event Handlers</title> </head> <body> <input id="name" placeholder="enter your name" /> <button id="imperative" disabled>ok</button> <div>your name: <span id="output"></span></div> <script> var username = ''; var imperativebutton = document.getelementbyid('imperative'); function updateui(){ document.getelementbyid('output').innerhtml = username; imperativebutton.disabled = username.length == 0; } document.getelementbyid('name').addeventlistener('input',function(){ username = this.value; updateui(); }); </script> </body></html> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-5

Example: Imperative Input Handling <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"><title>imperative vs Declarative Event Handlers</title> </head> <body> <input id="name" placeholder="enter your name" /> <button id="imperative" disabled>ok</button> <div>your name: <span id="output"></span></div> <script> var username = ''; var imperativebutton = document.getelementbyid('imperative'); function updateui(){ document.getelementbyid('output').innerhtml = username; imperativebutton.disabled = username.length == 0; } document.getelementbyid('name').addeventlistener('input',function(){ username = this.value; updateui(); }); </script> </body></html> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-6

Declarative Equivalent with AngularJS (1.4) <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>declarative Example</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/an gular.min.js"></script> </head> <body ng-app> <input placeholder="enter your name" ng-model="username"/> <button ng-disabled="!username">ok</button> <div>your name: <span id="output">{{username}}</span></div> </body> </html> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-7

Databinding Model-View-Binder: Variant of the Model-View-ViewModel Pattern Goal: Simplify event driven programming Separation of user interface and business logic More declarative programming Declarative aspect: Declare what data you want in the UI, rather than how to get it. Many JavaScript frameworks currently are driven by this paradigm. Angular Polymer KnockoutJS ReactJS Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-8

A Problem Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-9

A Solution: Custom HTML Elements <hangout-module> <hangout-chat from="paul, Addy"> <hangout-discussion> <hangout-message from="paul" profile="profile.png" datetime="2013-07-17t12:02"> <p>feelin' this Web Components thing.</p> <p>heard of it?</p> </hangout-message> </hangout-discussion> </hangout-chat> <hangout-chat>...</hangout-chat> </hangout-module> http://www.html5rocks.com/en/tutorials/webcomponents/customelements/ Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-10

Web Components Approach to more declarative web programming style. Goal: re-use things, that we would have to write over and over (reducing boilerplate code on the web) Driven by Google and also Mozilla (x-tag) Concepts: Custom Elements HTML Imports Templates Shadow DOM Image: http://webcomponents.org/ Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-11

Polymer Material Design Large library of custom elements (the Element Catalog) Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-12

Getting Started with Polymer: Tools Option A: Your favorite Text Editor / IDE Install bower Use the bower.json file we provide on GitHub Run bower install Create an html file and start working with Polymer Option B: Use Chrome Dev Editor Download here: https://chrome.google.com/webstore/detail/chromedev-editor-develop/pnoffddplpippgcfjdhbmhkofpnaalpg Create a new project, use the template Javascript web app (using Polymer paper elements) Wait until bower dependencies are set up Run the project. See changes in the browser immediately. Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-13

Using Custom Web Components <!doctype html> <html> <head> <title>polymer Basics</title> <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"> </script> <link rel="import" href="bower_components/paper-button/paper-button.html"> <link rel="stylesheet" href="styles.css"> </head> <body> <paper-button raised>hi there!</paper-button> </body></html> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-14

Goal of today s Code-Along Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-15

Breakout: Setup - More components Add the following: <paper-card> <paper-input> <iron-icons> Create a box with those four components: Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-16

Resources Each component is documented, e.g. iron-icons https://elements.polymer-project.org/elements/iron-icons To see the component in action, click on Demo on the left: Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-17

Sample Solution... <paper-card> <paper-input label="latitude" type="number" value="48.1499762"></paper-input> <paper-input label="longitude" type="number" value="11.5736231"></paper-input> <paper-button> <iron-icon icon="autorenew"></iron-icon> Update! </paper-button> </paper-card> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-18

Adding a Map Component Modify the bower.json file: "dependencies": { "iron-elements": "PolymerElements/iron-elements#^1.0.7", "paper-elements": "PolymerElements/paper-elements#^1.0.7", "google-map": "GoogleWebComponents/google-map#~1.1.7" } Those of you who use bower can run bower install --save GoogleWebComponents/google-map Include and use these components: <link rel="import" href="bower_components/google-map/google-map.html"> <link rel="import" href="bower_components/google-map/google-map-marker.html"> Create the element: <google-map latitude="48.1499762" longitude="11.5736231"> </google-map> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-19

Result: A Map! Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-20

Breakout: Add a <google-map-marker> Use the <google-map-marker> component to display a marker on the map use coordinates that are shown on the current map (48.1499762, 11.5736231) Create a <h2> and <div> inside it. Those are displayed inside the info window. Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-21

Sample Solution <google-map latitude="48.1499762" longitude="11.5736231"> <google-map-marker latitude="48.1499762" longitude="11.5736231"> <h2>my marker</h2> <div> The marker is the center of attention. </div> </google-map-marker> </google-map> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-22

Breakout: Event Listeners Attach an event listener for the tap event to the update button. Adjust the latitude and longitude of the map depending on the values inside the <paper-input> elements Adjust the latitude and longitude of the <google-map-marker> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-23

Sample Solution <script> var marker = document.queryselector('google-map-marker'), button = document.queryselector('paper-button'), latitudeinput = document.getelementbyid('latitude'), longitudeinput = document.getelementbyid('longitude'), googlemap = document.queryselector('google-map'); button.addeventlistener('tap',function(){ var latitude = latitudeinput.value; var longitude = longitudeinput.value; googlemap.latitude = latitude; googlemap.longitude = longitude; }); marker.latitude = latitude; marker.longitude = longitude; </script> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-24

Thoughts on Sample Solution Imperative programming paradigm Components have certain states which we take care of latitude/longitude We specify how the events should be handled, i.e. each single step. JavaScript is required Goal: more declarative way of updating the map and marker. Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-25

Databinding in Polymer Similar to what we saw earlier in AngularJS Advantage: more declarative, no JavaScript on our side necessary (but it is used under the hood) Square brackets [[ ]]: One-way databinding host notifies target Curly brackets {{ }}: Automatic databinding host notifies target (downwards) target notifies host (upwards), if target allows this. Databinding needs a binding scope: <template is="dom-bind"> Everything in here can use this databinding scope. </template> https://www.polymer-project.org/1.0/docs/devguide/data-binding.html Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-26

Modifying our working sample (1) <paper-card> <paper-input label="latitude" type="number" value="{{latitude}}" id="latitude" ></paper-input> <paper-input label="longitude" type="number" value="{{longitude}}" id="longitude" ></paper-input> </paper-card> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-27

Modifying our working sample (2) <google-map latitude="{{latitude}}" longitude="{{longitude}}"> <google-map-marker latitude="{{latitude}}" longitude="{{longitude}}" animation="drop"> <h2>my marker</h2> <div>the marker is the center of attention. </div> </google-map-marker> </google-map> Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-28

Result... Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-29

Result after typing inside the input boxes Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-30

Breakout: Fix Rounding Issue If you type in the <paper-input> fields, you ll notice that the value is automatically adjusted, preventing you from typing more than one digit: Fix this problem. Do not use JavaScript. Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-31

Breakout: Extend the Interaction Re-establish the default values for the marker. give the <template> an id="app". the latitude and longitude are accessible as properties from the template You do need JavaScript for that. Make the marker draggable without using JavaScript. Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-32

Assignment https://youtu.be/3ftv5jnpntw Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-33

Assignment Create a small music-library webpage using lots of elements from the polymer element catalog. To create the solution shown in the video we used: iron-flex-layout, iron-icons, iron-icons/av-icons, iron-image, iron-pages, paper-button, paper-card, paper-drawer-panel, paper-header-panel, paper-icon-button, paper-input, paperitem/paper-icon-item, paper-listbox, paper-menu, paperstyles/default-theme, paper-styles/typography, paper-tabs, paper-tabs/paper-tab, paper-toolbar Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-34

Round-Up Quiz 1. Which of these languages are 100% declarative? 1. HTML 2. JavaScript 3. Java 4. SQL? 2. What is the correct binding annotation for one-way binding? 3. Which 4 concepts do WebComponents encompass? Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-35

Thanks! What are your questions? Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-36

Links https://remysharp.com/2010/10/08/what-is-a-polyfill http://w3c.github.io/webcomponents/explainer/ Polymer tutorials on YouTube: https://www.youtube.com/playlist?list=pllnphn493bhghog Ab2PRKzv4Zw3QoatK- More details on declarative programming: https://www.youtube.com/watch?v=xsemyqomnnk Motivation for declarative programming (python): https://www.youtube.com/watch?v=nrdc6gtfb4g Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 12-37