Programming Assignments

This assignment schedule is preliminary and subject to change. See grading and course / assignment policies.


General Programming Assignment Instructions

The remainder of this guide details the steps you will need to take to be ready to use GitHub to submit your assignments.

Do this once at the beginning of the course

Creating a GitHub Account

If you already have a GitHub account you are willing to use for this course, then you’re done - proceed to the next step.

Otherwise, visit the GitHub registration page and follow the onscreen instructions to register for an account. You will want to select “Free” as your subscription option, and ensure the “Help me set up an organization” box is unchecked.

Do these once per assignment

Starting the assignment

Navigate to your the dashboard at the top of the page to start the assignment.

Selecting your partner

If you are the first of your pair to start an assignment, you will be asked to identify your partner by selecting their name from the shown class roster. Do not select a partner’s name without their permission. Be careful when specifying a partner, as there is no way for you to change this on your own once you have selected one. Submitting will create a Github repository for you and your partner that includes starter code. A link to this repository will be of the form: https://github.com/cos316-f24/<assignment#>-<unique-name>.

If your partner has already selected you for this assignment, you will be shown a link to the same, shared Github repository.

Granting the COS316 Grader permission to your Github (assignment 1 only)

The first time you go through this process, you should be prompted to grant the COS316 Grader permission to access various parts of your Github account. This is required in order to allow instructors to view your assignment files, and to allow the autograder to find your submissions.

Getting access to assignment code

After your repository is generated, you should accept the Github invitation by visiting the repository on GitHub and clicking the link to accept. You might have to go to the ‘notifications’ page on your Github to see the invitation. You also may get an e-mail depending on your GitHub notification settings.

Cloning (downloading) your repository

Once you have access to this repository, you will want to clone a copy of the repository to your own machine so that you can work on it. From here on, the process is similar to how you would contributed to any other git project hosted on GitHub.

There are two ways to clone your repository:

  1. Via command prompt. Open a terminal window using the Git-capable terminal from the first assignment setup. Navigate to the directory you are using for this course, then enter the following command:

    git clone <URL of your assignment repo>

    For example:

    git clone https://github.com/cos316-f24/assignment1-cold-night

    You will need to enter your GitHub credentials to authenticate yourself. Since GitHub has deprecated password-based authentications, you may need to create a personal access token for authentication moving forward (details here)

    Alternatively, you can set up SSH with your GitHub account. This can help to avoid git’s authentication prompts for repository operations. GitHub provides a guide on setting this up.

  2. Via GitHub Desktop. GitHub Desktop is a graphical Git/GitHub interface for macOS and Windows. You may find it easier to use, especially if you have never used Git or similar version control software before.

    Download GitHub Desktop here. Log in with your GitHub account. (If you are not prompted, you can do this manually from File -> Options).

    Then choose File -> Clone repository and select the repo from the list, or enter the URL manually.

Pushing (submitting) to get online feedback

To receive feedback on your submissions, you will need to push them to GitHub. If you already know how to do this, you may skip this section.

Editing and saving files in your repository locally does not automatically save these changes to GitHub.

Saving changes to GitHub is a two-step process. First, you will have to commit your changes to the local copy of the repository you downloaded, and then you have to push these commits to the remote copy of the repository, hosted on GitHub.

As before, there are two ways to do this:

  1. Via command line. To commit your changes, execute the following command from within your cloned local copy of the assignment repository:

    git commit -a -m "<brief summary of changes>"

    This will add all local changes to this commit. Instead of -a, consider using git add to select changed files you want to include in your next commit. Then, to push your changes to the remote repository hosted on GitHub: run git push

  2. Via GitHub Desktop. Select the changes you would like to commit using the change list on the left, and enter a description of the changes in the text box on the bottom left. Then click Commit to master.

    To push your changes to the remote GitHub repository, click the Push button in the top toolbar, next to the Current Branch dropdown. If someone else has made changes to the repository since the last time you pushed, you may first need to fetch or pull these changes, which is done using the same button.


Setting up the Development Environment

In this section, we you will get your development environment set up with the necessary language compilers, libraries, and tools to complete assignment 1 and future assignments & precepts.

Development Environment for Assignments and Precepts

The assignments and precepts in this course assume that you have a few tools and libraries available in your development environment. Any way you get them is fine, and they should generally be relatively easy to find and install on most Linux distributions, BSDs, macOS, and Windows using Windows Subsystem for Linux (WSL).

Note: before installing, you may go down to the “Verifying you have the right tools installed” section first to see what tools you already have; chances are you’ve already installed some of them (like git) locally.

In addition you should have either Firefox or Chrom[e|ium] installed for one of the precepts where we will inspect HTTP traffic using those browsers. Recent versions of the Edge browser which are based on Chromium and include Chromium’s developer tools will likely also work.

Note: All commands below will start with a ‘$’ character; be sure to exclude it from the actual command you’re running.

Installing on Linux

Most recent Linux distributions should have the necessary tools available from their respective package managers. Some Long-Term-Support (LTS) versions may have an older version of Go, in which case you can use the instructions on the Go website to install a newer version of Go.

Below are instructions for a couple popular distributions. You will typically need root permissions (i.e. prefix the commands with sudo or login as root) to install packages:

Debian (Backports/Testing/Unstable) & Ubuntu (Rolling)

$ apt-get install git curl build-essential golang sqlite3

Arch Linux

$ pacman -S git go sqlite3 curl base-devel

Alpine Linux

$ apk add git go build-base sqlite curl

Installing on macOS

First, you must have the XCode Command Line Tools from Apple installed. These already include a C/C++ compiler and make.

You can obtain the remaining tools from a number of package managers available for macOS (e.g. Homebrew, MacPorts), or you can also download and install universal packages from each tool’s respective website.

A simple way using MacPorts is with the following command:

$ sudo port install git go curl sqlite3

Or with homebrew:

$ brew install git go curl sqlite3

Installing on Windows under WSL

To work in a Windows environment, we recommend using Windows Subsystem for Linux, which provides a Linux environment alongside Windows. By default, WSL provides a Ubuntu distribution of Linux. Follow the installation instructions for WSL from the official documentation, then use the instructions above for Linux to install the tools.

You may be able to complete assignments with these tools installed on Windows without WSL, but your mileage may vary and course staff may not be able to offer help with such a setup. We strongly recommend enabling and using WSL if you are on Windows.

Most likely, you will be using the default Ubuntu flavor of WSL, in which case the following command will install all the necessary tools:

$ sudo apt-get update
$ sudo apt-get install git curl build-essential golang sqlite3

Verifying you have the right tools installed

Once you’ve installed the tools, running the following commands in a shell should result in similar output (slight variations are expected on different operating systems). Also, the exact output and versions of the tools may be different, so don’t worry about a version mismatch between what you have locally; as long as they are (relatively) up to date then you should be fine.

Git

$ git version
git version 2.34.1

Go

$ go version
go version go1.18.5 linux/amd64

SQLite 3

$ echo "select (316 + 1021)" | sqlite3
1337

curl

$ curl -I https://www.google.com
HTTP/2 200
server: nginx
date: Wed, 26 Jan 2022 16:41:20 GMT
content-type: text/html
content-length: 3859
etag: "xsmg9fnyjsw7c3qidhrrb62g071vfnls"
accept-ranges: bytes
...

C++ compiler

$ g++ --version
g++ (GCC) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

OR

$ clang --version
clang version 7.1.0 (tags/RELEASE_710/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/ass1sf1bx07qvlrg02nymxnyzp1cpxz7-clang-7.1.0/bin

Make

$ make --version
GNU Make 4.3
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.