CS401 Lab 2: Some Tools and Submission Information


Introduction

Throughout this course there are a number of tools that will be necessary to help you write and submit your labs and assignments.  In this lab you will learn to use a few of these tools, including:

  1. Logging in remotely to access your Pitt files so you can work on your projects at home or in any computing lab on campus.
  2. Using the course submission tool so that you can submit your programming assignments correctly.
  3. Securely copying a file from one computer to another using FTP.  This will allow you to download files from your Pitt account to your own computer or other computer on campus (and vice versa).

Starting Up

Before starting this lab, log into one of the Mac Minis in the Java Lab and open a Terminal window.  If you forget how to do this, refer to Lab 1.


Logging In Remotely to access your Pitt files

The Unix operating system allows users to log into machines remotely, so that you can access them from anywhere on the Internet. However, as a security measure, the Mac Minis in the Java Lab only allow remote logins using secure measures (i.e. using encryption).  This prevents snoopers on the network from capturing ids and passwords from unsuspecting users.  Secure remote login from one Unix machine to another can be done on the command line using the command

ssh javalab.cs.pitt.edu

Try the command above from the terminal window of your workstation.  The first time you do it from a given machine it may ask you about the key being used -- if so just type yes to continue with the login.  Enter your password when asked (it assumes your id is the same one used in your original login) and note that you will then be connected to another Mac Mini in the Java Lab.  You may see the following message:

Could not chdir to home directory /Users/<yourid>: No such file or directory

This simply means that you have never logged into the console of that machine, since your home directory is only created when you log in from the console.  You should still be able to access your pitt.edu afs files, however, in the following way:

  1. Use the klog command to get a token for your account.  This is the same thing you did in Lab 1 via the Get Tokens button.  Now, however, you must execute it on the command line:  klog -pr <yourid> -ce pitt.edu
    where <yourid> is your Pitt Id.  When prompted, enter your password.
  2. Change directories to your home AFS directory.  See Lab 1 for details on how to do this.

In case your prompt does not identify the machine you are using, you can find out about it with the command

hostname

To terminate your remote login session, type

exit

at the prompt.  Your terminal window should once again be the workstation that is in front of you -- type hostname again to confirm this.

If you are using your own Mac or are using a Mac somewhere else on campus, you can still use the ssh command as described above, as long as your computer is connected to the Internet.  If you are using your own PC or a Lab PC somewhere else on campus, in order to remotely log into one of the Mac Minis you must use a secure login program such as F-Secure or Putty.  Many lab PCs already have one of these (or a similar program) installed.  If you are unsure, check with a lab assistant or the Pitt Help line (624-HELP).  For information on downloading these programs and using them to log into the Mac Minis, check out the Web links indicated.  Also feel free to see me or your TA for help during office hours.

If you are off-campus (i.e. not on Pitt's network) and want to access your AFS files, you will not be able to directly log into the Java Lab machines.  This is because the Java Lab machines do not accept remote connections from computers outside of Pitt's network.  Instead you can log into one of the Unixs machines.  These are accessible via secure login and have a recent Java compiler installed.  Furthermore, you do not have to use the klog command to access your files on these machines, so you may in fact prefer them.  To remotely log into one of the Unixs machines, follow the same ssh command (or other secure login program) and use the host name:

unixs.cis.pitt.edu

Once logged in, find your course files and practice compiling and running programs from this machine.

When you are finished using your remote login session, make sure to log out by typing     exit    at the prompt.

Note: If you do not have a secure login program installed on the PC you are using, you will not be able to remotely log into the Mac Minis or the Unixs machines. 

Important note: If you log in remotely to Unixs or the Mac Minis using the techniques described above, you cannot execute any graphical applications.  This is because graphical applications require a console window (rather than just a remote login window) to display the graphics.  Thus you must run graphical programs directly from a PC or from a Mac Mini console.


Submitting Using the Course Submission Site

Before completing the next section of this lab, thoroughly read over the assignment submission guidelines.  Your TA will also spend a few minutes explaining these to you.

Once you are familiar with the submission guidelines, you should practice submitting files so that when it is time to submit your projects and labs you are comfortable with the procedure.  I have created two sample submission projects called test1 and test2.  First, you need to prepare your files for submission.  Do the following:

1) Copy the first Java handout ex1.java to your local home directory (the one on your Mac Mini).  This directory should be called  /Users/<yourid>.  You can copy either using the Terminal or using the Finder.  For example, from the Terminal you could do the following:

cp /afs/cs.pitt.edu/usr0/ramirez/public/html/cs401/handouts/ex1.java $HOME

This should copy the handout to your home directory.  [Note 1: $HOME is a variable defined for every user that has the path of the user's home directory.  If you want to see the contents of your $HOME variable, just type "echo $HOME" in your Terminal window]. [Note 2: You may see an error when doing this related to copying "extended attributes".  This will not prevent the copy from working, so just ignore that error].

2) Now copy the Assignment Information Sheet to your home directory in a similar manner.  Type:

cp /afs/cs.pitt.edu/usr0/ramirez/public/html/cs401/infosheet.html $HOME

3) Now open your Finder program by clicking on the icon with the smiley face on the bottom of your console. You should now see a window showing all of the files in your home directory.

4) Highlight ex1.java by clicking on it.  While holding down the <Command> key (the one with the Apple on it) click on infosheet.html.  Now both of those files should be highlighted. 

5) Hold down the <CONTROL> key and click on either of the highlighted files.  This should show you a menu with a number of options.  Move the mouse over "Compress 2 items" and click there.  You should now see the file Archive.zip in your Finder.  You are now ready to submit.  [Note: When actually submitting your projects you may be using a PC rather than a Mac.  If this is the case, you will need to use some other software (ex: SecureZip) to create your .zip file. This software is available in the campus PC labs and should also be available to download to your PC].

6) Open Safari (or go to a new tab if it is already open) and access the course Submission Site:

http://www.cs.pitt.edu/~ramirez/cs401/submit/

You may see a warning: "Safari cannot verify the identity…".  If so, click on the "Continue" button.  You should now see the submission tool for the CS 0401 course.  Look over and read the page carefully, so you are familiar with everything required to submit. 

7) Now click on the "Choose File" button (note: in other browsers, it may appear as "Browse").  Find your Archive.zip file by navigating through the folders (most likely, it will open initially to your home directory).  Select Archive.zip.

8) Complete the remainder of the submission page by typing your Pitt email id (without "@pitt.edu) and your Peoplesoft ID in the appropriate boxes, and by selecting your lab (the one for which you are officially registered).

9) Finally, click on the "upload" button.  If everything worked, you should see the message:

The file has been uploaded under <your name>

The site only permits a given file name to be uploaded one time.  Submit the same file a second time to see the response in this case.

For practice, you can try this again with the test2 project.  Make sure you are comfortable with generating and submitting your .zip file so that when the first assignment is due it will not cause you any problems.


Securely copying a file from one computer to another using FTP

Note: This part of the Lab should be done from a computer that is connected to the Internet -- either your own or one in a Pitt Computer Lab.

At times you may want to copy files from your Pitt account to a Lab PC or to your own PC or vice versa.  For example, you may be working on a program on your own PC in your dorm, but you want to copy it to your Pitt account so that you can work on it in the Mac Mini lab (or to back it up).  This can be done easily as long as your PC is connected to the Internet (Lab PCs are always connected, but your own PC may or may not be connected).

Using the same rationale explained above for remote logins, it is recommended that file transfer be done only using secure programs such as F-Secure, WS_FTP or WinSCP. Whichever front end you choose, make sure you enable the SECURE login (ex: SFTP).  When you login, use the following address:

        unixs.cis.pitt.edu.

Use your normal Pitt id and password to log in.

The files in your home pitt.edu directory should now appear in your window.  At this point (depending on your front end) you can transfer files using the normal technique of "drag and drop", or perhaps in some other way (see front end documentation for precise instructions)

BE CAREFUL when transferring files that you transfer in the right direction.  For example, if your most recent update was on your PC and you want to copy your files to your Pitt account, drag from your local PC window to the FTP window.  Do it the opposite way if your most recent update was on your Pitt account files.

When you are finished with your file copying, log out or close your window to terminate the connection.