CS41 Homework 0: Working Remotely

The main goal of this "assignment" is to make sure every CS41 student can use the tools we’ll need for this course (including git and LaTeX). Note: You won’t need to hand in anything for this assignment; it’s just to enable you to use the tools we need for remote instruction.

Technology for Remote Instruction

We’ll be using several different applications to enable remote instruction this semester. It’s important to get into the habit of using them during the first week or two, so you can get the most out of CS41. Here is a high-level list of technology we’ll be using.

  • Zoom. We’ll use Zoom for live synchronous lectures. Here is a link to the zoom lectures.

  • Panopto. Lectures will be automatically recorded. After lectures, I’ll edit the videos and post them to this Panopto folder.

  • Slack. Slack is a direct messaging software that enables quick short conversations online. Here is a link to our class Slack workspace. Among other things, wee’ll use slack to manage office hours and in-lab conversations. It also integrates very well with Zoom.

  • Piazza. Piazza is a web-based application for managing course discussions. Here is a link to our class Piazza page. Ask questions about homework assignments on the Piazza page, and/or answer questions from other students! Think of Piazza as a better alternative to email, and Slack as a better alternative to instant messaging.

  • git. As with most CS courses, we’ll use git to manage homework handin. For those of you who haven’t used git before, here is a link to a page on how to set up git.

  • LaTeX. Most homework assignments in CS41 will be written problem sets. There will be very little coding. You will typeset all written homework assignments using LaTeX.

  • atom. Atom is a text editor. It’s possible to configure atom to work on your laptop or home machine, but edit files on CS department lab machines. You are not required to use atom, but I do recommend using it unless you have strong reasons to not do so. For writing LaTeX files, many students in the past have found Overleaf to be a good text editor, especially when collaboratively writing up homework assignments. Feel free to use atom or Overleaf.

  • ssh, scp, putty. These tools will let you log onto CS department lab machines and copy files to/from lab machines.

Because many of these tools are new, we’ve set up a detailed guide for using tools for remote instruction.

Getting set up for remote instruction.

The purpose of this assignment is to make sure every CS41 student can operate remotely. Our default approach will be to have you remotely edit files that exist in your normal lab directory. You’ll also use ssh to remotely log onto lab machines and do compiling/testing/debugging from there.

Our goal is to get you comfortable using atom, ssh/putty, and scp/winscp to write, compile, and run programs on lab machines remotely from your own machine.

In this assignment, you will:

  • Set up ssh/putty to log into CS lab machines remotely.

  • Set up and practice using atom remote edit.

  • Practice compiling and running programs over ssh/putty.

  • Learn to use scp to copy pdf files from lab machine to your local machine.

Step 1: Installing and configuring the software you need.

The first step is to download any software you’ll need to run. All of you will need to download atom, and configure it to remotely edit files on your CS department lab machines. Windows users will also need to download a program called PuTTY, which acts like a terminal window, and a program called WinSCP which lets you copy files from your lab machine onto your windows computer.

Download and install the following programs:

  • atom. If you haven’t yet, download the atom text editor.

  • atom remote edit: to use atom to remotely edit files, follow directions from this page: https://www.cs.swarthmore.edu/newhelp/atom-remote-edit.html Once you have these installed, you should be able to use atom to remotely edit your code that lives on a lab machine.

  • Windows users only: putty

  • Windows users only: WinSCP

How do I log in?

Mac/Linux.

Mac users, open up terminal, an application which you should be able to find in Launchpad or from spotlight. Linux users, open up your favorite terminal emulator.

To log into a lab machine remotley, use the following command:

ssh username@lab.cs.swarthmore.edu

You should replace "username" with your CS lab machine user name. Once you enter this command, you will be prompted to enter your password. Note that when you type in your password, no letters will appear!

Once you are logged in via ssh, you can treat your terminal as though you are using a terminal on a CS lab machine.

Windows.

Open putty. In the bar titled "Host Name (or IP address)", enter the following:

ssh username@lab.cs.swarthmore.edu

You should replace "username" with your CS lab machine user name. Then click "Open" at the bottom of the window. Once you enter this command, you will be prompted to enter your password. Note that when you type in your password, no letters will appear!

Once you are logged in via ssh, you can treat your terminal as though you are using a terminal on a CS lab machine.

Step 2: Making sure you can operate remotely.

In this step, you will perform three tasks you’ll typically need in CS41: cloning a git repo, writing in LaTeX and writing code.

(1) How do I clone a repo?

Presumably you’ve taken a computer science course before that uses git. If so, using git should cause you no trouble in CS41. To start, make a directory for your cs41 work and clone the examples repo.

mkdir cs41
cd cs41
git clone git@github.swarthmore.edu:CS41-F20/examples.git
cd examples

(2) How do I compile/view pdfs?

In your examples repo, you should have a file named LearningLaTeX.tex. Open this file using atom ftp-remote-edit, and try making a few modifications. Once you are done, from your ssh/putty terminal, run

pdflatex LearningLaTeX.tex

Assuming there were no errors, this should generate, among other things, a file named LearningLaTeX.pdf. This is the pdf containing the results, however you can’t view this directly over ssh/putty. You will first have to copy it to your local machine, then open it locally. How you do this differs depending on your system.

Mac/Linux

Open a new terminal window, but do not ssh into lab. You will use another tool called scp ("secure copy") to copy the file from the lab machine to your local machine. For example, if your Swarthmore username is brody (it is not) and you cloned your examples repo in a directory called cs41, then you could copy with this command:

scp brody@lab.cs.swarthmore.edu:/home/brody/cs41/examples/LearningLaTeX.pdf .

The command above copies the file from the lab machine at the path "/home/brody/cs41/examples/LearningLaTeX.pdf" to the given directory on your machine. You will want to replace brody with your CS lab username. You might also need to change the path if you cloned your lab somewhere other than ~/cs41/examples. The "." at the end represents that you are copying the file to the current directory you are in in your terminal.

Now you should be able to navigate to the pdf using finder or spotlight. Make sure that you can open it using your favorite pdf viewer!

Windows

Windows computers don’t have scp; however, WinSCP is essentially the same. You can copy your WrittenLab.pdf over in the same way.

(3) How do I compile/run?

As normal, you should be able to navigate through the terminal to the directeory where you store youre cs41 files (e.g. ~/cs41/). From here, you should be able to clone your git repo for this lab as normal.

Once you have cloned your examples git repo, confirm that you can compile and run sayHello.cpp using clang++.

clang++ -g --std=c++11 -o sayHello sayHello.cpp

Next, use atom ftp-remote-edit to modify sayHello.cpp. Ask the user to enter a name, and then say hello to that person instead of just saying hello.

Once you’ve made that change to sayHello.cpp, compile and run your program again to make sure it works.

Note: When there are coding assignemnts in CS41 you will be able to use any language you want (e.g. C++, Python, …​) as long as it is trivial for graders to run your programs.

Summary of Requirements

When you have finished, you should have

  • a copy of the CS41-F20 examples repo.

  • a working sayHello.cpp program that asks the user for their name and says hello.

  • a LearningLaTeX.pdf document.