lab00 : Lab00 - A Gentle Introduction
num | ready? | description | assigned | due |
---|---|---|---|---|
lab00 | true | Lab00 - A Gentle Introduction | Wed 04/05 08:00AM | Fri 04/07 11:59PM |
Introduction
Your first lab for this week is an introduction to programming on CSIL and in the Computer Science lab. You will write your first Python program that will print a specific text out on your computer display.
Goals for this lab
By the time you have completed this lab, you should be able to
- use the computers in Phelps 3525 (and other labs like CSIL) to do basic things
- perform basic management of directories and files
- know how to submit assignments using the "turnin" program.
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?”
If you circled just "a" and/or "b" then we consider you a relative beginner, and we think that you should select a partner who is also a beginner like yourself.
If you circled "c" and/or "d" then we think you should either work by yourself for this lab OR you can select a partner who is a bit more experienced, like we consider you to be.
This lab REQUIRES you to partner up if you are a relative beginner, but does NOT require you to partner with someone if you are slightly more experienced. Other labs will REQUIRE EVERYONE to partner up, so please be aware of that. In such parner-required labs, no more than one student each lab is allowed to work without a partner, and only then if there is not an even number of students in the lab.
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.
If you select a partner today, we expect you to keep that partner 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 would not 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:
- Stay logged into whichever account you are using now. If none, then a TA can log onto a
different computer, and provide a web
owser for you to use to fill out
the form necessary to create the account. Go to the following link to do so:
https://accounts.engr.ucsb.edu/create - Once you create the account, it may take several minutes before the account is active.
- After waiting 5-10 minutes, try logging in.
Problems? Scroll to the bottom of this web page to find out what to do.
Notes:
- Phelps 3525 is only available during your weekly scheduled discussion section - it is not open for your use at other times.
- At other times during the week, you can work in CSIL, the "Computer Science
Instructional Lab".
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.
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:
- Find the Applications Menu at the top left of the screen.
- Select System Tools, then Terminal Window
- A Terminal Window should pop up.
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.
- If we are successful, we'll just immediately log out, and move on to Step 6.
- If it doesn't work after 15 minutes, we'll need you to send an email to support.
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:
jimbo@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.
- When you type cd by itself, it takes you to your 'home directory'.
- cd followed by a directory name (e.g. cd cs8) moves you into a directory under the current one
Each of the mkdir commands "makes a new directory" (i.e. a new folder).
- For example, mkdir cs8 creates a new directory called cs8, inside the current directory.
Each of the pwd commands "prints the working directory", i.e. it tells you where you are on the hard drive.
- Your home directory is something like /cs/student/jsmith or /engr/student/mdiaz
- Under that, you might have a directory cs8—that would show up as /cs/student/jsmith/cs8, or /engr/student/mdiaz/cs8
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 is 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.
- This is sometimes called the "Python Command Prompt" window.
- This is also called the "Python Shell" window.
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.
- Hint: You may be able to use right-click (control-click on Mac), to open this link in a new window.
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.
- Note: if the usual keystrokes for copy and paste are not working, try the menu options under "Edit" for copy and paste.
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@cs8 lab00
Careful: that’s an uppercase ‘L’ at the start, and lowercase ‘l’ later, and the class name is “cs8”. 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:
- Find the System Menu at the top of the screen.
- Select Log Out
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:
- Turn in a complete and accurate Hw0 - your TA should have collected it earlier.
- zen.txt is complete, with "Copied by:" and your name, and is saved in ~/cs8/lab00/.
- zen.txt is turned in from your user account.
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: Friday, April 7 (11:59pm). Remember: attendance in-lab is mandatory to receive any lab credit.
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,
- cc your instructor and your TA on the email.
- Indicate that you are enrolled in CS8
- Tell approximately what day you enrolled in the class on GOLD and when you completed (or attempted) the form at https://accounts.engr.ucsb.edu/create/
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 Ziad Matni and Mike Castano for this quarter.