CS16, Winter 2010

lab00: ("lab zero")
Orientation to CSIL, the Cooper Lab,

and submitting assignments via the turnin program.


Goals for this lab

By the time you have completed this lab, you should be able to

That's a bit general, so let's get more specific...

This assignment is designed to make sure you are comfortable working in the Cooper Lab/CSIL environment and know how to submit your work. So, this lab is mostly about mechanics, not concepts. As a result, this assignment is not particularly intellectually challenging. I hope that will not be the case in future labs!

Step by Step Instructions

Step 0: If you haven't created your College of Engineering Account", do so now.

Ideally, before this lab begins, you will have been instructed to visit the link below, and create your "College of Engineering" computer account:

If you already did that, then wonderful! Proceed to step 1.

Otherwise, if you've arrived at your lab session without having already done this:

If it doesn't work

If you try to create a College of Engineering account, and it doesn't work, then send email to support@cs.ucsb.edu. In your email,

Note that if you are not enrolled in the course on GOLD, you normally cannot get a College of Engineering account—if there is some problem with your GOLD registration, but you still need to start the work in the course speak with your instructor about this.

Step 1: Locate a computer in CSIL or Cooper lab

The purpose of this lab is to orient you to the computers in CSIL and Cooper.

So while, in future weeks, you may be able to do some of your work on your own PC, Mac or Linux computer, this particular lab must be completed in Cooper or CSIL.

Finding Cooper Lab: Cooper Lab is located in the Engineering Science Building, room ESB1003. ESB is located at the corner of campus closest to the airport, furthest away from Isla Vista. ESB is divided into two parts, with a pedestrian bridge overhead. ESB1003 is in the part of the building closest to the bike path. The door to ESB1003 is on the ground floor, at the corner of that faces the airport.

Finding CSIL: CSIL is located in Harold Frank Hall (HFH). You enter from an outside door. To locate CSIL, find the "main front entrance" to Harold Frank Hall, on the side of the building that faces the ocean. Stand outside the double glass doors, with your back to the building, facing the ocean. The entrance to CSIL is now on your left.

Step 2: Logging on

When you sit down at a terminal in CSIL or Cooper lab, you'll see a prompt that asks you for your username. Enter the username that you created for your College of Engineering computer account. This is probably the same as your UCSBNetID (your umail account), unless you specified something different when you created your account.

When you are asked for a password, enter the password you chose for your College of Engineering account (which is not necessarily the same as your umail password.)

Don't worry if nothing appears on the screen while you are typing your password.

You should find that your username and password are accepted, and you get a "desktop" that looks similar to the Windows or Mac OS desktop. In fact, what you get is neither—the systems in Cooper and CSIL use "Linux", which is a different operating system.

In the rest of this lab, we'll walk you through a few of the basics of using this desktop. Most things, though will likely be pretty familiar to you, because they aren't that different from Windows or Mac.

If you got in, move on to Step 3.

If your username/password don't work

If your username/password isn't accepted then:

Note: DO NOT include your password in your email to support. In fact, NEVER send your password through email, and NEVER tell anyone else your password, not even the support staff. Real support staff will NEVER ASK YOU FOR YOUR PASSWORD—not over email, and not in person. They won't need it to help you.

If someone is asking for your password over email, it is a scam called a "phishing attack"—don't be fooled by these dastardly villains.

Step 3: Bring up a web browser

To bring up a web browser:

Here's what selecting the menu looks like:

Applications, Internet, Firefox

 

Step 4: Find these instructions online

You should now be able to find these instructions online at this link:

Note that the ~ symbol (called "tilde", or "squiggle") in front of pconrad is located at the upper left hand corner of the keyboard—and it requires a shift, otherwise you'll get ` which is called the "backtick".

If you received a paper copy of these instructions, this is where the printed copy will end—to save paper, the rest of the instructions can be found online.

Step 5: Bringing up a terminal window

On the Linux systems, there a lot of things we can do with pointing and clicking with the mouse, just like on Windows or Mac. But there are also many things we can only do with the command line, or can do more easily with the command line.

So, one of the first steps will often be to bring up a "Terminal Window", which is the Linux "command line".

Here's how:

Here's what it should look like (click on a thumbnail to bring up a bigger image)

Selecting the menu option Result
Applications, Internet, System Tools Terminal Window

Step 6: Making sure your username/password work on both Cooper and CSIL

If you are working in the Cooper lab, before we go any further, we need to make sure that your username/password also work on the CSIL computers.

If you are working in CSIL (e.g. because you missed the first week's lab and are making it up by working in CSIL), we need to make sure your username/password also work on the Cooper computers.

This is just a "check" to see if there are any problems with your account.

What we are going to do

We will try your username/password over the internet using a program called ssh, which stands for secure shell.

Here's how to do it (if you are in Cooper)

In the Terminal Window that you brought up in the previous step, enter the following command:

ssh csil.cs.ucsb.edu

When you type this at the Unix command line, you may see something like this:

-bash-3.00$ ssh csil.cs.ucsb.edu
The authenticity of host 'csil.cs.ucsb.edu (128.111.43.14)' can't be established.
RSA key fingerprint is 90:ab:6a:31:0b:81:62:25:9b:11:50:05:18:d3:1a:b5.
Are you sure you want to continue connecting (yes/no)?

Answer the question by typing yes, and pressing "enter" (or "return")

Then, you'll be prompted for your password.

Don't worry if nothing appears on the screen while you are typing your password.

If it worked, here's what you'll see something like this:

pconrad@csil.cs.ucsb.edu's password: 
Last login: Thu Aug  6 08:09:04 2009 from linux32.engr.ucsb.edu

Welcome to Computer Science's Remote Access server -- csil.cs.ucsb.edu

You may run your graphically intensive programs on specific workstations in CSIL.
-bash-3.2$

At this point, we know that you can connect to CSIL. We'll need to do again later, at the step where you are ready to submit your work for grading. But for now, we can exit from our session on CSIL by typing the word exit, like this:

-bash-3.2$ exit
logout
Connection to csil.cs.ucsb.edu closed.
-bash-3.2$ 

If you are ever not sure whether you are logged in to CSIL or not, you can type the command hostname at the command prompt. If you are logged into CSIL, it will look like this:

-bash-3.00$ hostname
csil.cs.ucsb.edu
-bash-3.00$ 

If you just have a plain terminal window in Cooper, it will look like this:

-bash-3.00$ hostname
_____.engr.ucsb.edu
-bash-3.00$ 

If you are in CSIL instead

If you are working in CSIL (e.g. because you missed the first week's lab and are making it up by working in CSIL), we need to make sure your username/password also work on the Cooper computers.

The instructions are exactly the same as those for Cooper, except the command you use is this one:

ssh linux.engr.ucsb.edu

Please follow the instructions above, and make sure that everything works properly.

Step 7: Creating some directories

At the command prompt, we are going to type several commands to create folders (called "directories") on Linux in which you can store your programs. The commands are shown in the box below—but first, a little explanation.

Each of the cd commands shown below is a command to "change directory"—that is to move into a different folder on the hard drive.

Each of the mkdir commands "makes a new directory" (i.e. a new folder).

Each of the pwd commands "prints the working directory", i.e. it tells you where you are on the hard drive.

At the command prompt, type each of these commands. What you type is shown in bold. You should get back exactly the output shown, (except that the part in italics may be different—each user will have something different show up there.)

-bash-3.00$ cd
-bash-3.00$ pwd
/cs/student/yourusername
-bash-3.00$ mkdir cs16
-bash-3.00$ cd cs16
-bash-3.00$ pwd
/cs/student/yourusername/cs16
-bash-3.00$ mkdir lab00
-bash-3.00$ cd lab00
-bash-3.00$ pwd
/cs/student/yourusername/cs16/lab00
-bash-3.00$ cd
-bash-3.00$ pwd
/cs/student/yourusername

Checking if it worked

To see if it worked, you can use the file manager on the desktop. Drag any windows that might be covering up the little icon that says "home" on your desktop—it should be near the upper left hand corner of the screen, and looks like this:

Home Directory

When you double click on this, it will bring up your home directory. You should see inside a folder called cs16. If you double click on that, you should see inside of it, a folder called lab00

Note that you could also use mouse clicks and menu options to create these folders, instead of the command line. If you have trouble with the command line, then for today, its ok to do it that way.

Eventually, though, we want you to learn some of the Unix commands also—the reasons its important to know both will become more clear as you move deeper into the study of programming and Computer Science.

Step 8: Copying a C program file into your account

Next we want to copy a file called firstCProgram.c into the directory that we'll refer to as ~/cs16/lab00.

Remember that "folder" and "directory" are interchangeable words.

As review, what does ~/cs16/lab00 mean?

Open a terminal window, and use the cd command to navigate to the ~/cs16/lab00 directory as you did in step 7. When you type pwd, you should see that you are in ~/cs16/lab00.

The type this command at the Unix prompt. This says you want to copy a file from my directory into your ~/cs16/lab00 directory.

cp ~pconrad/public_html/cs16/09F/labs/lab00/firstCProgram.c ~/cs16/lab00
If you get an error message, see "Troubleshooting" below before asking the TA for help.

If it works, then you should be able to type the ls command (that's the lowercase letter L as in "list" followed by the letter "s") to see that you now have a file called firstCProgram.c in your directory:

-bash-3.2$ cp ~pconrad/public_html/cs16/09F/labs/lab00/firstCProgram.c ~/cs16/lab00
-bash-3.2$ ls
firstCProgram.c
-bash-3.2$

Troubleshooting: If you have trouble, check this:

Step 9: Running the file

Assuming you successfully completed Step 8, and are now in the ~/cs16/lab00 directory and it contains the file firstCProgram.c, we are ready to run the program. Before you do, type the pwd and ls commands (print working directory, and list files). The result should look like this—except you'll see your home directory listed instead of /cs/faculty/pconrad.

-bash-3.2$ pwd
/cs/faculty/pconrad/cs16/lab00
-bash-3.2$ ls
firstCProgram.c
-bash-3.2$


If that's ok, then we are ready for the next step. To prepare to run the program, we can use the following command:

make firstCProgram

Try typing that now. It should look like this:

-bash-3.2$ make firstCProgram
cc     firstCProgram.c   -o firstCProgram
-bash-3.2$

If you get something else, see "Troubleshooting" below before asking the TA for help.

If it worked, then try typing ls. You should see that you now have another file in your account, called firstCProgram. This is the machine language version of your program. To run it, you type the following at the Unix prompt:

./firstCProgram
Here's an example of what that would look like:

-bash-3.2$ ./firstCProgram
Please enter a fahrenheit temperature: 68
68.000000 degrees F is 20.000000 degrees C
More conversions? Enter 0 for no, 1 for yes: 0
Goodbye!
-bash-3.2$ 

Troubleshooting: If something goes wrong, check these things

 

Step 10. Submit your assignment using the turnin program on CSIL

A special note for lab00

Normally, before submitting an assignment in this class you'd have to do something more than just download a file and run it! But since the first lab is occurring before the first lecture this quarter, we are keeping things fairly simple.

So this lab isn't worth very many points—it is mainly here to make sure that you are comfortable with all the mechanics of working in the lab. So, this week, you get 40 points for just being able to download a file, and submit it properly. By next week, you'll be writing your own C programs to submit, and you'll have to work and think a bit harder to earn the points.

How to submit your assignment

To submit your assignment, you need to bring up a terminal window on CSIL.

To start this process, we use two steps that we practiced earlier:

Next, we use the cd command that we practiced earlier:

-bash-3.00$ cd 
-bash-3.00$ pwd 
/cs/student/yourusername 

-bash-3.00$ cd cs16 
-bash-3.00$ pwd 
/cs/student/yourusername/cs16 
-bash-3.00$ 

When you are in inside your cs16 directory, you are ready for the turnin step.

VERY IMPORTANT

Use @cs16a (NOT @cs16) when using the turnin command to submit your work.

Otherwise you will be submitting your work to the TAs for the other section,
and it will NOT BE GRADED. This will be true ALL QUARTER LONG.

Type the following at the prompt:

turnin lab00@cs16a lab00

You should be asked if you want to turn in this program. Respond "yes", and then you should get a message indicating that your efforts were successful!


Evaluation and Grading (40 pts total)

Due Date: You should try to complete this assignment by the end of end of your first discussion section, i.e. before 3:50pm, 4:50pm, or 5:50pm on Thursday 01/07/2010 (depending on which section you are enrolled in.)

You may submit it without late penalty through 5pm on 01/15/2010.

After that, there is a 10 point penalty.

The absolute latest we will accept this lab is 5pm Friday 01/29/2010, and this is only an accomodation for students that may add the class late. If it is not submitted via turnin prior to that date, you will receive a zero.

Therefore, you are strongly encouraged to complete it as soon as possible.


Copyright 2010, Phillip T. Conrad, CS Dept, UC Santa Barbara. Permission to copy for non-commercial, non-profit, educational purposes granted, provided appropriate credit is given; all other rights reserved.