Ancient CS 61 Content Warning!!!!!1!!!
This is not the current version of the class.
This site was automatically translated from a wiki. The translation may have introduced mistakes (and the content might have been wrong to begin with).

NOTOC

Infrastructure

For this course, we will be using a virtual machine, namely the CS50 appliance, for working on and submitting problem sets. All problem sets can be run on other Linux machines or VMs, such as Ubuntu. Most problem sets can also be done on Mac OS X machines. However, we recommend you at least check your work on a Linux VM or the CS50 appliance, in case you are accidentally relying on Mac-specific behavior.

Install a virtual machine monitor and the Appliance

You will need to install a virtual machine monitor (VMware Fusion for Mac or VMware Workstation for Windows/Linux) and the CS50 appliance. Please follow the instructions here both for instructions on installing a virtual machine monitor and installing or updating the appliance.

Update your appliance

  1. Open the terminal emulator (the shortcut is in the lower left corner, next to the Google Chrome icon).
  2. Type the following command and hit Enter. This may take a few minutes to complete.
     update50
  1. Wait for installation complete, and that's it!

Install tools

Run the following command to download install miscellaneous tools we will be using throughout the course:

 sudo apt-get install g++ kcachegrind linux-tools-generic bochs qemu

When prompted, type y and hit Enter to approve the tool installations, and then you're ready to hack!

Version control with code.seas.harvard.edu

We will be using git with code.seas.harvard.edu for turning in problem set submissions as well as version control.

What is git?

Git was developed by Linus Torvalds for development of the Linux kernel. It’s is a distributed version control system, which means it supports many local repositories which each track changes and can synchronize with each other in a peer-to-peer fashion. It’s by far the best version control system available to us and is increasingly widely used. For information on how to use git, see:

What is code.seas?

Code.seas is an online git repository and project management website for SEAS. It’s a deployment of gitorious, and acts somewhat like GitHub. We’ll be using code.seas for distributing code and problem sets, and for collecting your work.

Signing up for code.seas

The following only needs to be done once. You may skip steps 1-3 if you already have a working code.seas account.

  1. Go to https://code.seas.harvard.edu/login.
  2. Enter your FAS credentials. Extension school students, you can fill out a form to get a FAS account if you don’t already have one.
  3. You may be directed to an OpenID Verification page that asks you to confirm your identity. Click the "Allow Always" button on the right of the screen. You may then be asked to enter some details for your profile, but will eventually see your Dashboard.

The next step is to create and add SSH keys for your repositories. These keys authenticate you to code.seas, so that no one else can fake your identity. If you have a safe SSH key, use it. Otherwise, check out this handy HCS tutorial, or follow these steps:

  1. Launch your VM and open a terminal.
  2. Run ssh-keygen -t rsa -b 2048 and follow the instructions.
    • Press enter to use the default file path and key name (should be ~/.ssh/id_rsa).
    • Choose a password or leave it empty.

This creates your ssh keys, which live in the directory ~/.ssh. Your public key is in the file ~/.ssh/id_rsa.pub.

Finally, tell code.seas about this key.

  1. Now run cat .ssh/id_rsa.pub to display your public key.
  2. Copy your public key (that is, select the text on the screen, and copy it to the clipboard).
  3. In the SEAS Code Repository, click “Manage SSH keys”, click "Add SSH Key", paste your key into the field, and click "Save".

You are now ready to use git!

Code.seas troubleshooting

If you are having any trouble with your keys (e.g., you cannot clone a repo because "the connection timed out"), check if your firewall is blocking port 22, and open port 22 if it is blocked. You can use your favorite search engine to figure out how to do this.

If you are having any trouble logging in, please follow these steps:

  1. Quit your browser (flush cookies).
  2. Try to login to code.seas with your FAS account.
  3. If that fails, you may need to change your FAS password and repeat steps 1 and 2.
  4. If that fails, email Academic Computing at achelp@seas.harvard.edu and let them know your FAS account name. They will set up for you a local account.

Obtaining lecture code

The code we’ll look at in lecture is available at the beginning of lecture in a public Git repository. Here’s how to obtain it the first time:

     git clone git://code.seas.harvard.edu/cs61/cs61-lectures.git

This will put the lecture code in a directory called cs61-lectures.

To update lecture code for a new lecture, change into that directory and run git pull

Obtaining and submitting problem sets

We will be distributing and collecting problem sets using git and code.seas.harvard.edu.

Obtaining problem sets

Getting the problem set repo

The following only needs to be done once.

First, you'll need to clone the psets repo on code.seas:

Once your repository is created, you’ll be at a page that contains information about your new repository. You’re going to need the “Clone & push url” in a minute, so either copy the URL, or figure out how to get back to this page.

Next, make sure that the CS61 staff can view your repository.

Next, you'll need to get a local copy of the repo on your machine:

     git config --global user.name "FIRST_NAME LAST_NAME"
     git config --global user.email "YOUR_@COLLEGE_EMAIL"
     git clone REPO_URL

where REPO_URL is the "Clone & push url" from step 4.

Obtaining future problem sets

The following should be done every time a new pset is released or an old pset is updated.

This will download the latest pset directory into your repo.

Another way that’s convenient long-term is to add a handout remote to your repository. That works like this:

 git remote add handout git://code.seas.harvard.edu/cs61/cs61-psets.git

Now you can:

Submitting problem sets

Be sure that git status (from your "username-cs61-psets" directory) reports that you have no uncommitted changes.

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

If git status reports that you have uncommitted changes, you'll need to commit these changes! Read through our Git tutorial for details.

Then, run git push, and be sure Git reports that everything is up-to-date:

$ git push
Everything up-to-date

Head over to the Grading server, and make sure that your code passes all tests you expect it to. You will need to enter your code.seas username and code.seas repository URL.