WebFund 2016W Lecture 19

From Soma-notes
Jump to navigation Jump to search

Video

The video from the lecture given on March 22, 2016 is now available.

Student Notes

OpenStack

  • There is no need to use the course VM to set up of connect to an instance
    • This is intended as a substitute for the VM
  • There are various options to get your web application on the instance:
    • WINSCP
    • wget [URL]
    • Others...
  • You can create multiple sessions to the same instance with SSH

Assignment 5

  • Extended until Sunday (March 27) at 11:55 pm
  • Extra functionality (2% bonus) will be at the TA’s discretion
  • If things are running slowly for you, try testing with files no larger than 1000 entries
  • If database has too many entries, drop them
    • To drop: db.logs.drop()
      • This is done from the Mongo terminal client
  • “Show” shows the entries in a scrollable textbox

MongoDB Storage

  • By default, documents in MongoDB can be up to 16 megabytes
  • For what we are doing, nothing should ever exceed this size since we are breaking files up into multiple documents
  • GridFS can be used to store larger documents
    • It will split these larger documents into chunks sized 255 kB each

Assignment 6

  • This will involve making assignment 5 into a single-page web appliction
  • Look at exam-storage to see an example of how to make a single-page application using client-side code

Tutorial 9

  • The base application analyzes text entered by the user and counts word frequencies to display in a graph
  • Division between client and server:
    • Server: dumb web server (one route to render index)
    • Client: everything (all the functionality, ie. interact.js)
  • In index.jade, we can see that some client-side scripts are linked and many of the HTML elements have IDs
    • These IDs are used in the client-side script to easily access the elements using jQuery
  • It is important to understand the control flow when clicking on the update button
    • The click event for the button causes a function to be called
    • In this function, the user-entered data is taken from the page using jQuery
    • Based on the settings specified by this data, words frequencies are counted and the graph is created
  • What does the map method do?
    • It processes each element of an array, passing that element in to a function
    • The return value of the function is put into a new array

Other Notes

  • If VM runs out of space, things may break
    • Be careful, clean up space
    • See the forums for a way to minimize the space MongoDB takes up

Code

In this lecture we discussed interactive-graphs, the code for Tutorial 9.