CS8, Spring 2017

Lab00:
Lab orientation


Goals for this lab

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

Additionally, most of you will have a lab partner to share lab and some other duties during the rest of the quarter.

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

Step by Step Instructions

Step 0: Select a lab partner

Refer to your responses to question 1 of Hw0: "What of the following things have you done before?"

Does your experience match the person with whom you are currently paired? Do you both want to work with each other? If the answer is no to either of those questions, then look around to find a different partner now.

We expect a few minutes of (hopefully not chaotic) mingling while you match up, but please try to do it quickly. You can refer to responses to question 2, "What type of computer/system(s) do you have?" if that matters to you. Research also shows that lab partners are best matched by gender, but we leave that decision to you too.

We expect you to keep the partner you select today to work with in future labs. Please inform us if you make any changes later.

Before proceeding to Step 1, fill in your partner's name and CoE username (if available) in response to question 4 of Hw0.

Step 1: Verify your College of Engineering Account(s) [SHOULD BE DONE ALREADY!]

For Hw0 you were instructed to create (or confirm the existence of) a "College of Engineering" computer account. One of you must already be signed on (or you wouldn't be reading this page right now), but we need to make sure that both of you can do that. So log out and let your partner log in now.

If either of you have arrived at your lab session without ever logging:

Problems? Scroll to the bottom of this web page to find out what to do.

Notes:

If you are making up this lab assignment outside your regularly scheduled lab time (because you added the course late for example), then you should go to CSIL to do it.

Steps 2 through 8 below must be done once for each lab partner.
First complete these steps for whichever partner is currently logged on. After Step 8, you must go back and redo the steps using the other partner's account.

Step 2: Bring 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:

Step 3: Make sure your username/password work on both systems

If you are working in Phelps 3525, 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 Phelps 3525 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 Phelps 3525)

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-4.2$ 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.

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

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

mikec@csil.cs.ucsb.edu's password: 
Last login: Tue Dec 30 12:27:04 2014 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-4.2$

Now we know that you can connect to CSIL.

Get your TA's attention so he/she can verify you are logged into CSIL. And turn in Hw0 at this time too.

Then exit from the session on CSIL by typing the word exit, like this:

-bash-4.2$ exit
logout
Connection to csil.cs.ucsb.edu closed.
-bash-4.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-4.2$ hostname
csil.cs.ucsb.edu
-bash-4.2$ 

If you are in CSIL instead

If you are working in CSIL, we need to make sure your username/password also work on the Phelps 3525 computers.

The instructions are exactly the same as those for Phelps 3525, except start by entering this command:

ssh linux.engr.ucsb.edu

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

Step 4: Create 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-4.2$ cd
-bash-4.2$ pwd
/cs/student/yourusername
-bash-4.2$ mkdir cs8
-bash-4.2$ cd cs8
-bash-4.2$ pwd
/cs/student/yourusername/cs8
-bash-4.2$ mkdir lab00
-bash-4.2$ cd lab00
-bash-4.2$ pwd
/cs/student/yourusername/cs8/lab00
-bash-4.2$ cd
-bash-4.2$ 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 "Home" icon on your desktop—it should be near the upper left hand corner of the screen. When you double click on this icon, it will bring up your home directory. You should see inside a folder called cs8. 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, it's ok to do it that way.

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

Step 5: Bring up the program called IDLE

The preliminaries are done—now we are ready to start saving files for Python!

IDLE is a piece of software that you use to interact with the Python programming language. As we are using Python version 3 in this class, we also use IDLE version 3. Type the following at the command prompt:

-bash-4.2$ idle3

The window that appears should have the Python Command prompt (>>>) in it.

When you have the IDLE window up, you are ready for the next step.

Step 6: Save a file in IDLE

In IDLE, select "File=>New Window" to open a new "untitled" window for Python code.

When it comes up, click and drag the window by its title bar over to the right of your Python Shell window.

Then, open a web browser to the link below.

http://www.cs.ucsb.edu/~mikec/cs8/assignments/labs/lab00/zen.txt

Go ahead and read it, but then "select all" of the text, "copy" it and "paste" it into the new "untitled" window.

At the top of the file, type "Copied by: " followed by your name and, if another student is working with you today, the other student's name on the same line as yours. Make sure you type "Copied by:" exactly as shown, including capitalization.

You'll have to save the file. Save the file with the name zen.txt inside the cs8/lab00 folder you created in the previous step.

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

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

To start this process, bring up a terminal window exactly the way you did in Step 2.

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

-bash-4.2$ cd 
-bash-4.2$ pwd 
/cs/student/yourusername 
-bash-4.2$ cd cs8 
-bash-4.2$ pwd 
/cs/student/yourusername/cs8 
-bash-4.2$ 

When you are in inside your cs8 directory, you are ready for the turnin step. Note that your account must work to get credit. If your account does not work, you must go to CSIL later to turn in the lab.

Type the following at the prompt:

turnin Lab00@cs8c lab00

Careful: that's an uppercase 'L' at the start, and lowercase 'l' later, and the class name is "cs8c" for the MW (Costanzo) section. You should be asked if you want to turn in this file. Respond "yes", and then you should get a message indicating that your efforts were successful!

Step 8. Log Out

Actually, this is the final step of every lab, but we probably won't remind you again after this one. In fact, you should do this every time you walk away from a lab computer, either in Phelps 3525 or CSIL.

Here's how:

Second partner should now log in and redo Steps 2 through 8.
The first partner should not leave though: help your partner out. Things should go much more quickly and smoothly the second time through.

Evaluation and Grading

Each student must accomplish the following to earn full credit for this lab:

You should try to complete this assignment by the end of the lab section. This first lab, however, will be accepted late without penalty from students who register for the class late, or anyone who needs extra help.

Deadline for after-lab submission: Sunday, April 9 (11:59pm). Remember this deadline is lax for the first lab only. Later labs must be completed the same day they occur, and attendance in-lab usually is mandatory to receive any lab credit beyond homework points.


After both partners finish the lab work above

Normally this section of the labs will have optional challenges for you to work on after completing the mandatory tasks. That is, if you finish the required work early, then we want you to do additional work until the lab officially ends.

Are you one of the first pairs to finish? Then look around for classmates who might be struggling, and ask them if you can help. After all of your classmates are either done or being competently helped by someone else, then you may ask the TA to be excused. That is, today you may leave early, but only after you are sure that nobody needs your help.


If your account 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: 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.


Copyright 2009, 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. Adapted by Michael Costanzo for this quarter.