122 lab week 1
Project questions are discussed on cis122.blogspot.com 

Getting Ready

IT Applications for 122: The DuckWare CD (available at 151 Mck) contains Firefox, TextPad, and SSH for installing on your home computer. For related information, see the 122 Resource page.

SKILL ASSESSMENT NOTATION: In 122, we'll assess skill-acquisition using three levels: E (Exposure), F (Familiarity), M (Mastery).

Micro Labs on Campus: In addition to 026 Kla, You can work in 013 Kla and 101 Mck or in any CC microlab on campus.

Saving your lab work: The My Documents folder on the PCs in 026 Kla is cleared periodically by the systems staff. If you want to save a copy of your lab work, use SSH/FTP to upload your files to your uoregon.edu account. Alternately, bring a USB drive with you to your lab.

All the software we use in the lab (SSH, TextPad, FireFox, etc.) is on the DuckWare CD, and can be installed on your personal computer. The DuckWare CD is available from MicroHelp, 151 McKenzie.

For notebook computer enthusiasts, you are welcome to use your notebook in lab, which has WiFi access.

LAB OUTLINE

  1. Lab lists: You will not be using DuckWeb to drop/add labs; we will handle it informally instead. (Note to GTF: The lab lists are available by request from Cheri-- do this before going to your week 1 lab.)

    For labs that are full, three names may be added beyond the max, on the condition that the added students may have to watch over someone's shoulder when everyone registered attends the lab. Note that originally registered students up to the max are guaranteed a seat. If you are one of the extra students added over the max and you have a notebook computer, bring it to the lab which is a wireless hotspot (and there are also Ethernet connections in the walls of B26 Kla if your notebook is not wireless enabled.)

    If your name is added to a new list, be sure it is deleted from the original list.

  2. SSH for Remote Login; Basic Unix Commands.

    The 026 Kla lab offers a Client/Server computing environment: by using SSH, the PCs in the labs can be used for remote login to the server, uoregon.edu.
    Start SSH and use Quick Connect: 
    Host Name: shell.uoregon.edu	
    User Name: enter your uoregon.edu username
    Click Connect; click Yes is prompted about a digital certificate; enter your uoregon.edu password
    
    Your SSH window now displays the Command Prompt for the login shell on uoregon.edu
    
    	shell means "command interpreter"
    	bash (Bourne Again Shell)
    	login prompt, shell  prompt ($)
    
    Your lab instructor will explain these basic Unix commands:
    
    print working directory: pwd
    list directory contents:
       ls
       ls -a
       ls -l
      
    create new directory:  mkdir
    change directory: cd
    tab key: file name completion
    
    Use  mkdir to create a directory named "public_html" 
    (Do this only if this directory does not already exist in your home directory.)
    
    If you make a spelling error, your can use the following commands to delete
    or rename a directory:
    
    rmdir ("remove directory")
    mv ("rename")
    
    To delete a file that is not a directory:  rm
    
    122 is your 122 site directory on uoregon.edu. It's Unix pathname is ~/public_html/122, where ~ stands for the path to your home directory on the server. Enter this command at the prompt: echo ~ Move to the 122 directory and make directories named p1, p2, p3, p4, and images. Quiz Questions: Translate to Unix: "move to your 122 directory" "make a 'p1' directory in your 122 directory" "make directories named p2, p3, p4, p5 in your 122 directory"
  3. Open Using Emacs in a browser. Your GTF will introduce you the Edit/Compile/Debug/Execute cycle in Emacs, as follows:

    HELLO WORLD! A First C++ Program.

    Just as Thoreau had to teach the earth to says "beans" rather than "weeds", you must teach uoregon.edu to follow your lead and sing your tune:

    1. Use Emacs to edit hello.cpp.

      Start Emacs: In your SSH window, move to ~/public_html/122/p1 and enter the command "emacs hello.cpp". Or, if Emacs is already running, use the Find File command (cntrl-x cntrl-f) to create the new file.

      Follow your GTFs directions to edit/compile/execute the following hello.cpp program. It can be copied from here: http://www.cs.uoregon.edu/classes/cis122/code/w1/hello1.cpp

      //FILE: hello.cpp #include <iostream> // for cout using namespace std; int main(){ cout << endl << "Hello, " << endl << "Watson!" << endl; return 1; }
    2. Use Emacs to compile hello.cpp.

      In Emacs, compile your program with one of our two c++ compilers: g++ or CC. (Esc-X compile.)

    3. Debug: Use Emacs to "Parse" Error messages.

      The C++ compilers will flag syntax errors (typically spelling errors, misplaced or missing semicolons, etc.) by issuing a series of error messages. Your GTF will demonstrate what happens when you misspell cout as count, and remove the semicolon from the cout statement; and will show how to use the Parse Errors command (c-x `).

      Debugging Tip: The compiler translates your source code in a single pass, from the top of the file to the bottom. When it first encounters an error, it outputs a diagnostic message. Keep the following consequences in mind:
      i) If the statement flagged by the compiler as being in error looks totally correct to you, then look for an error in the statements immediately preceding the flagged statement.

      ii) Correct the first few errors, and then recompile-- this may eliminate the remaining error messages. This is known as an error cascade-- a syntax error in line 5, for example, may confuse the compiler so that many subsequent lines, which are totally correct, will be flagged with errors. A cascade of error messages is output, only the first few of which are meaningful.
      When your program compiles without error, you are ready to execute it from the command line.

    4. Suspend Emacs and execute a.out.

      By default, the compilers g++ and CC name the executable program a.out. Suspend Emacs (cntrl-z), and run a.out from the command line.

      Important: Your GTF will carefully explain these key points

      • Suspending emacs vs. Exiting emacs.
      • Resuming Emacs vs. Restarting emacs.

      When emacs is suspended in the background, you must then RESUME emacs (with the fg command, for example, or the %1 command). . If you enter the "emacs hello.cpp" command again, that RESTARTS Emacs, and you will have multiple emacs processes running, which irritates the uoregon.edu systems staff.

    5. Resume Emacs (fg, or %1). When you return to Emacs, the screen is still split into two windows. You can restore the "one window display" with c-x 1.

  4. Unix Commands for Information Architects: Over the course of the term, you will find it helpful to learn the Unix commands described in this document.

You will repeat a similar lab exercise each week until you achieve Mastery of using emacs to edit/compile/execute.


SKILL ASSESSMENT NOTATION: E/F/M.

In 122, we'll assess skill-acquisition using three levels: E (Exposure), F (Familiarity), M (Mastery/Competence).

GOALS FOR WEEK 1: At the end of lab, your skill level should be at E-level with the following topics:

    Basic Unix Commands
    Basic Emacs commands
    Basic Edit/Compile/Execute procedure for  "Hello World"

NOTE: if you missed the week 1 lab, attend one of the Help Sessions scheduled for week 1 and week 2. See Announcements in Blackboard for days/times.

In addition to B26 Kla, You can work in 013 Kla and O26 Kla or in any CC microlab on campus.


The Learning Environment

At the start of the term, your lab instructor will regularly stop and ask the question, "Can all of you hear me, especially in the back of the room? Can you understand what I am saying?"

It's important that you are able to follow along as the instructor presents material. If you cannot hear or understand what is being said, please raise your hand and say (politely) that you are having difficulty following the presentation. The lab instructor will appreciate your assistance.

Also, please keep in mind that your responsibility is to pay attention and follow the instructor's directions. In particular, you should not be reading email, surfing the web, visiting with other students, etc., during the lab. Save those activities for after the lab.