Table of Contents
Below you will find descriptions and instructions for the technologies that we will be using throughout the semester, including:- Your CS Login
- The
use comp11
directive - The
pull-code11
script - The
submit11
script - VSCode and the SFTP extension
CS Logins
Your CS login is the most important identifier that you will use over the course of the semester. Furthermore, this course requires the use of the department's remote servers that you can log into. All your work will be evaluated in this environment. To use these servers, you need a CS login.Most students do not have to do anything to get a login. Before the start of classes, the EECS IT staff gets a list of all students registered for a CS course. They automatically create an account (and thus a login) for any new students and send an email instructing you how to set your password (be sure to check your Tufts email and any relevant spam folders). You must set your password, which can be done here by clicking "Enable or reset your existing ECE/CS UNIX account".
If you aren't sure whether you have an account, first try setting a password on your hypothetical account. If that works, then you have an account and your CS Login is the same as your UTLN. If you're unable to set a password following that link, then you should contact EECS IT directly to request an account by emailing staff@eecs.tufts.edu.
use comp11
Throughout the semester, you will need to run our scripts and programs in order to get starter code, use demonstration programs, submit your work, etc. These scripts can be accessed by logging onto the Halligan servers and typing the following command at the Terminal prompt:►
use comp11
However this command only makes these programs available during your current Linux session. To make these programs permanently available, the above command can be added to your
.cshrc
profile. To do this, log into a Halligan computer and enter the following commands at the Terminal prompt:
►
cd ~
►
echo "use -q comp11" >> .cshrc
This will add the command "use -q comp11" to the end of your profile. You can check that it was added by running the command:
►
cat .cshrc
and seeing the "use -q comp11" command printed out to the screen. The
use comp11
command will now execute automatically each time
you log into your Linux account.
pull-code11
pull-code11
is the script that you will use to copy starter
code and test files from our CS11 folder into your personal Halligan space. Under the hood, this script is just using the Linux cp
command to move files from one directory to another.
Just like the
cp
command, pull-code11
will
overwrite existing files with the new files it is copying over if they
are on the same folder path and have the same names. Because of this,
you should never run pull-code11
twice from the same folder
unless you really mean to. If you need to run
pull-code11
a second time, one tactic is to run it from
within the same folder that you originally pulled. For example, if you
need a fresh copy of the starter file test.cpp
, a safe way
to execute that by performing the following commands in order (replacing
"hwXX" with the appropriate homework number):
►
cd cs11
►
pull-code11 hwXX
(you now have a folder in
cs11
called hwXX
)►
cd hwXX
(sometime after that last command you somehow mess up
test.cpp
and need a fresh copy)►
pull-code11 hwXX
(note that you are in folder
hwXX
, not cs11
, when you run pull-code11
again)►
cp hwXX/test.cpp .
(copy test.cpp
from the new hwXX
folder up into the original hwXX
folder)►
rmdir -rf hwXX
(remove the new hwXX
folder)submit11
submit11
is the script that you will use to submit your
labs and homework code. While there are a few bells and whistles going
on here, the crux of this script is again the Linux cp
command. The script essentially copies files from your personal Halligan
space into our CS11 grading folder.
When you run
submit11
, it looks for a file with the appropriate name in the immediate folder where it is being run. If it finds such a file, it copies it to our grading folder and the operation is deemed a success. That is to say, submit11
is just looking for a filename. It is up to you to make sure that the correct file with the correct name is in the folder where you run submit11
.
To ensure that this is the case, the best practice is to compile and test your code immediately before submitting it. You should think of submitting not as a single, atomic operation, but as the last step of the sequence compile-run-diff-submit. For example, if you are ready to submit the file
homework.cpp
, you would run:
►
g++ -o homework -Wall -Wextra homework.cpp
(compile)►
./homework (run manually)
►
./homework < test.in > test.out
►
diff test.out test.gt
(diff)(repeat the
diff
process for every test you have created)►
submit11-hwXX
(submit)VSCode and the SFTP extension
Installing VSCode
VSCode is the text editor that you will be using on your personal computer to write all of your programs. Here we will walk you through the process of getting VSCode up and running on your personal computer.
First, download VSCode from the official VSCode website, and click the downloaded file to install it.
Once VSCode is installed, there is one setting that must be configured in order for it to function properly. Open VSCode (just like you would a Web Browser), and click Code -> Preferences -> Settings. This will bring up a "Settings" window with a search bar at the top. Type in "eol"; the top result should say "Files: Eol (Also modified elsewhere)". Click the drop-down menu associated with that result and select "\n". All done!
Setting up the SFTP extension
We will be using VSCode's SFTP extension to sync files between your personal computer and your Halligan space. Specifically, SFTP is a protocol that lets you upload and download files from your local computer to a remote computer or server. In CS 11, you will be connecting remotely to the "Halligan servers" on campus. This lets you edit your code on your personal computer, but compile and submit it from the Halligan servers. In other words, you will always have a copy of your work on your computer!
The following steps walk you through the installation process for this SFTP extension. Open up VSCode to get started.
- SFTP is all about syncing files between Halligan and your personal computer, so you will need a mirror image of the cs11 folder that you created in your Halligan space during the first lab. Create a folder on your personal computer called "cs11". You can then either drag that empty folder into VSCode or click File -> Open Folder; if asked whether you'd like to "copy" the file or "add it to your workspace", pick "add it to your workspace." The folder should then appear in the left sidebar.
- If this is the first time you've opened this folder, you might get a message about "trusting the authors of the files." Select "Yes, I trust the authors."
- To install the SFTP extension, click on Code -> Preferences -> Extensions, and enter "sftp" in the search field. Then click "Install" on the "SFTP" result written by "Natizyskunk".
-
Now that you have the SFTP extension installed, you need to use it to
establish a sync between your personal computer's "cs11" folder and the analogous
folder in your Halligan space. Make sure you're "in" VSCode (just click
somewhere in the window) and if you are on a Windows/Linux press
Ctrl + Shift + P
or if you are on a Mac pressCmd + Shift + P
. This will open up the VSCode "command prompt". In the prompt type the command "SFTP: Config" and hit Enter. - You should now see a configuration file opened in VSCode. First,
delete everything in the file. Next, copy-paste the following text into
the file:
{ "name": "Halligan", "host": "homework.cs.tufts.edu", "protocol": "sftp", "port": 22, "username": "[YOUR UTLN]", "password": "[YOUR PASSWORD]", "remotePath": "/h/[YOUR UTLN]/cs11", "uploadOnSave": true, "ignore": [ ".*", "*.o", "*.core", "*.vgcore" ] }
Finally, in the text you just pasted into VSCode, replace [UTLN] with your CS Login username (e.g., rtowns01) on both the "username" and "remotePath" lines, and replace [YOUR PASSWORD] with your CS account password. Save the new file! - Now comes the moment of truth: actually syncing your files! At the
start of each lab and assignment, you will begin working by logging into
Halligan (either remotely or on a lab machine) and using
pull-code11
(explained above) to copy the starter files into your Halligan space. The next step (if you're working on your personal machine) is to sync those files with the cs11 folder on your personal computer. To do so, open the VSCode command prompt the same way you did earlier (step 4), type "SFTP: Sync Remote -> Local" (DO NOT SELECT "SFTP: Local -> Remote", as this will sync an empty folder to your remote folder, deleting everything in the remote folder), and hit Enter. This will copy all of the files from Halligan onto your personal computer, which will allow you to begin editing them. The changes you make on your personal computer will be sent to Halligan every time you save your work.
You should now be all set with setup for VSCode and SFTP! If things aren't working properly, or if you are generally panicking, please stop by office hours and ask a TA to help you get back on track.