[Skip Navigation] [CSUSB] / [CNS] / [Comp Sci Dept] / [R J Botting] >> [CSci201] >> [Lab01] >> index
[Index] [Schedule] [Syllabi] [Glossary] [Labs] [Projects] [Resources] [Grading] [Search ]
Notes: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
Fri Jan 4 08:40:25 PST 2008

Contents


    CS201 Laboratory 1 -- UNIX and X Windows

      Welcome

      Welcome to the CS201 Laboratory. The room, the computers, and the operating system are all state-of-the-art for a university computer science departments. We try to maintain world class hardware and software. So we use Linux.

      In this lab we will take some user-friendly short cuts that are part of the Linux KDE (Kommon Desktop Environment).

      Read Me First

      The first rule is to leave our computers running! It takes time to reboot. During your first quarter if you think you need to reboot -- ask the lab teacher or the help desk.

      Logging in and out

      Please see [ ../labs.html ]

      Note: make sure you select "System -> KDE" before logging in.

      Open your Home Directory

      In the menu bar at the bottom of the screen or perhaps as an icon at the top left of the screen you should be able to see a a folder with a house in front of it. (In some cases you may have to use the "f"/"Start" menu at the left of the menu bar to find a "Home" icon). This symbolizes your persoanl "Home" directory where all your files will be stored. Every Linux/UNIX user has there own "Home" directory. Open it (double click icons on dsktop, or just select/single click if on the task bar/menu). It opens a window with a menu bar.

      Make a cs201 directory in your Home Directory

      On this choose Edit -> New Directory and type in the name "cs201", and click OK. The new folder(directory) will appear.

      Double click the new "cs201" folder and it should open.

      Make a lab01 directory in your cs201 directory

      From the menu bar select Edit -> Create New -> Folder and type in the name "lab01", and click OK. The new folder(directory) will appear.

      Double click it.

      We will now use an Internet Browser (Firefox or Konqueror) to down load some files into this directory so you can do some experiments.

      Download Hello World program

      Here is the world famous first "Hello, World" C/C++ program to download into your cs201/lab01 directory. You can do this very quickly by holding clicking the next link with the right hand button on your mouse, and the selecting the "Save as..." item and then opening the cs201 and lab01 directories: [ hello.cpp ]

      Compile and run Hello World

      To make things easy we will use a program I wrote called 'Q'. It compiles and executes simple programs. It is one of the few "Shell Commands" with a capital letter as a name. I created it with the Q continuum in Startrek -- the next generation as an inspiration.

      Now move to the cs201/lab01 directory window and click the refresh button. The "hello.cpp" icon should appear. Select it and then move your mouse to the "Tools" menu and select "Execute Shell Command..." item.

      A dialog box should appear. Click at the start of the text box and type 'Q ' (Capital Q + tap space bar). It should look like this:

       		Q './hello.cpp'

      A window will open and you can watch 'Q' compile the program and then execute it.

      Click the [Close] button in the window where it runs.

      Shortly the compiled program -- the executable will appear in your cs201/lab01 window.


        I know this all seems a little like magic: "Swish and Flick" + "Wingardium Levioser".... It is enough for you to learn to do it, and figure out how it works later.

      Changing the hello.cpp program

      If you double click a file like 'hello.cpp' you can change it using a simple editor. Change the word 'World' to be your name and save the program. You can now use the Tools menu to execute
        	Q './hello.cpp'
      and your program should greet you by name.

      A more complex C++ Program -- Wall Paper

      Here is a more complex C++ program. It prints out a pretty pattern. You can download it here: [ wallpapr.cpp ] and then compile and run it using Q. Enjoy.

      If you like math or are brave, you can open up the program and look at it. You can also, if you don't mind surprises, edit your 'wallpapr.cpp' program and see what it does. If things go wrong you can always download the original version.

      Get Credit

      If you get this far before the end of the lab session you have earned an A.

      If you have time....

      You can now experiment further with our systems and with the programs you have downloaded. There are many interesting things to discover! The "Start" Menu has a large number of things -- and most of them are safe to use. You can also access stuff on the WWW -- including your EMail.

      Logging Out

      NEVER leave a machine without logging out.

      Use a right click on the desk top... and then select the "Logout" button in the dialog that pops up.

    . . . . . . . . . ( end of section CS201 Laboratory 1 -- UNIX and X Windows) <<Contents | End>>

    Abreviations

  1. Gnu::="Gnu's Not Unix", a long running open source project that supplies a very popular C++ compiler.
  2. TBA::="To Be Announced", something I have to do.
  3. TBD::="To Be Done", something you have to do.

End