This is the archived website of SI 486H from the Spring 2016 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

Submitting Code

All code for the projects must be submitted electronically, from the USNA cs linux environment. Some problems may have more specific requirements for commenting or naming, but in all cases, code must be:

  • Well-documented and easy to understand
  • Cleanly formatted and easy to follow
  • Linked in comments to any outside resources (web sites, etc.) used

Accessing the CS Linux environment

You can access the CS Linux environment by sshing to one of the machines in the Linux labs, which will have names like michXXXcsdYYu.academy.usna.edu, where XXX is either 302, 303, or 316, and YY is any number from 01 up to 20 (or maybe 22). You can probably leave off the academy.usna.edu part if you are on the yard, by the way.

If you are using Windows, the PuTTy program is your best bet to access ssh. In Mac or Linux, the program is just called ssh. On Linux, if you get tired of typing your same USNA network password all the time, you can set up key-based ssh. First, on your laptop, run ssh-keygen -t rsa -b 2048, which will generate a new public/private key pair. It will prompt you for a new passphrase, which can be whatever you like (or blank). Then do ssh-copy-id michXXXcsdYYu (filling in your favorite hostname) to copy the public key to your Linux home directory. Thereafter, when you ssh from your laptop, it should ask only for your RSA passphrase, not for your USNA network password. Cool!

Also cool: if you are using Linux or Mac, you can easily mount your Linux home directory using the sshfs program. First, install the sshfs program. In Ubuntu and related Linuxes, this means you run the command sudo apt-get install sshfs. Next, add yourself to the "fuse" group: sudo adduser $USER fuse. Log out and back in again for the change to take effect.

Once you have sshfs installed, mounting is a 2-step process. First, make an empty "mount directory" that will act as a doorway to your CS Linux home directory, for example mkdir $HOME/mich. Then run sshfs michXXXcsdYYu: $HOME/mich to do the mount, where as usual you replace the hostname with your favorite and the directory with whatever you chose. (Note the colon in that command!!) To unmount the directory later, just do fusermount -u $HOME/mich

Naming

Unless otherwise specified, all code must be submitted as Java, C++, or Python programs. You should name your file "Prob.java", "prob.py", or "prob.cpp" as appropriate. Depending on the language, I will run your program from the CS Linux environment with one of the following commands, where arg1, arg2, etc. are any command-line arguments:

  • Java:
    javac Prob.java
    java Prob arg1 arg2 arg3 ...
  • C++:
    g++ prob.cpp -o prob
    ./prob arg1 arg2 arg3 ...
  • Python:
    python3 prob.py arg1 arg2 arg3 ...

(Notice, for Java, you must have a class named Prob that has the public static void main method defined.)

If you want/need your code compiled in a different way, you must also submit a Makefile so that if I run make it will compile your code properly.

Environment

I've set up some useful aliases for you so you don't have to type so many directories every time. To get these aliases at your command prompt, just run the following from one of the Linux lab machines:

source ~roche/486h/setup

This will define some shortcuts (aliases) to run any programs we will need for this class. After you add this line, any new terminals will get the new commands as well.

The submit program

The program you will use to submit is located at /home/roche/submit, but can be run by typing 486sub if you edited your .bashrc file as described above. This program is accessible from the usna CS linux environment. You can use it from the MI 302 lab or log into one of the machines remotely.

When you run 486sub with no arguments, it will display something like

Open submissions matching your search:
prob 16
This means, unsurprisingly, that SI 486D has one thing open for submission, it's a problem, and it's number 16. To submit your file or files for this lab, you make a directory in your account (like mkdir prob20), then put any files to submit in there.

Once you have your local directory, and you confirm that the assignment is open for submission, you cd to that directory and run

486sub prob 16
(for example) to submit your files. This will check your files, and then bundle and submit them to your instructor. At the end you will see something like:
Submitting 486d prob 16 for user roche to Dr. Roche..
roche/
roche/hi.txt
Submission successful.
You can see that there is one file that was submitted, called hi.txt. Note the last line, telling me that it was successful. If you don't see this line, then something went wrong.

All this does is put all your files in a place where I can see them, with a timestamp and your username. You are free to submit the same assignment repeatedly, and I will only look at the most recent submission for grading purposes.