Lab00, CISC181 honors, Fall 2004

Welcome

The purpose of this first lab ("lab zero") is to orient you to some of the knowledge and skills you will need to complete the remaining labs in this course.

In particular, this lab will introduce you to the Sun Rays.

The Sun Rays are XTerminals that you can use to access the machine called strauss. Strauss is where you will do your actual programming in this course. In lab, you'll access strauss via the Sun Rays.

Note: Outside of lab, you may access strauss from any computer connected to the Internet, provided you have the right access software (e.g., a secure shell client program.) You can find out more about accessing strauss with a secure shell program at the following link: http://udel.edu/~pconrad/UnixAtUD

Note: Lab attendance is mandatory.

Goals for Lab Zero

This lab is kind of a "warm up" for the semester. We want to make sure that you are comfortable with the environment before we get into the heavy lifting, which starts next week.
  1. Make sure you know how to log in and out of the Sun Rays.
  2. Make sure you know how to access the web on the Sun Rays.
  3. Make sure you can find the CISC181 home page.
  4. Make sure you can logon to WebCT and find CISC181.
  5. Make sure you know how to create a text file with emacs.
    (Chapter 15 in Anderson will be helpful here.) You'll create a text file, and submit it both online via WebCT and on paper.
  6. Under your home directory, create subdirectories:
    ~/cisc181
    ~/cisc181/lab00
    ~/public_html
    ~/public_html/cisc181
    Move your lab00.dat file into the newly created subdirectory called ~/cisc181/lab00
  7. Make sure you can change directory into your ~/cisc181/lab00 directory, create a C++ program, compile it, run it, script the results, and submit via WebCT and on paper.
  8. Create a personal home page on strauss. This home page can be anything you like, but you need to have one. This will go into ~/public_html/index.html
  9. Create a CISC181 homepage for the semester. This will go into ~/public_html/cisc181/index.html.
  10. Make sure you understand the lab policies. There may be a quiz on these next week!
If you can do all those things, you are ready to start on the first "real" lab, lab01, where you will start working on coding some of the algorithms we've been designing in lecture (square root, circle overlap, etc.).

Goals 1 and 2: Login/Logout and Web on the Sun Rays

Info on logging in and out and accessing the web on the Sun Rays is at the following link:

http://copland.udel.edu/~pconrad/UnixAtUD/SunRay.html

That link also has information on what to do if you don't yet have a University Unix account. Finally, there is also information on that page that will help you pull up an "XTerm on Strauss"; you'll need that when you get to Goals 5 and 6.

Goals 3 and 4: CISC181 homepage and WebCT

Once you've managed to get logged on to the SunRay system, and you've found the Web Browser, navigate to the following link:

http://copland.udel.edu/~pconrad/cisc181h

There, you should find the main web page for the course. You should find a link to the syllabus, and a link to the labs directory, where the lab you are now reading can be found. This page will be updated througout the semester with additional links to course materials..

Then, click on the link that says "WebCT". This should take you to a login screen, and then directly to the WebCT page for this course. Alternatively, you can go to the main WebCT page, and enter your UDelNet ID and Password.

http://www.udel.edu/webct

Once you are on WebCT, be sure to find the calendar link, and check out the reading assignments for the next two weeks.

Goal 5: Creating a text file with emacs

Open an XTerm on strauss (If you don't know how and/or are not sure what "Xterm on Strauss" means, follow this link to the Sun Ray documentation: http://copland.udel.edu/~pconrad/UnixAtUD/SunRay.html).

If you are NOT yet familiar with emacs, start learning emacs. Go to an xterm on strauss, and type "xemacs". For more instructions on what to do, follow this link:

http://copland.udel.edu/~pconrad/UnixAtUD/EmacsTips.html


Once you are familiar with emacs, go ahead and use emacs to create a text file called "lab00.dat" containing the following, each on a separate line: your name, your hometown, your favorite US state other than the one in which your hometown is located, and your unix userid.) For example, Prof. Conrad's file would look like this:

Phill Conrad

Wilmington, DE

Arizona

pconrad

When you are finished, send the file to the printer in Willard 009 with the following Unix command:

qpr -q whlps lab00.dat

Also, upload this file as part of your submission for Lab00 in WebCT. But DON'T SUBMIT YET! Just upload for now. You'll hit submit at the end of lab, after you've also uploaded your C++ program and script file.

If you aren't sure how to do this, check the following link for help, or ask your TA:

http://www.udel.edu/webct/students/assignments.html

(If you accidently hit submit before you get your C++ program uploaded, don't freak out; your TA can reset the assignment so that you can try it again. Your TA might not be able to fix it on 09/01/04, because its the first week of the semester and his TA account might not be active yet. But if not, he can fix it up for you by next lab on 09/08/04, or at the latest on 09/15/04, and you can make it up then without penalty.)

Goal 6: Managing files and directories

  1. Just as we organize documents in a "real world" filing cabinet into folders, when we create files on a computer disk, we organize them into files and folders. You may be familiar with the idea of "files" and "folders" from using Windows or Macintosh. On Unix, folders are called "directories". Chapters 6, 7, and 8 of your Anderson text ("Just Enough Unix") contain details about files and directories under Unix, and I recommend that you look over those chapters soon. You may find them to be a useful reference for this step.
  2. On the unix command line, type "cd" by itself. "cd" stands for "change directory". If you type "cd" by itself, this command will always return you to what is called your "home directory". When you type in the command, there will not be any output; it will appear that "nothing happened". But if you now type "pwd" on the command line (which stands for "print working directory"), you will see the name of your home directory. On the composers (strauss, copland, etc.) the name of your home directory will be some series of letters and numbers, such as "/home/usra/d9/55560".
  3. Now type "ls" to list the files in your home directory.
  4. Next, we will create a directory for your cisc181 files. Type in

    mkdir cisc181

    This will create a directory called cisc181, in which you can store your files for this course. If you type "ls" immediately after doing this, you will see the new directory listed among your files. Since this directory is "under" the home directory, we call it a "subdirectory" of your home directory.

  5. To move into this subdirectory, type "cd cisc181". If you then type "pwd", you will see that you have moved into the cisc181 subdirectory. If you now type "ls", you will see no files at all. This is because when you create a subdirectory, it is initally empty.

  6. Now type "cd" again, and then "pwd", and "ls". You will see that you have moved back up to your home directory. Then, type "cd cisc181" to again move down into your new subdirectory, and type "pwd" and "ls". Finally, type "mkdir lab00". This will create a subdirectory under the cisc181 subdirectory. We call this subdirectory "cisc181/lab00", since it is under cisc181, under your home directory. To show more specifically that it is under your home directory, we can use the symbol ~ to stand for your home directory. So, your new directory would be referred to as ~/cisc181/lab00. (The ~ is sometimes called "squiggle", though the proper name for it is "tilde", prounounced "till-duh")
  7. You can use the tilde in cd commands. "cd ~" will change to your home directory (though in this case the ~ is redundant, since "cd" all by itself does the same thing.)
    "cd cisc181" changes to the cisc181 directory under the "current" working directory, however cd "~/cisc181" will change to cisc181 under your home directory (regardless of what the current working directory happens to be).
  8. In the previous step, you created a file called lab00.dat. Change to the directory where you created this file (probably your home directory). To move this file into the directory ~/cisc181/lab00, you can use the following command ("mv" stands for "move"):
    mv lab00.dat ~/cisc181/lab00
  9. A special directory is the one called ~/public_html. Any and all files that you put into this directory become available on your web page. (If your user id is foobar, your web page is http://udel.edu/~foobar).

    To see if you have this directory, change your working directory to your home directory (use either "cd" or "cd ~") and then use "ls" to see if the directory "public_html" is listed. If you don't have this directory already, use "mkdir ~/public_html" to create it. Then use "cd public_html" to move into this directory.
  10. Once you are inside public_html, do the command "pwd" to ensure that you are inside "~/public_html". Then, do another "mkdir cisc181" command, to create the directory "~/public_html/cisc181". This directory will store your "CISC181 web page". In a later step in this lab, you will create a personal web page (unless you already have one), and a web page specifically for this course.

    The files for your personal web page goes into the directory "~/public_html", and will be accessed via the URL http://udel.edu/~userid (where userid is your UDelNet ID).

    The "CISC181 web page" goes into the folder "~/public_html/cisc181", and will be accessed with the URL http://udel.edu/~userid/cisc181. You can use this same technique to create as many web pages as you like under your main web page, just by creating new subdirectories to store the content. We'll add content (HTML files) to the web page, and do the commands to make it available (the "chmod" commands) in a later step.

Goal 7: C++ programming on Strauss

  1. Type "cd" by itself on the command line to change directory back to your home directory. Then, type "pwd" to see that the command worked properly (it should show the name of your home directory) and then type "ls" to list the files in your home directory.
  2. Now, type "cd cisc181/lab00" to go into the directory for lab00 that you created in the previous step. (Note that you could also go there with two cd commands in a row, e.g. "cd cisc181" and then "cd lab00", but it is faster to combine these steps.)
  3. Use emacs to create a file lab00.cc that contains the following (except substitute your name and Unix user id for those of Jane Doe, and use today's date.)

    DO NOT include your student number (NEVER include that number in anything you submit in this class!)
    // lab00.cc Jane Doe doej@udel.edu 09/01/04
    // traditional first program (Anderson, p. 383)

    #include <iostream>
    using namespace std;
    int main()
    {
    cout << "Hello, world!" << endl;
    }
  4. Once you've created this program, use the following command to compile it (compile means: translate from C++ into machine language, or it cannot be translated because of errors, report the errors) with one of the following commands. At this point in the semester, you may use either one (later on, I may tell you to use one or the other.) Note that the first command is CAPITAL CC, not lowercase cc.
  1. In both cases, a new file is produced called "a.out". To execute this file (run your program, type the following:
  1. You are now ready to use the "script" command to make a record of your work.
  1. Now, use "cat lab00.txt" to make sure your script looks ok, and use the following command to print both your .cc file and your .txt file. (Yes, I want you to print both of them, and submit both of them, even though the .cc file is contained inside the .txt. file. Humor me. We'll talk more about that in lecture.)


And finally, you are done with Goal 6!

Goal 8: Creating a personal web page

  1. If you already have a personal web page on strauss (one that comes up when you type http://udel.edu/~userid, where userid is your UDelNet ID), then skip to the next goal (creating your CISC181 web page.) If not, then continue.
  2. cd into your ~/public_html directory
  3. Use emacs (or vi) to create a file called "index.html". The contents of that file should be something like the following:
    
    <html>
      <head>
        <title>Joe Sample's Web page</title>
      </head>
    
      <body>
        <h1>Joe Sample's Web page</h1>
    
        I had to do this <b>web page</b> for my 
       <a href="http://udel.edu/~pconrad/cisc181"> CISC181 class</a>.  Right now it is
        pretty lame, but I hope to make it better later.
    
    
      </body>
    </html>
    

    Here's what that looks like once it is formatted by a web browser:

    Joe Sample's web page

    I had to do this web page for my CISC181 class. Right now it is pretty lame, but I hope to make it better later.


  4. After you save the file, you need to type in the following command:
    chmod -R a+rx ~/public_html

    This command makes all files and directories under your public_html directory accessible to all users on strauss, as well as all users on the World Wide Web. You need to repeat this command each time you add new files under public_html that you want users of the Web to be able to access. (Actually, this command is usually "overkill"; we'll talk about more targetted commands later on. But when you are just starting out, this is a safe bet).
  5. To see that it works, type into a web browser:
    http://copland.udel.edu/~userid

    If it doesn't come up, make sure you set all your file permissions correctly. The most common problem is not doing the "chmod -R a+rx ~/public_html" command. If you did that, and it still doesn't work, check with your TA or with a classmate for help.

Goal 9: Creating a personal web page and a CISC181 web page

  1. Now, cd into ~/public_html ("cd ~/public_html") and create a subdirectory called "~/public_html/cisc181". You accomplish this in one of two ways: either by typing "mkdir ~/public_html/cisc181", or by just typing "mkdir cisc181". (The second way works because you are already in ~/public_html).
  2. cd into ~/public_html/cisc181. Now, create an index.html file in this directory containing html code similar to the following:
    
    <html>
      <head>
        <title>Joe Sample's CISC181 Web page</title>
      </head>
    
      <body>
        <h1>Joe Sample's CISC181 Web page</h1>
    
        <p>I had to do this <b>web page</b> for my 
           <a href="http://udel.edu/~pconrad/cisc181"> CISC181 class</a>.
        </p> 
      
    <p>Part of this page is to make a web ring.
    The next student in this web ring is <a href="http://udel.edu/~jsmith">Jane Smith</a>. </p> <p>Here is a picture of me: <img src="jsample.jpg"></p>
    </body> </html>

    Here's what that looks like once it is formatted by a web browser:

    Joe Sample's CISC181 Web page

    I had to do this web page for my CISC181 class.


    Part of this page is to make a web ring.
    The next student in this web ring is Jane Smith.

    Here is a picture of me:



    To assist you in creating the web ring, here are the names and UDelNet ID's of the students in your class:
    mayers ~mayers/cisc181 Michael Ayers-Morris
    summerb ~summerb/cisc181 Summer Blake
    cjchance ~cjchance/cisc181 Casey Chance
    adempsey ~adempsey/cisc181 Ashlee Dempsey
    fryz ~fryz/cisc181 Zachary Fry
    khazuda ~khazuda/cisc181 Kara Hazuda
    jothki ~jothki/cisc181 Joshua Kirby
    springle ~springle/cisc181 Steven Pringle
    mrein ~mrein/cisc181 Matthew Rein
    andytuba ~andytuba/cisc181 Andrew Sacher
    msimp ~msimp/cisc181 Marc Simpson

  3. If you don't want a picture on your web page, that's fine; just omit the part in the HTML code that says "<p>Here is a picture of me: <img src="jsample.jpg"></p>". If you would like a picture, then you can upload a picture of yourself in .jpg or .gif format to your account on strauss, and move it into the same directory as the index.html file that refers to it. Change the name "jsample.jpg" to be whatever the name of your image file is. Alternatively, your instructor or TA may make a digital camera available during class, lab or office hours for you to take a picture. If so, he/she will tell you where to copy the file from. For example the command might be something such as:

    cp ~pconrad/public_html/cisc181h/04F/studentImages/jsample.jpg ~/public_html/cisc181



  4. Once you have created the index.html file, and/or copied your image file into your public_html/cisc181 subdirectory, you may need to repeat the "chmod -R a+rx ~/public_html" command in order to get the web page to come up when you use the URL http://udel.edu/~jsample/cisc181 (remember too to subsitute your own UDelNet ID in place of jsample).

Goal 10: Understanding Lab Policies

 

First, lets get this out of the way: Lab attendance is mandatory.

Attendance will be recorded. Be sure to sign the attendance sheet and return it to the TA before leaving your lab session.

Lab attendance is reported on WebCT as, for example, LA0913 (lab attendance for 09/13/04.) Grades are marked as P, A, E, or U for "Present", "Absent", "Excused", or "Unknown". You must at least make an appearance to be counted present.

Please read about more lab policies by following http://copland.udel.edu/~pconrad/cisc181h/04S/labs/lab_policy.html

Finishing up: What to turn in for this lab

  1. Be sure that you have a printed copy of your three files: lab00.dat, lab00.cc, and lab00.txt (script file).. Hand these to your TA before leaving the room. If you are making up this lab, hand it to him/her on 9/08/04 during Lab01, or at the very latest on 09/15/04 during Lab02 (that should only be for students who for whatever reason, added the class late.)
  2. Be sure that you uploaded a copy of all three files to WebCT (lab00.dat, lab00.cc, and lab00.txt). Then, click submit to send these to your TA.
  3. Grading:

Next Steps:

You are now ready to start on lab01. The instructions should be available in the lab subdirectory of the course home page. If they aren't, email your instructor to let him/her know!


Phillip T Conrad