Homework 0: Basic tool intro, cloud9, github

This assignment is due before class starts on Wednesday, September 6.

This assignment has three purposes:

  1. To give you some practice using git,
  2. To get started with the Cloud9 cloud based IDE, and
  3. To do some basic tasks in HTML and JavaScript to make sure you’re familiar with the language’s basic syntax and features.

Using Git and GitHub

In this course you will use git to receive and submit your homework assignments. We’ll be using GitHub to manage all of the code provided to you, and the homework assignments you submit.

What are Git and GitHub?

Git is a popular, open source version control system. It helps you keep track of changes to your files, and helps you collaborate with others. GitHub provides several convinces on top of git (a web interface, stores a remote copy of your code, manages access for you etc.). Git and GitHub are complementary, not supplementary, tools.

A full introduction to git is beyond the scope of this document, but there are many good guides on the web that will be helpful for learning git. For this class you will need to understand the clone, add, commit and push commands in git.

Git is a complicated, powerful system, but learning it is valuable and worth the time you put into it.

Getting Git

Git may already be installed on your machine. If it is not, you will need to download and install git, either from the git website, from your linux distribution, or wherever else is most convenient.

All instructions in this course will be given using the command line version of git. Students wishing to use GUI tools will be responsible for learning them on their own. You are strongly encouraged to use the command line version of git.

Using Git in This Course

Assignments will be given to you in git “repositories”, or code collections that you will modify with your solutions and then resubmit. Git tracks directories (and sub-directories), not individual files. When you commit your assignment for grading, you will be submitting an entire directory tree in git for grading, not just certain files.

In general, you will follow the below pattern when using git.

# First you will copy the git repo containing the assignment to your local
# machine.  This will give you a complete local copy of the project.
# This will create a directory on your machine, along with some files.
git clone <URL to git project>

# You will need to change and add to the files in the directory, so that
# the entire directory matches how you'd like to submit your assignment
# for grading.
cd <project directory>
... (editing the files to complete your assignment)

# Once you're ready to send your work for grading.  This will generally take
# three steps:
#   First, "add" the changes you'd like to send to the server.
#   In most cases, this will be all the files in the directory.
#   The "-A" in the below example tells git to also keep track of where you
#   deleted a file, and the "." means "everything in the current directory"
#   and below.
git add -A .

#   Second, "commit" the changes, telling git "ok, treat all the changes
#   I've "added" far together, I'm getting them ready to send to the
#   server".  The "-m" means "I'm going to add a message to this set of
#   changes, so that I'll know what they're about in the future".
git commit -m "completed homework 0"

#   Third and last, "push" the changes back to the server.  This tells git
#   "I've made some changes to the code, I want you to make the code on the
#   server match my local version".
git push

Git is extremely powerful, and you may need to access other parts of its functionality in this class, but in general, the above example covers the most common git use cases.

When Git “Breaks”

When you’re first learning git, its very easy to get your repository into a state where it seems “broken”, and the system isn’t acting in a way you understand. When this happens, you might find the best thing to do is to stop trying to “fix” things, and instead:

  1. back up your work to a different directory,
  2. delete your existing repo from your local machine,
  3. clone a clean copy of the repo,
  4. copy your work back into the repo, and
  5. commit and push your work in your new, “clean” repo.

While the above steps aren’t a good long term strategy for using git, they can get you out of a bind while you’re still learning the tools.

Intro to Cloud9

See the class video from August 30 for an intro to using cloud9 for this assignment.


The main goal of this assignment is to ensure that you can follow directions and turn in your assignments correctly. If you find the “coding” portion of this assignment difficult, please see me ASAP.


Using the provided homework0.html, fill in the code which completes the following tasks.

  1. Make your netID the plain text contents of the netID span element.
  2. Define a function name that returns your name, as an array, with each part of your name as a different string in an array. So, for the professor, it would be the result of printing an array with three strings in it, “christopher”, “william” and “kanich”. Please use all lower case characters.
  3. Define a function called three that takes three arguments, start, stop, and step. The function should assume that each argument will be an integer. This function should return an array of integers, starting at the start integer, and increasing by the step integer, up to but not including the stop integer.

    For example, if I called three(10, 50, 10), the function should return the array [10, 20, 30, 40] (note that 50 is not included).

    Similarly, if I called three(2, 9, 3), the function should return [2, 5, 8].

  4. Make the current user agent appear as the plain text contents of the user-agent div element.

Submission and Grading

You must submit your solution to this assignment through git. When you submit your assignment, your project should have (at least) the following three files in it:

  • README.md: this file
  • homework0.html: your solution to this homework assignment
  • netid.txt: a text file that contains only your UIC NetID. It should not contain anything else.

There are a total of 10 possible points for this assignment.

There is no partial credit for any problem. Other files in your repository will be ignored.

This assignment is due before class starts on Wednesday, September 6.