Fundamentals of Web Applications (Winter 2016)

From Soma-notes
Jump to: navigation, search

Course Outline

Here is the course outline.

Lectures and Exams



Jan. 7

Lecture 1

Jan. 12

Lecture 2

Jan. 14

Lecture 3

Jan. 19

Lecture 4

Jan. 21

Lecture 5

Jan. 26

Lecture 6

Jan. 28

Lecture 7

Feb. 2

Lecture 8

Feb. 4

Lecture 9

Feb. 9

Midterm Review

Feb. 11

Midterm (in class) Errata Solutions

Feb. 23

Lecture 11

Feb. 25

Lecture 12

Mar. 1

Lecture 13

Mar. 3

Lecture 14

Mar. 8

Lecture 15

Mar. 10

Lecture 16

Mar. 15

Lecture 17

Mar. 17

Lecture 18

Mar. 22

Lecture 19

Mar. 24

Lecture 20

Mar. 29

Lecture 21

Mar. 31

Lecture 22

Apr. 5

Lecture 23

April 7

Lecture 24

April 11, 10 AM-12 PM (SC 103)

Last-Minute Study Session

April 12, 9 AM

Final Exam


Each week you will get a progress grade from 0-4, given to you by a TA. If you are being diligent, you should be able to get 4's every week. The easiest way to get your grade is to come to tutorial and meet with your TA; alternately, you can meet a TA in their office hours or, at their discretion, discuss things with them online.



Jan. 13, 14, 15, 18

Asynchronous Code in JavaScript

Jan. 20, 21, 22, 25

Tiny web server

Jan. 27, 28, 29, Feb. 1

Express, Form demo

Feb. 3, 4, 5, 8

Exam forms

Feb. 24, 25, 26, 29

Storing logs in a database

Mar. 2, 3, 4, 7

Simple Visualization

Mar. 9, 10, 11, 14

Uploading Files

Mar. 16, 17, 18, 21


Mar. 23, 24, 28 & Apr. 1

Interactive Graphs

Mar. 30, 31, Apr. 4 (Optional)

Code on Final Exam


Due Date


Jan. 20

Assignment 1

Jan. 31 (extended)

Assignment 2

Feb. 9, 2:30 PM

Assignment 3

Mar. 3

Assignment 4

Mar. 27 (extended)

Assignment 5

Apr. 7

Assignment 6

Course Software

In this course we will be developing web applications using node.js and mongoDB. You are welcome to use whatever operating system and development tools you like; however, we will supporting the use of a course virtual machine appliance running Lubuntu, a low-resource variant of Ubuntu Linux distribution.

In the labs

In the SCS labs you should be able to run the course VM by starting Virtualbox (listed in the Applications menu) and selecting the COMP 2406 virtual machine image. After the VM has fully booted up you can login to the student account using the password "tneduts!". This account has administrative privileges; in addition, there is the admin account in case your student account gets corrupted for any reason. The password for it is "nimda!".

We highly recommend running your VM in full-screen mode (select from the menu, not by maximizing the window). Do all of your work inside of the VM; it should be fast enough and you won't have any issues with sharing files or with firewalls/network connectivity. Keep in mind that the browser is likely out of date and you should not log into any important services (e.g., Gmail) due to missing security patches.

You can save the work you do from the course VM (in the student account) to your SCS account and restore it to any other copy of the class VM (on your machines or in the labs) by running using the following commands:

 save2406 <SCS username>
 restore2406 <SCS username>
 compare2406 <SCS username>

If you use these commands, use them consistently. That means run restore2406 when you first log in, and run save2406 just before logging out. If you don't do this, you will erase the work that you had done previously when you save.

If you forgot to restore and you want to save, try running this:

  rsync -a -v --progress ~/ <SCS username>

This is the same as the save2406 command minus the options (--delete and --force) that deletes files in the destination that don't exist in the source. As a check, you may want to add the -n option to do a dry run.

Working directly off network drive (sshfs)

If you don't want to bother running save2406 and restore2406 all the time, you can optionally mount the network drive.

 sudo apt-get install sshfs # You may already have this package
 mkdir ~/network-drive/ # Pick any name you want.
 sshfs -o reconnect,transform_symlinks ~/network-drive/ <SCS username>

At this point, you should see all of your files in ~/network-drive/COMP2406/.

Note: There is no concept of "restore" or undo. If you delete or overwrite a file, it's gone.

Running the VM on your own machines

If you want to run the VM appliance on your own system (running essentially any desktop operating system you want), just download the virtual appliance file and import into VirtualBox or VMware Workstation/Fusion (free to Carleton SCS students). The SHA1 hash of this file is:

   97fc4de4544505178b580d27487085a20961e91e COMP 2406, Winter 2016.ova
   fcc25e934c629eda2e04b3345f13bb394b78e4e3 COMP 2406, Winter 2016-larger.ova

(The -larger image has a 50GB virtual disk rather than an 8GB one. Otherwise it is the same.) On Windows you can compute this hash for your downloaded file using the command <a href="">FCIV -sha1 COMP 2406 & 3000, Fall 2015.ova</a>. If the hash is different from above, your download has been corrupted.

If your virtualization platform is not VirtualBox, you'll need to:

  • Have the VM platform ignore any errors in the structure of the appliance found during the import process;
  • Uninstall the VirtualBox guest additions by typing starting a terminal application and running
  sudo /opt/VBoxGuestAdditions-*/
  • Install your platform's own Linux guest additions, if available.

Configuring Linux

If you already run Linux and you want to use the same packages we do in class, you should do the following:

  • Install the latest node.js version using a package manager. (You generally don't use the version that comes with your distribution, it is probably too old.)
  • Install mongoDB - it probably goes by mongodb in your package manager. The version doesn't matter too much.

Note that the binary of the node.js executable may be node, nodejs, or something similar.

That's it!

Configuring Windows

It is also possible to do everything in this class in native Windows. Here are some tips on getting things running.

Configuring Mac OS X

It is possible, and recommended, to configure Node and mongoDB to run on your Mac.

Homebrew method (recommended)

Homebrew is a package manager for OS X that works similarly to Linux-style package managers like apt. Homebrew provides access to thousands of Linux and BSD packages to install natively on your Mac. You have a perfectly capable UNIX system in front of you. Make good use of it!

  • Install Homebrew (copy the installation text on that page to
  • Install Node and mongoDB

Run the following commands in your terminal:

   brew update
   brew install node
   brew install mongo

That's it!

Manual method

Alternatively, you can download and install Node and mongo directly.


In general any text published by O'Reilly is worth your time. Many (but not all) of the texts below are published by them.


JavaScript: The Good Parts by Douglas Crockford is an excellent text on JavaScript and it is short. We highly suggest you obtain a copy and read it.

The easiest way to get started with JavaScript and get basic understanding of web technologies is to go through the interactive lessons on Code Academy. I suggest you go through their JavaScript, Web Fundamentals, and jQuery tracks. They shouldn't take you very long to do given that you already know how to program.

Crockford also has a lot of online resources on JavaScript, including videos of talks he's given that cover much of the content in his book. Look at his JavaScript page and this page of his videos.

Another good book is Eloquent JavaScript: A Modern Introduction to Programming by Marijn Haverbeke. A version of this book is available online for free. The for-sale version is apparently updated and edited.

The standard reference for JavaScript is JavaScript: The Definitive Guide by David Flanagan. It is a big book, but it is comprehensive.


Learning Node by Shelley Powers is the recommended resource for learning about Node.

Another introduction to node.js is The Node Beginner Book by Manuel Kiessling.

This page by Evan Hahn has a good overview of the express/connect/node software stack.


MongoDB: The Definitive Guide by Kristina Chodorow (1st or 2nd ed) is the recommended text for learning more about MongoDB.

Lecture Notes Guidelines

As specified in the course outline you can get up to 6% extra credit on your final grade (2% per time) for writing up notes from lecture. Here are the guidelines for those notes.

Lee Croft (LeeCroft at will be handling course notes. Please contact him if you would like to volunteer. Note that you should email him in advance and he will give you the next available slot. There are over 200 students in class and only 20 lectures so opportunities may go fast!

You will send your notes to Lee to verify that your notes are of sufficient quality to merit the extra credit; this may require a few rounds of revisions. However, if you follow the guidelines below it shouldn't be too bad.

You should plan on organizing your notes as follows:

  • Organize them in at least the following sections: Topics & Readings, Audio & Video, and Notes.
  • The Topics & Readings section lists the main topics covered in the course, e.g. "Scoping rules in JavaScript". Please use an unordered bulleted list (using *'s in wiki markup). In this section also list readings relevant to the lecture that were mentioned in class.
  • Leave the Audio and Video section blank. Anil will fill this out.
  • Put your notes in the Notes section.

Use (nested) lists if appropriate for the notes; however, please have some text that isn't bulleted. Please try to make the notes even if you did not attend lecture; however, you don't need to cover every small bit of information that was covered. In particular the notes do not need to include digressions into topics only tangentially related to the course. Complete sentences are welcome but not required.

Once your notes meet the guidelines, Lee will post the notes for you.