SlideShare a Scribd company logo
1 of 26
UNTANGLING THE WEB
CLASS 10 – DATABASES AND SERVERS
AGENDA
 Homework and project 2 status
 Project 3 discussion
 Javascript on the client and server
 IBM Bluemix demo
 Callbacks
 Databases
 SQL vs. noSQL
 Local databases vs. database services
 Homework 8
 Extra homework
HOMEWORKS
 Most of you are doing OK, some are still not turning things in though
 2 homeworks left
 If you’ll count, you’ll see that makes 9 homeworks rather than the 11 on the syllabus
 So the original goal of 5% per homework doesn’t work out anymore
 Will average for the two missing homeworks
 If you would prefer to do an additional homework instead of using the average, one is provided at the
end of this week’s slides (it will be worth 10% to replace both missing homeworks if you choose to do it)
PROJECT 2 FEEDBACK
 Only got a couple groups handing in their sketches. This is worrisome.
 The goal was to have a chance for some feedback on which portions of the front end are expected to be
implemented.
 I expect at least one working page, styled and functional. This does not mean that the entire page must
be functional, but enough to script a demo to make it appear to be working is needed.
 This at a minimum means that there must be a place to enter data and view results which actually works.
PROJECT 3 DETAILS
 Along with the front end in project 2, the project 3 back-end is also due in a couple weeks.
 This can be a minimal back end, for instance one or more of the following:
 A database of items
 An authentication system
 Set up a server to host your website
PROJECT 2 AND 3 GRADING
 30% total
 Presentation 5%
 Site design and styling 5%
 Front-end functionality 10%
 Back-end functionality 10%
 So by showing a mockup you can get half marks pretty easily, but full marks will require a working site
 You do not need to use anything we have not covered in class, but you are welcome to
THE ALMOST-SERVERLESS DESIGN
 I had intended to require the site be hosted somewhere permanent (ie. not jsfiddle or repl.it)
 This is still the ideal, but if you host your database somewhere like mlab or firebase and choose to use a
playground site to host that is only going to cost you a few points
 If you host on github pages with a database backend, and do it well, you can achieve full marks
 Of course, hosting on Bluemix or Digital Ocean or one of the other hosts mentioned in class is better
JAVASCRIPT ON THE SERVER
 JS used to be only a client language
 Node.js changes this
 On the server, javascript can do more than on the client but can still manipulate the DOM when needed
 This is something that cannot be done on the jsfiddle and repl.it type of sites because it requires a server
 We will go through an example on IBM Bluemix
BACK TO THE COMMAND LINE AND GITHUB
 This next section is essentially optional for the course, but useful if you want to develop efficiently
 Back in class 4 we failed spectacularly with many of you in configuring this and I did not enforce learning
the command line
 When doing server deployments it really is necessary, though
CLOUD FOUNDRY
 IBM Bluemix is an example of a Platform as a Service, or PaaS
 It is based on cloud foundry, which is a set of tools that make deployment easier
 Heroku is another example of a managed PaaS hosting site
 This saves a lot of administrative hassle over building a host of your own on a virtual private server, but
is more expensive (once you exceed the free-tier)
 Install the cloud foundry command line tools from https://github.com/cloudfoundry/cli/releases
GIT BASH
 This is what we installed back in class 4, it should still be on your system I hope
 If you did not get it installed, or have removed it, then just watch for the next bit
 (but for future reference see the class 4 slides, or for windows install from here: https://git-
scm.com/download/win
 And for mac from a terminal by executing “brew install git”)
MAKE SURE CLOUD FOUNDRY INSTALLED PROPERLY
 Open git bash
 Type “cf” and press enter and you should see a list of cloud foundry options
CLONE THE HELLO WORLD PROJECT
 Open a git bash window
 Navigate to the directory where you have been storing your class examples
 “git clone https://github.com/IBM-Bluemix/node-helloworld.git”
 You should see the files copied down from github into “node-helloworld”
INSTALL DEPENDENCIES
 Change directories into the newly populated directory (“cd node-helloworld”)
 Type “npm install”
 You should see a number of dependencies download into the node_modules subdirectory
RUN LOCALLY
 It’s important to be able to develop locally and then only push up to the remote site when you are ready
 Type “npm start” to run the development server
 You should see “> bluemix-hello-node@0.0.0 start C:Usersdereknode-helloworld
 > node server.js”
 Now point a browser to http://localhost:8080
 You should see “Hello World!” in the browser
SET UP CLOUD FOUNDRY
 First, tell it what service it is using, in this case bluemix, by typing “cf api https://api.ng.bluemix.net”
 It will tell you it is setting the endpoint and say OK
 Next, authenticate with the server. On Mac or Linux, you can type “cf login” and have it prompt you for
the username and password you set up on IBM Bluemix
 On Windows, there is a bug and instead use the “cf auth” command (“cf auth myusername
mypassword”)
 Now tell it what org and space you are developing for, by default this is your login email and “dev”, so
for me it is:
 “cf target –o derekja@gmail.com –s dev”
PUSHING TO THE CLOUD
 The namespace is supposed to ensure uniqueness, but the manifest.yml is actually what provides your URL.
Edit that. (for me, that is at the root of the project typing “code . &” which will open visual studio code on the
directory)
 Make the name and host something unique (for instance, I called it “hello-node-derekja”)
 Type “cf push” to push the project to your server
 You should see some files uploaded and then a notice that it is running
 Try opening it in a browser, for instance I open http://hello-node-derekja.mybluemix.net
 Congrats, you’ve deployed your first web server!
STOPPING, STARTING, AND DELETING
 At any time, you can stop your website by typing “cf stop APPNAME” and restart it with “cf start
APPNAME” (where APPNAME is the name in the manifest.yml you edited)
 “cf push” will push any new changes up
 When you are totally done with your site “cf delete APPNAME” and after confirming your app will be
deleted
 Your one month Bluemix account has no charges, though, so feel free to leave your sites running for the
free month
CALLBACKS
 Particularly in server-side code, most things happen asynchronously
 This means that it takes time for things to happen
 To get around this, you often declare code in such a way that you tell it what to do when some
information comes back
 There are various patterns in javascript to handle this: async/await and promises are two of the more
common
 But we’re going to start with callbacks and callback chaining
 More info http://javascriptissexy.com/understand-javascript-callback-functions-and-use-them/
CALLBACK DEMO
 https://jsfiddle.net/ez7bg2ua/
DATABASES
 SQL versus noSQL
 Flavours of SQL and noSQL
 Why use a database at all?
 Advanced database topics
 Schema design
 Replication
 Transactions
SQL VERSUS NOSQL
 SQL – Structured Query Language
 Relational database
 Use when you need multiple tables
and when you need to construct
queries that span those tables
 More functional than flat databases,
but also slower and more complex
 Can exist in either client or server
flavours
 NoSQL databases – anything that isn’t
relational!
 MongoDB is a popular server-based flavor
 Redis is a local memory-mapped flavor
 Cloudant, couchDB, etc. there are many,
many types
 All are good for rapid, flat table access
 Avoid the complexities of relational
databases while still preserving the benefits
LOCAL SQL EXAMPLE
 https://jsfiddle.net/m5rh3a83/1/
 (for more details see here: https://www.tutorialspoint.com/html5/html5_web_sql.htm)
FIREBASE EXAMPLE
 https://jsfiddle.net/gz74nds3/
 And look at the database configuration at firebase.io
HOMEWORK 8 – LOCAL CLIENT-SIDE DATABASE
 Take the cars webSQL example and modify it to hold place names and latitude/longitude points in a
local database
 As locations are added, add them to a google map on the page
 Bonus problem (+1 point):
 Center your map on the uvic campus
 Create a query which will make a list of locations within a tenth of a degree of the uvic campus in both latitude
and longitude
 Extra special bonus problem (+2 points):
 Instead of doing this by means of degrees, use meters, allowing the user to input how far they want the list to
populate from campus
 (NB. This is rather tricky and you’ll want to use the haversine formula: http://www.movable-
type.co.uk/scripts/latlong.html, or use the google maps APIs)
EXTRA HOMEWORK – USING IBM BLUEMIX
 This is entirely optional, due on the last day of class, so 2 weeks
 Can ask for help at next week’s class
 If completed it will be worth 10% of your grade, if not completed the average of your other homeworks
will be used for this 10%
 Move your pizza website onto IBM Bluemix
 Use a database to hold the toppings
 This can either be an mLab database or a bluemix database
 Hold the restaurant locations in the database as well
 Allow the user to enter new restaurant locations

More Related Content

What's hot

Untangling spring week8
Untangling spring week8Untangling spring week8
Untangling spring week8Derek Jacoby
 
Untangling spring week10
Untangling spring week10Untangling spring week10
Untangling spring week10Derek Jacoby
 
Untangling spring week9
Untangling spring week9Untangling spring week9
Untangling spring week9Derek Jacoby
 
Untangling spring week2
Untangling spring week2Untangling spring week2
Untangling spring week2Derek Jacoby
 
Untangling the web week1
Untangling the web week1Untangling the web week1
Untangling the web week1Derek Jacoby
 
Untangling spring week6
Untangling spring week6Untangling spring week6
Untangling spring week6Derek Jacoby
 
Untangling - fall2017 - week6
Untangling - fall2017 - week6Untangling - fall2017 - week6
Untangling - fall2017 - week6Derek Jacoby
 
Untangling - fall2017 - week5
Untangling - fall2017 - week5Untangling - fall2017 - week5
Untangling - fall2017 - week5Derek Jacoby
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGapBuilding mobile applications with DrupalGap
Building mobile applications with DrupalGapAlex S
 
Untangling the web week 2 - SEO
Untangling the web week 2 - SEOUntangling the web week 2 - SEO
Untangling the web week 2 - SEODerek Jacoby
 
Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToRaymond Camden
 
Javascript and jQuery PennApps Tech Talk, Fall 2014
Javascript and jQuery PennApps Tech Talk, Fall 2014Javascript and jQuery PennApps Tech Talk, Fall 2014
Javascript and jQuery PennApps Tech Talk, Fall 2014Kathy Zhou
 
Don't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web ApplicationsDon't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web ApplicationsStoyan Stefanov
 
Managing a Project the Drupal Way - Drupal Open Days Ireland
Managing a Project the Drupal Way - Drupal Open Days IrelandManaging a Project the Drupal Way - Drupal Open Days Ireland
Managing a Project the Drupal Way - Drupal Open Days IrelandEmma Jane Hogbin Westby
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Raymond Camden
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Edmund Turbin
 
WP-CLI For The Win
WP-CLI For The WinWP-CLI For The Win
WP-CLI For The WinMicah Wood
 
Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...Alex S
 

What's hot (20)

Untangling spring week8
Untangling spring week8Untangling spring week8
Untangling spring week8
 
Untangling spring week10
Untangling spring week10Untangling spring week10
Untangling spring week10
 
Untangling spring week9
Untangling spring week9Untangling spring week9
Untangling spring week9
 
Untangling spring week2
Untangling spring week2Untangling spring week2
Untangling spring week2
 
Untangling the web week1
Untangling the web week1Untangling the web week1
Untangling the web week1
 
Untangling spring week6
Untangling spring week6Untangling spring week6
Untangling spring week6
 
Untangling - fall2017 - week6
Untangling - fall2017 - week6Untangling - fall2017 - week6
Untangling - fall2017 - week6
 
Untangling - fall2017 - week5
Untangling - fall2017 - week5Untangling - fall2017 - week5
Untangling - fall2017 - week5
 
Building mobile applications with DrupalGap
Building mobile applications with DrupalGapBuilding mobile applications with DrupalGap
Building mobile applications with DrupalGap
 
Untangling the web week 2 - SEO
Untangling the web week 2 - SEOUntangling the web week 2 - SEO
Untangling the web week 2 - SEO
 
Building a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared ToBuilding a PWA - For Everyone Who Is Scared To
Building a PWA - For Everyone Who Is Scared To
 
SocketStream
SocketStreamSocketStream
SocketStream
 
Javascript and jQuery PennApps Tech Talk, Fall 2014
Javascript and jQuery PennApps Tech Talk, Fall 2014Javascript and jQuery PennApps Tech Talk, Fall 2014
Javascript and jQuery PennApps Tech Talk, Fall 2014
 
Don't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web ApplicationsDon't make me wait! or Building High-Performance Web Applications
Don't make me wait! or Building High-Performance Web Applications
 
Managing a Project the Drupal Way - Drupal Open Days Ireland
Managing a Project the Drupal Way - Drupal Open Days IrelandManaging a Project the Drupal Way - Drupal Open Days Ireland
Managing a Project the Drupal Way - Drupal Open Days Ireland
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
 
Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?Theming in WordPress - Where do I Start?
Theming in WordPress - Where do I Start?
 
WP-CLI For The Win
WP-CLI For The WinWP-CLI For The Win
WP-CLI For The Win
 
Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...Build your application in seconds and optimize workflow as much as you can us...
Build your application in seconds and optimize workflow as much as you can us...
 
learning react
learning reactlearning react
learning react
 

Viewers also liked

Untangling spring week3
Untangling spring week3Untangling spring week3
Untangling spring week3Derek Jacoby
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4Derek Jacoby
 
Untangling the web - week 3
Untangling the web - week 3Untangling the web - week 3
Untangling the web - week 3Derek Jacoby
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5Derek Jacoby
 
Beyond the Gig Economy
Beyond the Gig EconomyBeyond the Gig Economy
Beyond the Gig EconomyJon Lieber
 
Recovery: Job Growth and Education Requirements Through 2020
Recovery: Job Growth and Education Requirements Through 2020Recovery: Job Growth and Education Requirements Through 2020
Recovery: Job Growth and Education Requirements Through 2020CEW Georgetown
 
3 hard facts shaping higher education thinking and behavior
3 hard facts shaping higher education thinking and behavior3 hard facts shaping higher education thinking and behavior
3 hard facts shaping higher education thinking and behaviorGrant Thornton LLP
 
African Americans: College Majors and Earnings
African Americans: College Majors and Earnings African Americans: College Majors and Earnings
African Americans: College Majors and Earnings CEW Georgetown
 
The Online College Labor Market
The Online College Labor MarketThe Online College Labor Market
The Online College Labor MarketCEW Georgetown
 
Game Based Learning for Language Learners
Game Based Learning for Language LearnersGame Based Learning for Language Learners
Game Based Learning for Language LearnersShelly Sanchez Terrell
 
What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?Skillsoft
 
SXSW 2016 takeaways
SXSW 2016 takeawaysSXSW 2016 takeaways
SXSW 2016 takeawaysHavas
 

Viewers also liked (13)

Untangling spring week3
Untangling spring week3Untangling spring week3
Untangling spring week3
 
Untangling spring week4
Untangling spring week4Untangling spring week4
Untangling spring week4
 
Untangling the web - week 3
Untangling the web - week 3Untangling the web - week 3
Untangling the web - week 3
 
Untangling spring week5
Untangling spring week5Untangling spring week5
Untangling spring week5
 
Biohacking
BiohackingBiohacking
Biohacking
 
Beyond the Gig Economy
Beyond the Gig EconomyBeyond the Gig Economy
Beyond the Gig Economy
 
Recovery: Job Growth and Education Requirements Through 2020
Recovery: Job Growth and Education Requirements Through 2020Recovery: Job Growth and Education Requirements Through 2020
Recovery: Job Growth and Education Requirements Through 2020
 
3 hard facts shaping higher education thinking and behavior
3 hard facts shaping higher education thinking and behavior3 hard facts shaping higher education thinking and behavior
3 hard facts shaping higher education thinking and behavior
 
African Americans: College Majors and Earnings
African Americans: College Majors and Earnings African Americans: College Majors and Earnings
African Americans: College Majors and Earnings
 
The Online College Labor Market
The Online College Labor MarketThe Online College Labor Market
The Online College Labor Market
 
Game Based Learning for Language Learners
Game Based Learning for Language LearnersGame Based Learning for Language Learners
Game Based Learning for Language Learners
 
What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?What's Trending in Talent and Learning for 2016?
What's Trending in Talent and Learning for 2016?
 
SXSW 2016 takeaways
SXSW 2016 takeawaysSXSW 2016 takeaways
SXSW 2016 takeaways
 

Similar to Databases and Servers Class - SQL vs NoSQL, Local vs Cloud, Callbacks

Serverless and Kubernetes Workshop on IBM Cloud
Serverless and Kubernetes Workshop on IBM CloudServerless and Kubernetes Workshop on IBM Cloud
Serverless and Kubernetes Workshop on IBM CloudAnsgar Schmidt
 
Using Docker in the Real World
Using Docker in the Real WorldUsing Docker in the Real World
Using Docker in the Real WorldTim Haak
 
Technology tips to ceo & architect
Technology tips to ceo & architectTechnology tips to ceo & architect
Technology tips to ceo & architectAnandkumar R
 
Cloud and Ubiquitous Computing manual
Cloud and Ubiquitous Computing manual Cloud and Ubiquitous Computing manual
Cloud and Ubiquitous Computing manual Sonali Parab
 
Web Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationWeb Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationSupanat Potiwarakorn
 
Why you should consider a microframework for your next web project
Why you should consider a microframework for your next web projectWhy you should consider a microframework for your next web project
Why you should consider a microframework for your next web projectJoaquín Muñoz M.
 
SpringOne Tour St. Louis - Serverless Spring
SpringOne Tour St. Louis - Serverless SpringSpringOne Tour St. Louis - Serverless Spring
SpringOne Tour St. Louis - Serverless SpringVMware Tanzu
 
EdTechJoker Spring 2020 - Lecture 5 grav cms
EdTechJoker Spring 2020 - Lecture 5 grav cmsEdTechJoker Spring 2020 - Lecture 5 grav cms
EdTechJoker Spring 2020 - Lecture 5 grav cmsBryan Ollendyke
 
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Richard Cole of Amazon Gives Lightning Tallk at BigDataCampRichard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Richard Cole of Amazon Gives Lightning Tallk at BigDataCampBigDataCamp
 
Serverless meetup Auckland #6
Serverless meetup Auckland #6Serverless meetup Auckland #6
Serverless meetup Auckland #6Myles Henaghan
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthPhilip Norton
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroSteven Pignataro
 
15 ways-to-optimize-spring-boot-for-the-cloud
15 ways-to-optimize-spring-boot-for-the-cloud15 ways-to-optimize-spring-boot-for-the-cloud
15 ways-to-optimize-spring-boot-for-the-cloudPolyglotMeetups
 
Windows Azure & How to Deploy Wordress
Windows Azure & How to Deploy WordressWindows Azure & How to Deploy Wordress
Windows Azure & How to Deploy WordressGeorge Kanellopoulos
 
A Developer Day 2014 - Durban
A Developer Day 2014 - Durban A Developer Day 2014 - Durban
A Developer Day 2014 - Durban Robert MacLean
 
Slideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You QueueSlideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You Queue10n Software, LLC
 
Magento Performance Optimization 101
Magento Performance Optimization 101Magento Performance Optimization 101
Magento Performance Optimization 101Angus Li
 
Drupal 7 Web Services Crash Course
Drupal 7 Web Services Crash CourseDrupal 7 Web Services Crash Course
Drupal 7 Web Services Crash CourseNoah Lively
 
Into The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sInto The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sOrtus Solutions, Corp
 
Optimize the obvious
Optimize the obviousOptimize the obvious
Optimize the obviousdrhenner
 

Similar to Databases and Servers Class - SQL vs NoSQL, Local vs Cloud, Callbacks (20)

Serverless and Kubernetes Workshop on IBM Cloud
Serverless and Kubernetes Workshop on IBM CloudServerless and Kubernetes Workshop on IBM Cloud
Serverless and Kubernetes Workshop on IBM Cloud
 
Using Docker in the Real World
Using Docker in the Real WorldUsing Docker in the Real World
Using Docker in the Real World
 
Technology tips to ceo & architect
Technology tips to ceo & architectTechnology tips to ceo & architect
Technology tips to ceo & architect
 
Cloud and Ubiquitous Computing manual
Cloud and Ubiquitous Computing manual Cloud and Ubiquitous Computing manual
Cloud and Ubiquitous Computing manual
 
Web Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationWeb Development Foundation & Team Collaboration
Web Development Foundation & Team Collaboration
 
Why you should consider a microframework for your next web project
Why you should consider a microframework for your next web projectWhy you should consider a microframework for your next web project
Why you should consider a microframework for your next web project
 
SpringOne Tour St. Louis - Serverless Spring
SpringOne Tour St. Louis - Serverless SpringSpringOne Tour St. Louis - Serverless Spring
SpringOne Tour St. Louis - Serverless Spring
 
EdTechJoker Spring 2020 - Lecture 5 grav cms
EdTechJoker Spring 2020 - Lecture 5 grav cmsEdTechJoker Spring 2020 - Lecture 5 grav cms
EdTechJoker Spring 2020 - Lecture 5 grav cms
 
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Richard Cole of Amazon Gives Lightning Tallk at BigDataCampRichard Cole of Amazon Gives Lightning Tallk at BigDataCamp
Richard Cole of Amazon Gives Lightning Tallk at BigDataCamp
 
Serverless meetup Auckland #6
Serverless meetup Auckland #6Serverless meetup Auckland #6
Serverless meetup Auckland #6
 
Drupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp NorthDrupal Performance : DrupalCamp North
Drupal Performance : DrupalCamp North
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
 
15 ways-to-optimize-spring-boot-for-the-cloud
15 ways-to-optimize-spring-boot-for-the-cloud15 ways-to-optimize-spring-boot-for-the-cloud
15 ways-to-optimize-spring-boot-for-the-cloud
 
Windows Azure & How to Deploy Wordress
Windows Azure & How to Deploy WordressWindows Azure & How to Deploy Wordress
Windows Azure & How to Deploy Wordress
 
A Developer Day 2014 - Durban
A Developer Day 2014 - Durban A Developer Day 2014 - Durban
A Developer Day 2014 - Durban
 
Slideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You QueueSlideshare - Magento Imagine - Do You Queue
Slideshare - Magento Imagine - Do You Queue
 
Magento Performance Optimization 101
Magento Performance Optimization 101Magento Performance Optimization 101
Magento Performance Optimization 101
 
Drupal 7 Web Services Crash Course
Drupal 7 Web Services Crash CourseDrupal 7 Web Services Crash Course
Drupal 7 Web Services Crash Course
 
Into The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sInto The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api's
 
Optimize the obvious
Optimize the obviousOptimize the obvious
Optimize the obvious
 

More from Derek Jacoby

Untangling - fall2017 - week 10
Untangling - fall2017 - week 10Untangling - fall2017 - week 10
Untangling - fall2017 - week 10Derek Jacoby
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 
Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Derek Jacoby
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Derek Jacoby
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Derek Jacoby
 
Untangling the web fall2017 class 3
Untangling the web fall2017 class 3Untangling the web fall2017 class 3
Untangling the web fall2017 class 3Derek Jacoby
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Derek Jacoby
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2Derek Jacoby
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1Derek Jacoby
 
Untangling spring week12
Untangling spring week12Untangling spring week12
Untangling spring week12Derek Jacoby
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11Derek Jacoby
 

More from Derek Jacoby (12)

Untangling11
Untangling11Untangling11
Untangling11
 
Untangling - fall2017 - week 10
Untangling - fall2017 - week 10Untangling - fall2017 - week 10
Untangling - fall2017 - week 10
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
Untangling - fall2017 - week 8
Untangling - fall2017 - week 8Untangling - fall2017 - week 8
Untangling - fall2017 - week 8
 
Untangling - fall2017 - week 7
Untangling - fall2017 - week 7Untangling - fall2017 - week 7
Untangling - fall2017 - week 7
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4
 
Untangling the web fall2017 class 3
Untangling the web fall2017 class 3Untangling the web fall2017 class 3
Untangling the web fall2017 class 3
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling fall2017 week1
Untangling fall2017 week1Untangling fall2017 week1
Untangling fall2017 week1
 
Untangling spring week12
Untangling spring week12Untangling spring week12
Untangling spring week12
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
 

Recently uploaded

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 

Recently uploaded (20)

Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 

Databases and Servers Class - SQL vs NoSQL, Local vs Cloud, Callbacks

  • 1. UNTANGLING THE WEB CLASS 10 – DATABASES AND SERVERS
  • 2. AGENDA  Homework and project 2 status  Project 3 discussion  Javascript on the client and server  IBM Bluemix demo  Callbacks  Databases  SQL vs. noSQL  Local databases vs. database services  Homework 8  Extra homework
  • 3. HOMEWORKS  Most of you are doing OK, some are still not turning things in though  2 homeworks left  If you’ll count, you’ll see that makes 9 homeworks rather than the 11 on the syllabus  So the original goal of 5% per homework doesn’t work out anymore  Will average for the two missing homeworks  If you would prefer to do an additional homework instead of using the average, one is provided at the end of this week’s slides (it will be worth 10% to replace both missing homeworks if you choose to do it)
  • 4. PROJECT 2 FEEDBACK  Only got a couple groups handing in their sketches. This is worrisome.  The goal was to have a chance for some feedback on which portions of the front end are expected to be implemented.  I expect at least one working page, styled and functional. This does not mean that the entire page must be functional, but enough to script a demo to make it appear to be working is needed.  This at a minimum means that there must be a place to enter data and view results which actually works.
  • 5. PROJECT 3 DETAILS  Along with the front end in project 2, the project 3 back-end is also due in a couple weeks.  This can be a minimal back end, for instance one or more of the following:  A database of items  An authentication system  Set up a server to host your website
  • 6. PROJECT 2 AND 3 GRADING  30% total  Presentation 5%  Site design and styling 5%  Front-end functionality 10%  Back-end functionality 10%  So by showing a mockup you can get half marks pretty easily, but full marks will require a working site  You do not need to use anything we have not covered in class, but you are welcome to
  • 7. THE ALMOST-SERVERLESS DESIGN  I had intended to require the site be hosted somewhere permanent (ie. not jsfiddle or repl.it)  This is still the ideal, but if you host your database somewhere like mlab or firebase and choose to use a playground site to host that is only going to cost you a few points  If you host on github pages with a database backend, and do it well, you can achieve full marks  Of course, hosting on Bluemix or Digital Ocean or one of the other hosts mentioned in class is better
  • 8. JAVASCRIPT ON THE SERVER  JS used to be only a client language  Node.js changes this  On the server, javascript can do more than on the client but can still manipulate the DOM when needed  This is something that cannot be done on the jsfiddle and repl.it type of sites because it requires a server  We will go through an example on IBM Bluemix
  • 9. BACK TO THE COMMAND LINE AND GITHUB  This next section is essentially optional for the course, but useful if you want to develop efficiently  Back in class 4 we failed spectacularly with many of you in configuring this and I did not enforce learning the command line  When doing server deployments it really is necessary, though
  • 10. CLOUD FOUNDRY  IBM Bluemix is an example of a Platform as a Service, or PaaS  It is based on cloud foundry, which is a set of tools that make deployment easier  Heroku is another example of a managed PaaS hosting site  This saves a lot of administrative hassle over building a host of your own on a virtual private server, but is more expensive (once you exceed the free-tier)  Install the cloud foundry command line tools from https://github.com/cloudfoundry/cli/releases
  • 11. GIT BASH  This is what we installed back in class 4, it should still be on your system I hope  If you did not get it installed, or have removed it, then just watch for the next bit  (but for future reference see the class 4 slides, or for windows install from here: https://git- scm.com/download/win  And for mac from a terminal by executing “brew install git”)
  • 12. MAKE SURE CLOUD FOUNDRY INSTALLED PROPERLY  Open git bash  Type “cf” and press enter and you should see a list of cloud foundry options
  • 13. CLONE THE HELLO WORLD PROJECT  Open a git bash window  Navigate to the directory where you have been storing your class examples  “git clone https://github.com/IBM-Bluemix/node-helloworld.git”  You should see the files copied down from github into “node-helloworld”
  • 14. INSTALL DEPENDENCIES  Change directories into the newly populated directory (“cd node-helloworld”)  Type “npm install”  You should see a number of dependencies download into the node_modules subdirectory
  • 15. RUN LOCALLY  It’s important to be able to develop locally and then only push up to the remote site when you are ready  Type “npm start” to run the development server  You should see “> bluemix-hello-node@0.0.0 start C:Usersdereknode-helloworld  > node server.js”  Now point a browser to http://localhost:8080  You should see “Hello World!” in the browser
  • 16. SET UP CLOUD FOUNDRY  First, tell it what service it is using, in this case bluemix, by typing “cf api https://api.ng.bluemix.net”  It will tell you it is setting the endpoint and say OK  Next, authenticate with the server. On Mac or Linux, you can type “cf login” and have it prompt you for the username and password you set up on IBM Bluemix  On Windows, there is a bug and instead use the “cf auth” command (“cf auth myusername mypassword”)  Now tell it what org and space you are developing for, by default this is your login email and “dev”, so for me it is:  “cf target –o derekja@gmail.com –s dev”
  • 17. PUSHING TO THE CLOUD  The namespace is supposed to ensure uniqueness, but the manifest.yml is actually what provides your URL. Edit that. (for me, that is at the root of the project typing “code . &” which will open visual studio code on the directory)  Make the name and host something unique (for instance, I called it “hello-node-derekja”)  Type “cf push” to push the project to your server  You should see some files uploaded and then a notice that it is running  Try opening it in a browser, for instance I open http://hello-node-derekja.mybluemix.net  Congrats, you’ve deployed your first web server!
  • 18. STOPPING, STARTING, AND DELETING  At any time, you can stop your website by typing “cf stop APPNAME” and restart it with “cf start APPNAME” (where APPNAME is the name in the manifest.yml you edited)  “cf push” will push any new changes up  When you are totally done with your site “cf delete APPNAME” and after confirming your app will be deleted  Your one month Bluemix account has no charges, though, so feel free to leave your sites running for the free month
  • 19. CALLBACKS  Particularly in server-side code, most things happen asynchronously  This means that it takes time for things to happen  To get around this, you often declare code in such a way that you tell it what to do when some information comes back  There are various patterns in javascript to handle this: async/await and promises are two of the more common  But we’re going to start with callbacks and callback chaining  More info http://javascriptissexy.com/understand-javascript-callback-functions-and-use-them/
  • 21. DATABASES  SQL versus noSQL  Flavours of SQL and noSQL  Why use a database at all?  Advanced database topics  Schema design  Replication  Transactions
  • 22. SQL VERSUS NOSQL  SQL – Structured Query Language  Relational database  Use when you need multiple tables and when you need to construct queries that span those tables  More functional than flat databases, but also slower and more complex  Can exist in either client or server flavours  NoSQL databases – anything that isn’t relational!  MongoDB is a popular server-based flavor  Redis is a local memory-mapped flavor  Cloudant, couchDB, etc. there are many, many types  All are good for rapid, flat table access  Avoid the complexities of relational databases while still preserving the benefits
  • 23. LOCAL SQL EXAMPLE  https://jsfiddle.net/m5rh3a83/1/  (for more details see here: https://www.tutorialspoint.com/html5/html5_web_sql.htm)
  • 24. FIREBASE EXAMPLE  https://jsfiddle.net/gz74nds3/  And look at the database configuration at firebase.io
  • 25. HOMEWORK 8 – LOCAL CLIENT-SIDE DATABASE  Take the cars webSQL example and modify it to hold place names and latitude/longitude points in a local database  As locations are added, add them to a google map on the page  Bonus problem (+1 point):  Center your map on the uvic campus  Create a query which will make a list of locations within a tenth of a degree of the uvic campus in both latitude and longitude  Extra special bonus problem (+2 points):  Instead of doing this by means of degrees, use meters, allowing the user to input how far they want the list to populate from campus  (NB. This is rather tricky and you’ll want to use the haversine formula: http://www.movable- type.co.uk/scripts/latlong.html, or use the google maps APIs)
  • 26. EXTRA HOMEWORK – USING IBM BLUEMIX  This is entirely optional, due on the last day of class, so 2 weeks  Can ask for help at next week’s class  If completed it will be worth 10% of your grade, if not completed the average of your other homeworks will be used for this 10%  Move your pizza website onto IBM Bluemix  Use a database to hold the toppings  This can either be an mLab database or a bluemix database  Hold the restaurant locations in the database as well  Allow the user to enter new restaurant locations