Problem Set 0
Problem Set 0
Introduction
Welcome to CS51! The goal of this assignment is to prepare your development environment
for use in CS51. You will set up an editing environment for OCaml, compile and run a toy
program, explore git, and figure out the assignment submission system.
Part 1: Announcements
Upcoming Sections
There will not be regular sections or office hours during the week of February 1st.
Should you need help on this problem set, please attend the Problem Set 0 help session
on Tuesday, February 3, 7-8:30pm in Northwest Building B103. If you have questions
at any other time of the week, please turn to Piazza (discussed below).
Todos
College students: please fill out the sectioning form for CS51 here. Sectioning will be
available from Tuesday, February 3 at 2:30pm until Thursday, February 5 at 11:59pm.
Check out Piazza, the discussion board used by this course, here. Piazza will be your
go-to source if you have a question about a problem set or anything else in the course.
We encourage you to answer questions and contribute to discussions on Piazza (and
you might even find it beneficial to your grade at the end of the semester).
Fill out the CS51 Welcome Survey.
The supported way to complete work for CS51 is to use the 2014 CS50 Appliance, with
CS51 tools installed.
If you took CS50 last fall (2014):
Fire up your Appliance.
Look at the bottom right corner of the screen for a version number. If it
starts with 2014, follow these steps:
Open a Terminal window in the appliance, and type:
sudo apt-get update
sudo apt-get install deb51
update51
Be patient! It may take 30 to 60 minutes to get the environment setup.
Once installation is finished, close that terminal window and open a new
one.
If the version of your appliance is anything other than 2014, head over here for Macs,
and here for PCs, where you can download the CS50 Appliance. If you are on a Mac
and do not have VMware Fusion, please fill out https://cs50.harvard.edu/vmware to
get a license. In the meantime, you should be able to use the free trial for VMware
Fusion. Once your Appliance is running, follow the previously mentioned steps to get
set up for CS51!
You are welcome to "do your own thing" if you have no qualms about setting up
OCaml, OPAM, utop, core, etc. as specified in the course textbook. However, please
note that we can provide no support to students who elect this option. If you have
trouble with your setup, we will not be able to help you.
Once you have your Appliance set up, test OCaml by running utopfrom the command
line (Terminal). Don't forget to open a new terminal window after installation, or the
following won't work! You should eventually see the prompt:
utop #
If you type
#quit;;
at the prompt (including the # sign) or Ctrl-D to exit OCaml. Now you just have to learn
how to write useful programs.
As software projects get larger, it's desirable to have software that can track the
development of the project (i.e., new files, changes, deletions). Gitis an example of
version control software which does just that. Gitallows you, the developer, to track
changes to your code, in the form of "commits."
A central idea to version control systems is the notion of a repository, which is a place
where code – and its history – is stored. In CS51, we will be using
code.seas.harvard.edu, which provides Gitrepositories to students. As we will see,
this Gitrepository will be a place where you can store incremental versions of your
problem sets. It will be a place where you can pushyour code at all stages of the
development process for the sake of backing up your code. Gitexcited!
Now that you have an account on code.seas, you'll need to add an SSH key, which
will allow you to authenticate from your Appliance securely!
1. Double-check that you successfully made your repo private but gave the cs51-
2015-staffteam read access to your repo, or you will be unable to submit
problem sets!
Now, it's time to get a local copy of the clone you made.
1. In the CS50 Appliance, make your way over to the command line (Terminal).
2. Let gitknow who you are.
Execute git config --global user.name "YOUR FULL NAME".
Execute git config --global user.email "YOUR HARVARD EMAIL ADDRESS".
Execute git config --global push.default matching.
You should use your Harvard email address and full name.
3. Type git clone CLONE_URL, where CLONE_URLwas the SSH "Clone & push URL"
that you copied on the Clipboard before.
4. You should see something like this if the clone went well (potentially after typing
"yes" when prompted to continue connecting):
Cloning into 'usernames-psets'...
remote: Counting objects: 51, done.
remote: Compressing objects: 100% (51/51), done.
remote: Total 51 (delta 51), reused 51 (delta 51)
Receiving objects: 100% (51/51), 51 MiB | 51 MiB/s, done.
Resolving deltas: 100% (51/51), done.
If you see something like the following, make sure you properly added your SSH
keys.
Cloning into 'usernames-psets'...
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: The remote end hung up unexpectedly
5. If you list the contents of your directory now (as with ls), you should see a new
directory whose name matches what you called your repository.
After completing those steps, you should now have a 0directory with a ps0.mlfile
inside. Your job is to edit this file, setting all the variables to appropriate values. First,
though, check that the file compiles.
If you're using emacs, compile the entire file using C-c C-b (which is emacs-speak for
hitting Ctrl+c and then Ctrl+b). Otherwise, use the provided Makefile by typing make
in the ps0directory:
$ make
corebuild ps0.native
$ ./ps0.native
----------------------------------------
Name: FIRST LAST
Now enter values for name, class_year, and exciting. If using emacs, you can evaluate
individual functions with C-c C-e. Once finished, make sure the file still compiles.
When you modify some code, or reach a good "checkpoint" in your coding (e.g., "fixed
that bug!"), you can "commit" these changes by executing
Part 4: Submitting
This year, we're using a submission tool originally built for CS61. After an initial
configuration, it allows you to automatically submit when you git pushyour work to
code.seas. As a result, you'll only need to perform most of the below steps below only once.
Let's get started!
1. When you're ready to submit, be sure to commit all changes to the files in the 0
directory of your repo, and do a git pushto push those changes to the code.seas
server.
2. After a few short moments after a successful git push, the grade tool should
automatically detect and show you the commit. You're done!