Orientation to the Lab

Before embarking on your first lab assignment, there are some preliminaries you must learn (in addition to the basic Web and Windows skills that got you to this page): lab use policies, how our labs are set up, how to log into the ICS computer network, how our printing system (PayPrint) works, how to read and post to news groups from our lab, and, importantly, the basics of entering, compiling and running Java programs.

So, this rather lengthy orientation helps you master these preliminaries. We’ve put together a series of pseudo-lab exercises that let you (with your partner, if you’ve formed a team already) practice and apply the material as it is presented. Read all of this orientation section; practice the parts that are new to (either of) you, or for which you need review; do the activities needed for the class (e.g., activating your computer accounts) you’ve not yet done.

Pay attention to the details given here, as common computing tools or activities are often somewhat different in lab than, say, on your home computer. For example: Many of you know how to use Thunderbird or Microsoft Outlook to process email. But, since lab machines are shared, we don’t use these tools; we instead have you connect to your UCInetID account through the Web using a tool called WebMail. So though you may know how to do email, you may not know how to do it from lab.


Read the Computer Policy and Academic Honesty Documents

Each of you must read a few documents stored on the Web that address ethical use of computing resources and academic honesty issues. (You may also be asked to read some of these documents in the course of activating computer accounts.) We require you to read these documents because, unfortunately, a few students in the past have abused their computer privileges or acted dishonestly and claimed ignorance of the wrongness of their actions. Do note that remaining or enrolling in this course binds you to abiding by these rules.

These documents cover several important policies about academic honesty that apply to you.


Activate your UCInetID and ICS Windows Accounts

If you have not yet activated your UCInetID, go to the UCInetID Activation page, click on Faculty, Staff and Students and follow the instructions. Be sure to have your student ID and social security number handy; you’ll need them to complete the activation process.

If you are already enrolled in the course, or a major in the Bren School, the School has already created your ICS account. If you are waiting to add the class (and are not a Bren School major), your account will be created a day or two after you enroll. You need to activate your ICS account to use it: Go to ICS 364; bring your UCI student ID card with you. Find the lab attendant and ask her or him to activate your account. Your ID will be verified; you then take an on-the-computer quiz about the rules regarding use of ICS computer resources and provide a password. Your account is now ready for use. For details on activating ICS accounts, see the Account Activation Web page.

While you are waiting to add the class, you can use our “guest account”:

Login: ics-temp
Password: Anteat3r

Obviously, the account is public, so don’t store any personal information or work there (copy it to a memory stick or elsewhere and delete it from the hard drive right before you log out).

The guest account is typically locked about week three of the quarter, so be sure to activate your own account by then.

Your ICS account also provides you access to a Unix account that has the same login name and password. We won’t log on to the Unix account in this class, but if you use your “H drive,” you’ll actually be using the disk storage that comes with this account.

Revision history for this section:

Moved from the Course Reference and slightly revised to fit this context, by Norman Jacobson, September 2009.
Minor revisions for clarity, by Norman Jacobson, August 2010.

About the ICS Lab Computers and Network

It’s possible some particulars of the network will change after this lab manual has been printed; we’ll announce any changes that materially affect the instructions given here. That said...

Each first-floor ICS lab room has from 30 to 45 workstations or clients forming a local area network (or LAN); Windows 7 Professional is the operating system for each station. Each machine is an IBM-PC compatible that has more than enough horsepower for the work we will be doing in this class. There are also shared printers and several shared disk drives (called file servers). Each LAN connects to other LANs thoughout the ICS buildings and, through various mechanisms, to other computer networks and the Internet.

Some machine have a diskette drive that accepts 3-1/2" diskettes in IBM format only. All have a CD-ROM drive that can read both “computer” and music CDs, and USB ports that can accept memory sticks and portable hard drives, among other devices. Each machine also has a large local hard disk, where we store software for your use and where you can temporarily store your pair’s work—once you leave lab, you must remove all your work (and only your work, nothing else) from the hard drive; more on this below.

Through your station you can also access the class file server and use the shared printers.

A word about rocking out while you compute: Yes, it’s true: You can bring your own music into the lab, on iPods or MP3 players or whatever, and listen to it while you compute—as long as you listen through headphones or earbuds and otherwise do not disturb your neighbors. We’re amazed how loud some of you play music. Loud music can permanently damage your hearing, and can be heard throughout the lab, even if you wear headphones. So, keep the volume down. If you do not, we may forbid you from listening to music (or anything else) in the lab. (See the ICS Instructional Lab Rules for more on this matter.)

During lab exams, you may not listen to music, or anything else, via an electronic device: What you are listening to might be material to which you are not supposed to have access during an exam.


Logging In, and Logging Off, the ICS Network

Logging on: Unlike some other local area networks, Windows requires you to log on to the network with a user name and password, even if you don’t plan to use network resources.

When you sit down at a lab station, it could be in a number of states, depending on whether the last use of the machine logged off (properly) or shut the machine down, or whether the computer has entered a power-saving (sleep) state. So, Help Cener staff will instruct students in how to log in from various states as part of the first days' orientation to lab and the class. Of course, do ask questions as needed!

About your password: You will want to change your password whenever you think it has been compromised. To do so, hold down Ctrl and Alt and hit Delete. A dialog box will appear; choose Change a Password…, fill in the old password and new password (twice) as prompted, and then press Enter to make the change. If your password change is accepted, you’ll get a message to that effect; if it was not successful, you’ll be told that as well; read the message, dismiss it, and try changing your password again. Keep at it until you enter an accepted password.

Remember your password! No one can look up your password–it’s encrypted. So, if you forget your password, you will have to send electronic mail to helpdesk@ics.uci.edu to request that it be set to a new one (that you’ve given in the message), wait a day or two for the change to occur, and then log in and change your password so that (again) no one knows what it is.

When you are done using the computer:


Printing

We do not require printouts of any kind in this class, but you may find you wish to print some of the course materials, such as all or part of the Lab Manual, for easier reference. (After all, you don’t have to have a computer handy to read printed materials.)

ICS and OIT computer labs use the PayPrint system to provide printing services. Instructions for using PayPrint in ICS labs is at Printing in the Labs; the PayPrint system in OIT labs works the same way. Note you have to purchase a PayPrint card to use this facility.

Since the PayPrint system provides you access to printers in labs across campus, be sure to print to the station you intend, so that your output will go where you expect. (Otherwise, you might be taking a very long walk to get your output!) It’s usually best to send your printout to a station in the room you’re in.


Additional Lab Pointers, Tips and Cautions


Newsgroups

One feature of the Internet is its electronic newsgroups. There are thousands of them. Each is a repository of related information of interest to a group of people. Since each has an Internet address, one can post messages to a news group by sending email to it (although there are easier ways). Reading a news group requires the use of a news reader, which lets you read news groups, write messages to them, make a copy of postings to your printer or disk, and follow threads, messages that are linked because they are responses to the same initial message.

Acessing newgroups is most easily done via the Internet. In particular, Google has made a major effort to store and allow access to virtually all Usenet newsgroup postings from 1981 to the present; Usenet is the major public newgroup respository. Google Groups allows you to search these newsgroups the same way you search the Web; see Group’s Getting Started Web page to, well, get started!

Of course, there are other ways to access news groups and you can access news groups using any tool you like. But whatever tool you use, be sure you know at minimum how to read newsgroups; it is a basic Internet skill.

Etiquette: There are several conventions and an etiquette to using the Net, especially when sending messages, be they to news groups or people—so much of what applies to newsgroups also applies to email messages.

The most famous news group etiquette document is Usenet Organization and Etiquette, part of a manual for an old news reader called NewsWatcher. Read the organization section to get a good feel for how news groups are organized and for their history and traditions. Then, read the etiquette section; following its suggestions will make your news group and email experience much more pleasant.

Revision history for all sections except "Activate..." to this point:

Written for ICS 80 by Norman Jacobson, December 1996.
Revised for ICS 1A by Norman Jacobson, September 1997.
Minor revisions for ICS 1P by Norman Jacobson, December 1997.
Minor revisions for ICS 1A by Norman Jacobson, April 1998 and August 1999.
Minor revisions for ICS 21 by Norman Jacobson, September 1999, December 1999, March 2000, June 2000 & September 2000.
Revised for ICS 10A by Norman Jacobson, December 2000.
Minor revisions for ICS21 by Norman Jacobson, September 2001.
Revised by Norman Jacobson to reflect the change to Windows 2000, December, 2001
Revised and reorganized by Norman Jacobson to reflect the introduction of the ICS Lab Primer booklet, August 2002.
Revised to reflect use of IE intead of Netscape, by Norman Jacobson, September 2003.
Minor revision by Norman Jacobson, December 2004.
Web links updated by Norman Jacobson, June 2005.
Revised to reflect pair programming, by Norman Jacobson, September 2006.
Web links updated by Norman Jacobson, December 2006.
Minor revisions by Norman Jacobson, September 2007.
Updated to reflect using Google groups to access news groups, and other minor updates, by Norman Jacobson, September 2008.
Minor revisions by Norman Jacobson, September 2009.
Revised to make explicit that listening to PDA-generated sounds is not permitted during a lab exam and minor revisions for clarity to the newsgroup etiquette section, by Norman Jacobson, December 2009.

Remote Computing

Doing work on one computer by connecting to it via another computer is called remote computing. In lab, there is a remote computing tool called SecureCRT; we use it to enable you connect to your UCInetID account from the lab, so you can use a tool called Pine to access your electronic mail.

You can also connect to the UCInetID machines from any of the NACS labs on campus, and from any off-campus computer with the appropriate communications hardware and software. Here, we tell you how to access the UCInetID machines from our lab; you’re own your own to learn what you need to do to access those machines from other locations.

Pairs should not share UCInetID access; each member should use her or his own account.

To use your UCInetID from the lab, open the Start menu and select All Progams then SecureCRT, then (on the submenu that appears) SecureCRT (again). A window will appear; in front of that window will appear the Connect window, which lists the computers accessible from the lab will come forward; select Ea.uci.edu and click on Connect.

Now a New Host Key warning may appear. If it does, click on Accept & Save. Now a dialog box will come up asking you for your user name; enter it. Do not check the Remember my username box! Then a dialog box asking for your password will come up; enter your password. Do not check the Remember my password box! (If you check these boxes, the next user at this machine could have access to your UCInetID account.) The dialog box will disappear, and the screen behind it will announce that you are connected to the UCInetID computer. You are now logged in to the UCI system.

When you’re done, type logout to leave the system, then select Exit from the File menu to leave SecureCRT.

(SecureCRT also has several other features; feel free to explore. You can find help with SecureCRT by clicking on SecureCRT ‘s Help menu.)

Revision history for this section:

Written by Norman Jacobson, Winter 1995.
Revised for ICS 21 by Norman Jacobson, September 1995.
Revised for ICS 1A by Norman Jacobson, December 1995.
Rewritten for ICS 1P by Norman Jacobson, December 1996. Thanks to David Kay for some passages.
Rewritten for the new ICS 1A lab (NT network) and to combine this Web lab with a previously separate email exercise, by Norman Jacobson, September 1997.
Minor revisions by Norman Jacobson, December 1997 and April 1998.
Revised by Norman Jacobson to reflect the new printing system & other changes in the NT labs, September 1998.
Revised by Norman Jacobson to reflect updated software and web pages, August 1999
Revised and integrated into the Orientation to Lab section by Norman Jacobson for ICS 21, September 1999.
Revised to reflect new versions of Netscape and SecureCRT by Norman Jacobson for ICS21, April, 2000.
Information moved to other sections to accommodate account creation changes, by Norman Jacobson, September 2000.
Minor revisions by Norman Jacobson, December 2000.
Revised for the Web by Norman Jacobson, August 2002.
Minor revisions to reflect using SecureCRT 4.0 and Windows XP by Norman Jacobson, September 2003.
Minor revisions to reflect pair programming by Norman Jacobson, September 2006
Minor revisions by Norman Jacobson, September 2007.
Email made its own section (following) to reflect use of NACS WebMail, and other minor updates, by Norman Jacobson, September 2008.

Email

The easiest way to access your UCI email from lab is via a Web interface called WebMail. Just go to the Webmail page, log in with your UCInetID and password, and your mail appears; it allows you to read, write, delete and search for messages, among other functions. To learn how to use it, just click on the Help link near the top center of the main mail page, then the Table of Contents link in the window that appears. That page will take you to WebMail’s user documentation.

Revision history for this section:

Written by Norman Jacobson, September 2008.
Section on chat removed, as no one used it last quarter to get help,
  by Norman Jacobson, December 2009.

Using Eclipse

What's Eclipse?

Eclipse is an integrated development environment (IDE), which combines the tools a programmer typically uses to create a large, complex programming project. It combines into one application a text editor (so you can enter your program), a compiler (to translate programs from Java to “byte code”), a virtual machine (that executes the byte code and thus runs the program), and a number of additional tools. Eclipse was not designed for educational purposes; it’s an industrial-strength tool that is much more complex and full-featured than we’ll need in this course. However, it has many benefits for an educational context:

When using a large, complex tool for the first time, the tricky part is not allowing yourself to become lost in all of the details and options that it presents to you. It turns out that you don’t have to know very much about Eclipse to use it effectively for this course; this lab assignment should equip you with most of the knowledge of Eclipse you’ll need for the duration of the quarter. If a new Eclipse skill is needed for a lab, we’ll explain it in the lab’s write-up.

The following is a screenshot of Eclipse in action:

Eclipse screenshot

The window is separated into a few major areas:

The purpose of a workspace

One of the helpful features of Eclipse is how it helps you to organize your work, whether you are working on one project or many. It also gives you the ability to tweak a wide variety of settings, such as the version of Java to use to compile your programs, the fonts and colors displayed in the editor, the style of the code that Eclipse generates for you, and so on. A workspace is the repository for all of the files that make up your projects and all of your settings.

A workspace is stored on your hard drive within a single folder. When you start Eclipse, you select the workspace (the folder) that you’d like to use. I suggest using a single workspace for all of your work this quarter, as it will give you easy access to all of your previous work, as well as maintain your settings from one project to the next.

Downloading and installing the workspace for this course

Eclipse provides a large set of options that allow you to configure it. When you’re using it for the first time, though, it’s hard to know which options to change and to what you should change them. Unfortunately, the default settings aren’t entirely appropriate for us in this course. Additionally, personal preferences tend to differ, which can sometimes make it difficult for a pair to work together productively.

To keep things straightforward, we’ll all use the same initial workspace. We’ve created an empty workspace, with the approriate settings—settings that will match the settings used by course staff when grading your lab exams. This workspace is available at

The workspace is provided in zip format; to use it, unzip it to a folder in a place you’ll be able to find again. A good place to put it when working in the ICS labs is on your H: drive, so that it will be available to you regardless of which machine you’re logged into, as well as permanently stored (remember, files stored to the C: drive can be erased). For example, you might put your workspace into a folder named H:\21Workspace. You might also want to store your workspace on a USB memory stick or other portable media, thus having a backup in case you lose the original.

(Note to Mac users who intend to use Eclipse on their own machines: the zip archive may appear empty, because it only contains a folder called .metadata. Files and folders whose names begin with a “.” are hidden in Mac OS X by default. Go ahead and unzip the archive as discussed above; all will be well.)

Starting Eclipse

To run Eclipse in the ICS labs, click the shortcut titled Eclipse.

(Note that, in Windows, if you launch Eclipsec instead of Eclipse, Eclipse will start up but with a Windows console window also opened. Things still ought to work, but it’s best is to just exit and launch Eclipse.)

When you first start Eclipse, it will ask you what workspace you want to use. Rather than accepting the default, type in the complete path to the folder containing the workspace you downloaded and set up in the previous section (e.g., H:\21Workspace), or use the Browse... button to navigate to this workspace. This will cause Eclipse to start with the course-standard workspace loaded.

(It’s possible that you will not have been given a chance to specify what workspace you want; it will sometimes be the case that Eclipse has been previously configured on the lab machine by another student so that it won’t ask. If you're not asked, but Eclipse instead starts up, go to the File menu and select Switch Workspace... and then Other..., then choose your workspace.)

Creating a new project

When you first start Eclipse in your new workspace, you’ll find that there is nothing listed in Package Explorer. In order to proceed with this assignment (and subsequent programming assignments), you’ll need to first create a new project within your workspace, which will contain all of the .java files (and sometimes other files) that make up your program.

To create a new project, go to the File menu, select New, then Java Project. You’ll now be presented with a dialog that asks you to name your project, and also make some other choices.

Once you’ve made these selections, click Finish.

You should see a folder called Lab0 listed in the Package Explorer. This folder represents your new project.

Importing Java code into a project

To give you practice in using workspaces and projects, here is a short program that plays the "guess a number" game, where the computer chooses a number at random, then asks the user to guess what it is, providing hints along the way. The program consists of the following three files:

To begin with, save these three files somewhere on your machine’s hard drive, but not within your Eclipse workspace.

The next step is to import the code into the Lab0 project in your workspace. This turns out to be relatively simple to do. Remember that, when you started Eclipse, you selected the folder that contains your workspace (e.g., H:\21Workspace). A workspace is entirely self-contained within that folder, including all of your settings and preferences, as well as all the projects you’ve placed in it. Navigate to the place where you stored your workspace (if you need help with navaigating to a folder, ask a TA or tutor for assistance) and open it.

Notice that, within your workspace folder, there is a folder called Lab0. This corresponds to the Lab0 project that you created earlier. (There is also a folder called .metadata, which contains all of your preferences and settings.) Within the Lab0 folder, you’ll find a folder called src. The src folder is intended to contain your .java files. (There is also a bin folder, which is intended to contain the compiled versions of your .java files, called .class files.)

Find the three .java files that you downloaded and drag them into the src folder inside of the Lab0 folder within your workspace. Then, in Eclipse, go to the Package Explorer, right-click on the Lab0 project, and select Refresh from the menu. The three .java files are now part of your project! (If you click on the "+" boxes next to Lab0, you can see that folder's contents. Click on "+" next to src and then next to default package, and you should see the three java files.)

Running a Java program from within Eclipse

A Java program is executed by specifying its “main class,” the class that contains a special method called main, the method where execution of a Java program starts. (We’ll talk about main in lecture.)

In the case of this program, the main class is GuessNumberUserInterface, which is stored in the file GuessNumberUserInterface.java. To execute the program, then, we can right-click GuessNumberUserInterface.java in Package Explorer, then select Run As..., then Java Application.

This program performs all of its input and output via Eclipse’ console window, but it’s not obvious where the console winsow is located. Look at the area of the Eclipse window where the Problems (error messages, warnings) are listed. In this same area, you’ll see a tab marked Console; click it. There's your console!

The Console tab gives you a valuable clue about whether a program is still running or has completed. For example, consider the following screenshot:

Notice the red, square-shaped button to the right of the JUnit tab; this button can be used to stop a running program. It can also tell you whether a program is still running, because it will only be active if the program is still in progress. When a program has stopped, you’ll find that the square-shaped stop button is no longer active, as in the screenshot below:

It’s generally a good idea to dismiss the console output window when you’re done with it by clicking the dark gray “X,” button next to the stop button within the console area. (Don’t click the X button next to the word Console, though; that’ll get rid of the Console tab from your user interface—and it takes some work to get it back.) If there is more than one console output window within that area, you can click the button with two X's to dismiss all of them. (If you don’t dismiss consoles when you’re done with them, you’ll find sometimes that multiple old versions of your program will still be running, which can be confusing.)

Viewing and editing your program’s source code

You can view your program's source code by double-clicking on the files listed in Package Explorer. Try double-clicking GuessNumberUserInterface.java to see the source code for this part of the program. (You can expand the window by placing the mouse on an edge, changing the cursor to arrows; then drag the mouse.) Don’t worry if you don’t understand how the program works; we haven’t learned anything about Java yet!

You can edit the code roughly as you would in a word processor, even though there are significant ways that editing code is different from editing prose; we’ll cover those differences in lecture as needed.


Revision history for this section:

Substantially the same as the Using Eclipse section of Alex Thronton's Summer 2009 ICS21 Lab manual, used wtih permission. Revised for this context by Norman Jacobson, September 2009.
Revised to reflect new versions of Eclipse (3.6.0) and Java (6.0 Update 21), by Norman Jacobson, September 2010.
Revised to reflect new version of Windows (7 Pro), Eclipse (3.7) and Java (6.0 Update 27), by Norman Jacobson, September 2011.