SlideShare a Scribd company logo
UNTANGLING THE WEB
CLASS 6 – IBM BLUEMIX, A FEW JAVASCRIPT THINGS, MAPS
AGENDA
• IBM Bluemix
• Javascript concepts – variable scope, this pointer, events,
immediately invoked functions
• Mapping using Google Maps
• Some project work, if we have time
• Homework 7
IBM BLUEMIX
• This is one of the top 3 or 4 cloud platform providers
• AWS
• Azure
• Google Cloud Platform
• IBM Bluemix
• Provides servers, but lots of people do that
• Integrated services are the real key to why a platform is
valuable
Untangling - fall2017 - week6
Untangling - fall2017 - week6
Untangling - fall2017 - week6
CHATBOTS
• Goal is to respond to typed text
• We’ll see it in slack
• Eventually, we’ll talk about speech, etc. layered on top of
chatbots
• This first one will be a very simplistic bot
Untangling - fall2017 - week6
Untangling - fall2017 - week6
Untangling - fall2017 - week6
Untangling - fall2017 - week6
SOME JS CONCEPTS
VARIABLE SCOPE
• A reminder that variables are only accessible from within the block
they are declared, or children of that block:
• In a file, variables declared outside any functions are global to all the
functions in that file
• In a function, variables declared at the top of the function are accessible to
everywhere within that function
• In a for loop, variables declared within the loop are accessible ONLY within
the loop
• Any identically named variables will be taken from the closest block
• Don’t name the same or your more global variables will be hidden
STRICT MODE
• “use strict”; as the first line of a js file
• Mistakes become errors
• Global variables must be explicitly created
• Some other behaviors change
• See https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Strict_mode
THIS
• This keyword retrieves the current execution context
• Some difference in strict mode where it retrieves the context at the time of
the function call
• In non-strict mode, the global context is the default, in strict mode will be at
whatever it was previously defined to, or undefined
• This is the basis of understanding arrow functions (ES6 concept we’ll
explore later)
• Reference:
• https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Op
erators/this
NEW
• function Car(make, model, year) {
• this.make = make;
• this.model = model;
• this.year = year;
• }
• var mycar = new Car("Eagle", "Talon TSi", 1993);
• console.log(mycar.make);
EVENTS
• There are also events on the document object model, but we
won’t discuss that in depth today
• Events are called when something happens – a UI action, a
message, a timer, etc.
• google.maps.event.addListener
IMMEDIATELY INVOKED FUNCTION
EXPRESSIONS (IIFE)
• (function () {
• })();
• The first pair of parentheses (function(){...}) turns the code within (in this case, a
function) into an expression, and the second pair of parentheses (function(){...})()
calls the function that results from that evaluated expression.
• This pattern is often used when trying to avoid polluting the global namespace,
because all the variables used inside the IIFE (like in any other normal function)
are not visible outside its scope.
EXERCISES
• Create a web page in jsfiddle with a button on it
• Here is a fiddle with the bootstrap resources to start with:
https://jsfiddle.net/2adu8f3z/
• Using bootstrap, position the button in the centre of the page (at
the top)
• Hint: there is a center-block definition in bootstrap
• Make the text of the button red
• When you press that button make it invoke a function that raises an
alert
• When you press the button keep track of the number of times it has
been pressed and display that number in the alert
EXERCISE ANSWERS
• https://jsfiddle.net/L3wLvvnL/5/
MAPPING
• Two main options
• Google maps
• Leaflet
• Main decision is really whether to be in the google ecosphere
• Google maps may be slightly easier initially, but leaflet is easier
to extend
• Leaflet sits primarily on open street maps, so perhaps less
detail than google
GOOGLE MAPS EXAMPLE
• Getting an API key (will initially work without it, but some features disabled and will not
keep working)
• https://developers.google.com/maps/documentation/javascript/get-api-key
• https://jsfiddle.net/v892njbz/1/
• Key concepts
• Arrays (review)
• Looping (review)
• New objects
GOOGLE MAPS EXAMPLE 2
• New concepts
• Events
• https://jsfiddle.net/qswaLznm/5/
GOOGLE MAPS EXAMPLE 3
• New Concept
• Immediately Invoked Function Expression (IIFE)
• https://jsfiddle.net/v892njbz/
BITCOIN DISCUSSION (IF WE HAVE TIME)
• Who has used bitcoin? Knows about it?
• Perhaps watch the Singularity University video
HOMEWORK 6
• 1) create a web page that shows a map of the Uvic campus, using
your own google API key
• 2) on that campus map, create 3 markers.
• 3) when the marker is clicked on, launch a pop-up dialog that shows
the latitude and longitude of the marker, and a count of the number
of markers that have been shown so far
• Turn this in by oct 18th start of class, submitting your github
repository and a link to the page running on github pages.
PROJECT 2 – DUE START OF CLASS OCT
25TH
• Groups of 3-4 (no smaller than 2, no larger than 5)
• You will design and implement a website business
• This website must contain 3-4 html pages, a map (we’ll discuss
this next week), a database mockup (you’ll do the UI only in
this project, the database itself will be for project 3), and a
chatbot (also for project 3, but you’ll do the dialog design for
this project)
PROJECT 2 DELIVERABLES
• A business model canvas and value proposition canvas for your
website business
• 3-4 web pages, hosted on github pages, that are styled nicely in CSS
• A half-page discussion of which SEO factors your website exhibits
• A functional map on one of the pages, although it does not have to
be completely populated
• A presentation of between 3-5 minutes giving a walkthrough of the
website concept
• This project is worth 15% of your mark and all group members will
get the same mark. Switching groups between projects 2 and 3 is
discouraged but not impossible.

More Related Content

PPTX
Untangling - fall2017 - week5
Derek Jacoby
 
PPTX
Untangling the web - fall2017 - class 4
Derek Jacoby
 
PPTX
Untangling - fall2017 - week 7
Derek Jacoby
 
PPTX
Untangling spring week6
Derek Jacoby
 
PPTX
Untangling spring week2
Derek Jacoby
 
PPTX
Untangling the web week 2 - SEO
Derek Jacoby
 
PPTX
Untangling the web week1
Derek Jacoby
 
PPTX
Untangling spring week1
Derek Jacoby
 
Untangling - fall2017 - week5
Derek Jacoby
 
Untangling the web - fall2017 - class 4
Derek Jacoby
 
Untangling - fall2017 - week 7
Derek Jacoby
 
Untangling spring week6
Derek Jacoby
 
Untangling spring week2
Derek Jacoby
 
Untangling the web week 2 - SEO
Derek Jacoby
 
Untangling the web week1
Derek Jacoby
 
Untangling spring week1
Derek Jacoby
 

What's hot (20)

PPTX
Untangling the web11
Derek Jacoby
 
PPTX
Untangling spring week8
Derek Jacoby
 
PPTX
Untangling - fall2017 - week 8
Derek Jacoby
 
PPTX
Untangling spring week9
Derek Jacoby
 
PPTX
Untangling the web10
Derek Jacoby
 
PPTX
Untangling spring week3
Derek Jacoby
 
PPTX
Untangling7
Derek Jacoby
 
PPTX
Untangling the web - week 3
Derek Jacoby
 
PPTX
Untangling - fall2017 - week 9
Derek Jacoby
 
PPTX
Untangling6
Derek Jacoby
 
PPTX
5 things STILL! TOO! HARD! in Plone 5
Dylan Jay
 
PPTX
Untangling the web9
Derek Jacoby
 
PDF
Plone 5 theming
Victor De Alba
 
PPTX
Untangling - fall2017 - week 10
Derek Jacoby
 
PPTX
Untangling11
Derek Jacoby
 
PDF
Last Call Media Drupal 8 Case Study
Design for Drupal, Boston
 
PDF
Migrate PHP E-Commerce Site to Go
Weng Wei
 
PPTX
Working local
Melody Sharp Web Design
 
PDF
The New Design Workflow
Phase2
 
PDF
Fast Web Applications with Go
Eylem Ozekin
 
Untangling the web11
Derek Jacoby
 
Untangling spring week8
Derek Jacoby
 
Untangling - fall2017 - week 8
Derek Jacoby
 
Untangling spring week9
Derek Jacoby
 
Untangling the web10
Derek Jacoby
 
Untangling spring week3
Derek Jacoby
 
Untangling7
Derek Jacoby
 
Untangling the web - week 3
Derek Jacoby
 
Untangling - fall2017 - week 9
Derek Jacoby
 
Untangling6
Derek Jacoby
 
5 things STILL! TOO! HARD! in Plone 5
Dylan Jay
 
Untangling the web9
Derek Jacoby
 
Plone 5 theming
Victor De Alba
 
Untangling - fall2017 - week 10
Derek Jacoby
 
Untangling11
Derek Jacoby
 
Last Call Media Drupal 8 Case Study
Design for Drupal, Boston
 
Migrate PHP E-Commerce Site to Go
Weng Wei
 
The New Design Workflow
Phase2
 
Fast Web Applications with Go
Eylem Ozekin
 
Ad

Similar to Untangling - fall2017 - week6 (20)

PPTX
Untangling spring week5
Derek Jacoby
 
PPTX
Untangling spring week11
Derek Jacoby
 
PPT
ProjectFork 4.1 in Joomla! 3.x
Russell Searle
 
PPTX
Untangling fall2017 week2_try2
Derek Jacoby
 
PPTX
Untangling fall2017 week2
Derek Jacoby
 
PDF
Everything You Need to Know About the Top Changes in Drupal 8
Acquia
 
KEY
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
 
PPTX
Relay: Seamless Syncing for React (VanJS)
Brooklyn Zelenka
 
PDF
Desktop apps with node webkit
Paul Jensen
 
PPTX
Git Going w/ Git
heyMP
 
PPTX
All about that reactive ui
Paul van Zyl
 
PPTX
Plone FSR
fulv
 
ZIP
Using Features
Alexandru Badiu
 
PPTX
Automation in Drupal
Bozhidar Boshnakov
 
PPTX
React.js at Cortex
Geoff Harcourt
 
PPTX
Python and GIS: Improving Your Workflow
John Reiser
 
PPTX
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
AppDynamics
 
PPTX
DevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
DevOpsGroup
 
PDF
Stackato v6
Jonas Brømsø
 
PDF
Future of Grails
Daniel Woods
 
Untangling spring week5
Derek Jacoby
 
Untangling spring week11
Derek Jacoby
 
ProjectFork 4.1 in Joomla! 3.x
Russell Searle
 
Untangling fall2017 week2_try2
Derek Jacoby
 
Untangling fall2017 week2
Derek Jacoby
 
Everything You Need to Know About the Top Changes in Drupal 8
Acquia
 
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
 
Relay: Seamless Syncing for React (VanJS)
Brooklyn Zelenka
 
Desktop apps with node webkit
Paul Jensen
 
Git Going w/ Git
heyMP
 
All about that reactive ui
Paul van Zyl
 
Plone FSR
fulv
 
Using Features
Alexandru Badiu
 
Automation in Drupal
Bozhidar Boshnakov
 
React.js at Cortex
Geoff Harcourt
 
Python and GIS: Improving Your Workflow
John Reiser
 
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
AppDynamics
 
DevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
DevOpsGroup
 
Stackato v6
Jonas Brømsø
 
Future of Grails
Daniel Woods
 
Ad

More from Derek Jacoby (8)

PPTX
Untangling the web fall2017 class 3
Derek Jacoby
 
PPTX
Untangling fall2017 week1
Derek Jacoby
 
PPTX
Untangling spring week12
Derek Jacoby
 
PPTX
Untangling spring week10
Derek Jacoby
 
PPTX
Untangling spring week7
Derek Jacoby
 
PPTX
Untangling spring week4
Derek Jacoby
 
PPTX
Untangling8
Derek Jacoby
 
PPTX
Untangling4
Derek Jacoby
 
Untangling the web fall2017 class 3
Derek Jacoby
 
Untangling fall2017 week1
Derek Jacoby
 
Untangling spring week12
Derek Jacoby
 
Untangling spring week10
Derek Jacoby
 
Untangling spring week7
Derek Jacoby
 
Untangling spring week4
Derek Jacoby
 
Untangling8
Derek Jacoby
 
Untangling4
Derek Jacoby
 

Recently uploaded (20)

DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
PPTX
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
PPTX
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Virus sequence retrieval from NCBI database
yamunaK13
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
CDH. pptx
AneetaSharma15
 
Gupta Art & Architecture Temple and Sculptures.pptx
Virag Sontakke
 
Five Point Someone – Chetan Bhagat | Book Summary & Analysis by Bhupesh Kushwaha
Bhupesh Kushwaha
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
Basics and rules of probability with real-life uses
ravatkaran694
 
Measures_of_location_-_Averages_and__percentiles_by_DR SURYA K.pptx
Surya Ganesh
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 

Untangling - fall2017 - week6

  • 1. UNTANGLING THE WEB CLASS 6 – IBM BLUEMIX, A FEW JAVASCRIPT THINGS, MAPS
  • 2. AGENDA • IBM Bluemix • Javascript concepts – variable scope, this pointer, events, immediately invoked functions • Mapping using Google Maps • Some project work, if we have time • Homework 7
  • 3. IBM BLUEMIX • This is one of the top 3 or 4 cloud platform providers • AWS • Azure • Google Cloud Platform • IBM Bluemix • Provides servers, but lots of people do that • Integrated services are the real key to why a platform is valuable
  • 7. CHATBOTS • Goal is to respond to typed text • We’ll see it in slack • Eventually, we’ll talk about speech, etc. layered on top of chatbots • This first one will be a very simplistic bot
  • 13. VARIABLE SCOPE • A reminder that variables are only accessible from within the block they are declared, or children of that block: • In a file, variables declared outside any functions are global to all the functions in that file • In a function, variables declared at the top of the function are accessible to everywhere within that function • In a for loop, variables declared within the loop are accessible ONLY within the loop • Any identically named variables will be taken from the closest block • Don’t name the same or your more global variables will be hidden
  • 14. STRICT MODE • “use strict”; as the first line of a js file • Mistakes become errors • Global variables must be explicitly created • Some other behaviors change • See https://developer.mozilla.org/en- US/docs/Web/JavaScript/Reference/Strict_mode
  • 15. THIS • This keyword retrieves the current execution context • Some difference in strict mode where it retrieves the context at the time of the function call • In non-strict mode, the global context is the default, in strict mode will be at whatever it was previously defined to, or undefined • This is the basis of understanding arrow functions (ES6 concept we’ll explore later) • Reference: • https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Op erators/this
  • 16. NEW • function Car(make, model, year) { • this.make = make; • this.model = model; • this.year = year; • } • var mycar = new Car("Eagle", "Talon TSi", 1993); • console.log(mycar.make);
  • 17. EVENTS • There are also events on the document object model, but we won’t discuss that in depth today • Events are called when something happens – a UI action, a message, a timer, etc. • google.maps.event.addListener
  • 18. IMMEDIATELY INVOKED FUNCTION EXPRESSIONS (IIFE) • (function () { • })(); • The first pair of parentheses (function(){...}) turns the code within (in this case, a function) into an expression, and the second pair of parentheses (function(){...})() calls the function that results from that evaluated expression. • This pattern is often used when trying to avoid polluting the global namespace, because all the variables used inside the IIFE (like in any other normal function) are not visible outside its scope.
  • 19. EXERCISES • Create a web page in jsfiddle with a button on it • Here is a fiddle with the bootstrap resources to start with: https://jsfiddle.net/2adu8f3z/ • Using bootstrap, position the button in the centre of the page (at the top) • Hint: there is a center-block definition in bootstrap • Make the text of the button red • When you press that button make it invoke a function that raises an alert • When you press the button keep track of the number of times it has been pressed and display that number in the alert
  • 21. MAPPING • Two main options • Google maps • Leaflet • Main decision is really whether to be in the google ecosphere • Google maps may be slightly easier initially, but leaflet is easier to extend • Leaflet sits primarily on open street maps, so perhaps less detail than google
  • 22. GOOGLE MAPS EXAMPLE • Getting an API key (will initially work without it, but some features disabled and will not keep working) • https://developers.google.com/maps/documentation/javascript/get-api-key • https://jsfiddle.net/v892njbz/1/ • Key concepts • Arrays (review) • Looping (review) • New objects
  • 23. GOOGLE MAPS EXAMPLE 2 • New concepts • Events • https://jsfiddle.net/qswaLznm/5/
  • 24. GOOGLE MAPS EXAMPLE 3 • New Concept • Immediately Invoked Function Expression (IIFE) • https://jsfiddle.net/v892njbz/
  • 25. BITCOIN DISCUSSION (IF WE HAVE TIME) • Who has used bitcoin? Knows about it? • Perhaps watch the Singularity University video
  • 26. HOMEWORK 6 • 1) create a web page that shows a map of the Uvic campus, using your own google API key • 2) on that campus map, create 3 markers. • 3) when the marker is clicked on, launch a pop-up dialog that shows the latitude and longitude of the marker, and a count of the number of markers that have been shown so far • Turn this in by oct 18th start of class, submitting your github repository and a link to the page running on github pages.
  • 27. PROJECT 2 – DUE START OF CLASS OCT 25TH • Groups of 3-4 (no smaller than 2, no larger than 5) • You will design and implement a website business • This website must contain 3-4 html pages, a map (we’ll discuss this next week), a database mockup (you’ll do the UI only in this project, the database itself will be for project 3), and a chatbot (also for project 3, but you’ll do the dialog design for this project)
  • 28. PROJECT 2 DELIVERABLES • A business model canvas and value proposition canvas for your website business • 3-4 web pages, hosted on github pages, that are styled nicely in CSS • A half-page discussion of which SEO factors your website exhibits • A functional map on one of the pages, although it does not have to be completely populated • A presentation of between 3-5 minutes giving a walkthrough of the website concept • This project is worth 15% of your mark and all group members will get the same mark. Switching groups between projects 2 and 3 is discouraged but not impossible.