CS 3 (Spring 2022) Software Setup: CS3 2022

Installing Visual Studio Code

Start by downloading VSCode here: https://code.visualstudio.com/download, then follow the instructions to install it. Once it finishes, search for blank.caltech-vscode-extension-pack in the extensions view (Cmd+Shift+X), and install the extension pack that comes up.

Setting Up Labradoodle

If you have used Labradoodle in a previous class, you should already have it set up. Otherwise, to find your username and password for the remote system, go to the following link: https://grinch.caltech.edu/cs3-22sp

Now, we need to set up our remote connection to labradoodle.caltech.edu. Go to the “Remote Explorer” view (one of the buttons to the top left, looks like a computer, says ‘Remote Explorer’ when you hover over it), and click the plus button on the top next to “SSH Targets”. In the window that pops up, type ssh USERNAME@labradoodle.caltech.edu, and click enter. Select the first option and click on the plus next to where it says labradoodle.caltech.edu. When it prompts for your password at the top, type in your password from above. If it also asks you which OS configuration, choose “Linux”. Once it (finally) connects, search for blank.caltech-vscode-extension-pack in the extensions view (Cmd+Shift+X), and install the extension pack that comes up. This will install all the necessary extensions for this course on the remote server. Depending on your operating system and past experience, you may have to install git manually from this website: https://git-scm.com/downloads

Type Cmd+~ to open up a terminal in vscode, and it will print out an SSH key which you should copy to the gitlab keys page here: https://gitlab.caltech.edu/profile/keys If you miss the ssh key, type cs3-setup into the terminal, and it will reprint it for you.

Then, run the following commands (Note that you WILL NOT have to run these ever again):

Terminal

me@labradoodle:~mkdir ~/cs3
me@labradoodle:~chmod 700 ~/cs3
me@labradoodle:~cd ~/cs3

(Optional) Note that Labradoodle will prompt you for your password every time you SSH into the server. If you wish to change your password, enter the command ‘passwd’ into the terminal, then enter your old password and what you would like your new password to be (be sure to save this somewhere). Alternately, you can follow the instructions at the following link to use keys instead of passwords to SSH in https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server

Cloning a Repository

In the “explorer” tab of VSCode (the top button on the left, the icon looks like two pieces of paper), there will be an option to “Clone Repository”. Once you’ve clicked “Clone Repository”, type in git@gitlab.caltech.edu:cs3-22sp/hello-world.git. Type cs3 into the window that pops up to put the project into the correct folder, then hit enter.

Now that the project is created in VSCode, we’re ready to run a simple C program.

First, type Cmd+~ to open up a terminal. If you are not already in the folder for the hello-world repository we just cloned, type

cd hello-world

Then, type the command

clang hello.c

Then, finally:

./a.out

to run the program. If it prints out “Hello World”, it worked!

Verifying Emscripten

We also need to verify that emscripten, the service that we will use to run demos, is working properly. We have provided an ‘example demo’ that you can run to test this. Run the command make all in the terminal. After the files compile, a URL should pop up in the terminal - it should look something like http://labradoodle.caltech.edu:####/bin/smile.html, where the #### is a 4-digit number. Open this link, and after it loads, you should see a blinking yellow smiley face displayed. If so, your emscripten service is working properly, and you are good to go!