Navigation table for Harper Computer Science lab courses rules and guidelines.
Behavior Working in Windoze
Logging into Unix Editing a Program
Terminal Terseness Compiling a Program
Running a Program 'Printing' a File
Handing in a Program Logging out of Unix

General Lab Rules Still Apply

Just because you are in a 'closed' lab facility does not mean you can eat and drink and play games. Please respect the facilities, each other, and yourselves.

Windows

Unknown Applications

If you arrive at a workstation and find applications you either don't know or didn't start, it's best to close them down before you start doing your own work. To kill most Windoze applications, you can simply hit Alt-F4 (that is: the alternate key in conjunction with the 4th function key) and answer affirmatively to any requests to confirm the app's death.

(If you are particularly paranoid, you may even want to reboot the machine. Personally, I shut the machine down, wait a couple of minutes, and then power it back on...except that I leave it connected to the network, I suppose that qualifies as fairly 'paranoid', too, doesn't it? *chuckle*)

Switching Between Unix and Windoze Programs

The Alt-Tab key combination will switch between any open programs. The Start key (aka the Windoze key) will bring up the Start menu so you can open new programs.

Logging Into Unix

Login Name and Password

Whether you plan to run nedit (to edit a program) or mate-terminal (to compile, debug/test, or script your program), you are going to be connecting to the same account on the same machine: ares.harpercollege.edu. You'll need to know both your login id (or login name) and your password. When your account is first created (by IT when you register), they use your Student Portal login id. But they do NOT use the same password. (That would be a security risk. You should always use different passwords for different accounts. Mix letters, digits, and punctuation. That sort of thing. But make it something you can remember, of course.)

The password is set based on your Harper Student ID. To find your ID number, login to your Student Portal account and click to the My Registration tab. Next look on the left side for View Student Schedule Summary and click that link. Your Harper ID will then be in the upper right corner in front of your name. When you type it into nedit or mate-terminal, make sure that the H in your Harper ID number is lower case.

Note here that unix is case sensitive! (In general, you should use all lower case unless instructed to capitalize.) Once you're logged in, it's a whole new world! *smile*

Also note that as you type in your password, nothing will appear on the screen. This is meant as a security mechanism so no one can look over your shoulder and tell how many characters long your password is to limit their search.

Finally, make sure that NumLock is on if you are trying to use the keypad to enter digits.

Once you've entered your login id and password, a second or two later, another will take its place — either a nedit window or a mate-terminal window depending on how you first tried to log in. If no second window appears, the password or user name must have been entered incorrectly. Please try again.

Note: You can feel free to close the first black window once you've successfully connected to either nedit or mate-terminal.

Changing Your Password

Noting that your Harper ID, while difficult to come by online, is also on your actual student ID card (minus an H and 0 or two), you may desire for a more secure password. All connections to ares are made by a protocol known as ssh or Secure SHell. This makes all transactions encrypted and safe. But still, a better password is ideal. So, how do we change your ares password?

We'll use the passwd command in the mate-terminal interface. Just type this command — passwd — into the mate-terminal window and you will be prompted for your current password (to confirm you are you and not someone who just walked up to a window left open in the lab by accident). After that, you will be asked to type in your new password — twice. Keep in mind the information about security mentioned above. Also notice that the ares password manager won't let you pick things that are like 'dictionary terms'. It has a large dictionary...

Editing

Editing of programs can be done in one of two ways: kinda graphical and soooo not graphical.

Semi-Graphical

The simplest is to login using the nedit program. This is a semi-graphical editor (like Notepad in Windoze) for our Linux machine. It will let you edit your programs' source codes and save any changes you make on your unix account for later compiling, testing, and/or execution.

Setup and Configuration

Although many things about nedit are self-evident, here are a few tidbits that escape many people's attention:

In the Preferences menu, please note that anything from preferences, it is not automatically saved! To have something saved so it will be the same next time, select it from Default Settings instead of the main Preferences menu AND THEN choose Save Defaults from the main Preferences menu.

Some of the things you can set up here to make your life easier are:

Not-Even-Graphical

The more difficult way is to use either vi (although it is actually vim; and, truthfully, it has a graphical-y version called gvim which will pop out of the terminal when you run it) or nano (this is a clone of the insidiously and peculiarly popular pico editor which came with the mail system pine; more information can be found at their home page) in the mate-terminal window. These editors are command-line, plain text editors. Both are available on many Unix machines/environments, but each has its own approach to editing a document and its own look-and-feel™. To get some help on nano, you can read its manual or information pages:

...$ man nano

or:

...$ info nano

(But you might want to read the man page for man or info — or similarly the info page for man or info — first. They each have their own approach to documenting programs and their own look-and-feel™. *grin*)

Another helpful resource can be found at the Academic Computing and Communications Center (ACCC) of UIC. (It is actually help for pico. But since nano is a clone of pico, the information should still be fairly helpful.) (The staff of UIC's fine ACCC is doing stellar work here! They seem to have done a fine job on these brief tutorials. I salute you, sirs and/or madams!)

You can also, as mentioned, use vi (or its newer cousins vim or gvim). This is one of the two most popular command-line, plain text editors available for *nix/Windoze platforms. (Its nemesis is the insidious emacs. *hiss* *boo* *hiss*) For help using vi, you may ask your teacher for one of our basics handouts, see your Unix book (the 'recommended' one), or even see its man or info pages (as above, but substitute vi for nano). (Note, also, that there is a link at the bottom of UIC's ACCC's pico tutorial page to some vi help.)

Configuration Got You Down?

Finally, you can feel free to borrow my personal configuration files if you are having trouble with menus and/or commands:

Extension Choice When Saving

Where ever you decide to edit your program, remember to save with the proper extension based on the language you are programming in:

Language Source Code Extension
C++ .C (capital)
or
.cpp (lowercase)
C .c (lowercase)
FORTRAN .f (lowercase)
Java .java (lowercase)

Most unix programs won't recognize your program as the desired language if you don't use an extension from this table! (And remember that ProPEr cAsE is important!!!)

General Terminal Usage

Also remember that when working in the terminal window, commands to run applications can be typed after the $ prompt — which is unix's way of saying, "Hi, I'm waiting for you to tell me what to do now..." When a command/program is done, they will typically give no particular answer unless something went badly. Either way, unix will respond with another $ prompt for you to tell it the next thing to do.

Compiling Programs

First choose the compiling means from the table below — based on the language you are using in your course:

Language Compiler/Script to Translate
C++CPP
CC
FORTRAN g77
or
f77
Javajavac

Then, to compile your, say C++ program, at a $ prompt type (just the part in this color):

    $ CPP progname

Fill in progname with your program's name. (Note that the .C — or .cpp — extension is optional for compiling a C++ language program as is the .c for compiling a program written in C. These 'compilers' will only work with files having the proper extensions.)

Caveats to Compilation

Both g77 and f77 for FORTRAN require you to type the .f extension.

Also, javac for Java requires that you type the .java extension.

Running Programs

At a $ prompt type (again, just the part in this color:

    $ ./progname.out

Be sure to substitute your program's name for progname. Also, note that you use an extension of .out instead of your language's usual extension — .C/.cpp or .c or .f! (.out is a standard unix executable extension, similar to .com or .exe in DOS/Windoze.) And note the ./ in front! That is a standard unix security measure to help avoid the effects of break-ins! You are essentially telling the computer to execute the file progname.out that resides in the current directory (i.e. folder). The . represents the current directory (succinct, isn't it?). The / means 'the right item which is within the left item' — so here we have the executable name on the right and the 'current directory' on the left.

Caveats on Execution

If you are using FORTRAN, your executable name will always be a.out no matter what your program's .f file was called.

If you are using Java, your 'executable' is named correctly (albeit with a .class extension instead of .out), but you must run it via the Java virtual machine (JVM) like so:

    $ java progname

Notice that you do not type the .class to run your Java program!

'Printing' Files

In this day and age, we don't actually print anything, of course. Instead we just prepare a PDF for transport. On ares we do this with a special command just for printing scripts (see the next section below). It is called script-print and can be called in one of two ways. The basic operation is like so:

   $ script-print filename

Here filename is typically Last-First-progname. The reasons for this will be made clear below... This, however, will prepare the file filename.pdf for sending in to me.

(The response from the program is a big bunch of processing results and not of interest to us. But amongst it all you should see Last-First-progname.pdf go by.

The second way to run script-print is with a script name and the name of the PDF to produce:

   $ script-print script_name filename

To need this, you'd have had to run the script command with an argument to name the script file something other than typescript — which is the default name.

Scripting your Programs for Handing-In

In the instructions below, remember that you type the part in this color. Fill in the progname part with the name of your file. Repeat the execution (progname.out) as often as needed to thoroughly test your program. Do NOT forget to exit before PDF'ing (with script-print). Also don't forget to fill in Last and First with your own names during the PDF'ing process.

(If you do not have a particular file that is cat'ed during the script, don't worry — just skip that line and move on. Your instructor will let you know if that file was truly necessary for your course/section.)

(And if your program fails to compile, that's okay, too. By scripting and simply skipping the execution portion, your instructor will have more information to help you locate the error(s).)

$ script
Script started...
$ pwd
/home/students/...
$ cat progname.info   # this only works if you have created an information file 
 .
 .
 .
$ show-code progname.cpp    # repeat for each of your .h and .cpp files if using libraries
 .
 .
 .
$ CPP progname        # list all .cpp filenames if using libraries
progname.cpp***


$ ./progname.out      # run 3-5 tests of your program to show a good sample of your debugging efforts


 .
$ cat progname.tpq    # this only works if you have created a Thought-Provoking Questions file
 .
 .
 .
$ exit
Script done...
$ script-print Last-First-progname
 .
 .
 .
$ _

If your script 'printout' includes lines of seeming garbledygook, don't worry about that, either. It means you used the Backspace key or the arrow keys during the script. If we cared that much, we'd/get the system administrators to write something to remove that. *shakes head* It's okay. Teachers live with far worse every day. Don't worry 'bout it... Sa'right...

Downloading the PDF

Now get the PDF version of your script onto the PC you are sitting at. How? By downloading it, of course! In the labs on campus we already have WinSCP installed and configured for you. At home you'll have to decide which software to use from among those available. (See the link for more info... Installation and configuration issues are covered on that page as well. *smile*)

Getting Corrections on Things

Now that you have a PDF version of your work, you can attach it to an email (you have some kind of email, right?) to me — craie@acm.org.

Make sure the subject contains your name, course, section, and which assignment group this is for (welcome activity, portfolio X, extra credit).

If you get multiple items ready at once, you can combine them into a single email as long as you follow three rules:

  1. they must be of the same assignment group (all extra credit or all for a particular portfolio) and type (all for corrections or all for final grading)

  2. do NOT zip or otherwise package them together (this is extremely annoying)

  3. do NOT link me to where you have them at some cloud service (this is also extremely annoying)

Handing in Something for Grading

To hand in a final version for grading, upload it to the appropriate dropbox on Blackboard. They usually appear about a week before the assignment due date.

Logging Out

Application How to Close Out
mate-terminal Type exit and Enter or Ctrl-D (the Control key in conjunction with the D key) to exit the terminal.
nedit Make sure you've saved (choose File|Save or File|Save As from the menu), then either choose File|Exit or hit Ctrl-X or even click the [X] button in the upper right of the window's title bar.

Always remember to log out completely before leaving the lab. If you leave your unix connection windows open, others can access/use your account as if they were you. They might steal, destroy, or even harass in your name!

If you are in our lab (D238), it would be nice if you could do a Log Off before you leave (not 'Shutdown' although 'Restart' would be okay, too).