CS 141 Lab 0 -- Installing Ruby
To be done during class/lab on Monday 8/29
Work in pairs.
With two brains instead of one there is a better chance that at least one of you will remember the
necessary details! First install on one partner's account, then on the other's (yes, you must log out and log back in as the other person, log out is under the Apple icon). This lab assumes you are using Safari on one of the classroom machines, running as a Mac. Start Safari by clicking its icon (looks like a compass).
There are two parts to this lab: 1) Install Ruby on your home directory.
2) Run the program I wrote in class (which is included in the installation).
- Copy the cs141.zip file from Examples Presented in Class (on the class webpage) to the root of your home directory
-- here's how to do that...
- Open your home directory (on the network server)
- Get to the Finder by clicking its icon
all the way to the left, or cmnd-tab and select that icon. You should see your login name in the title bar next to a little house.
- Mount your home directory on the network server
- Click on the red Willamette icon on the right of the dock; the one with the W in the middle.
- It will (might?) open another Finder window with your login name in the title bar next to a little icon with three people on it; this is the root of your
home directory on the network server
- Go to Examples Presented in Class
- click on the dist141.zip file (on the blue link); when you do that it will download to the machine you are sitting at and a down arrow in a
box will appear on the
upper right of the browser window
- click that down arrow, and it will show a folder named cs141 and a magnifying glass to the right
- click and drag that folder into the first empty column in the Finder window with your home network drive (it will show a plus sign) --
if you can't see that window, cmnd-tab to get it on top and move
it so it will show when you switch back to the browser window (or copy (cmnd-c) the folder, then click in the Finder window and paste (cmnd-v))
- That's it!
- You can now run the Ruby program
to accomplish task1_1 (the one I wrote in class) by following these steps:
- Start NetBeans (click the NetBeans icon in the dock; it looks like a cube)
- Close any open projects -- in the Project tab in the left-hand pane, select all then right-click and choose close. Close them all!
otherwise funny things may happen.
- Open the Ruby project
- Start with: File/Open Project
- navigate to /Volumes/jstudent/cs141 -- except your login id instead of jstudent (double-click on folders to open them) -- here's how (btw: this is easy once you know how... like everything!!)
- click the Open parent folder button (the left-most of the three just
below the title bar on the right -- it has a folder with a bent up-arrow on it like this)
until the drop-down menu to the left shows as /
-- this is the "root" of the disk on the machine you are sitting at
- double-click Volumes (way down at the bottom)
- double-click your login id (then you will be attached to your network drive)
- double-click cs141
- double-click the folder named ruby whose icon has a coffee cup, this shows it is a NetBeans project
- dismiss (i.e. close) the error panel if it pops up (after clicking the Do not show this message again box, please)
- The ruby project should now be under the Projects tab, way over on the left. To see the files in it, click the little arrowhead (or delta, or whatever it is!)
on the left of ruby,
then the little arrow by Source Packages, then the little arrow
next to ruby, then double-click Program.java to open the code you will modify.
- If you have closed all the other projects, Ruby is now the main project -- NetBeans displays the name of the main project
in bold; when you press F6 it runs the main project... so if something else is bolded, right-click Ruby and select Set As Main Project
- Press F6 to start up the Ruby simulator. If everything has gone right, you should see
the starting situation for task1_1 on the left, the program that will try to accomplish that task on the
right, and the status windows down below
- If you see a Resolve Problems alert (and you will!) click the "Do not show this again" box, and dismiss the alert.
- Press start, and then Step a few times to see how it works; the program there is incomplete, so it will fail.
When it fails, dismiss the Intent Error Dialog, close the window with the program (with "display only, you can't edit this!" in the title bar), and
correct the program in Program.java (Program.java is in ruby, under Source Packages -- double click to open). Then press F6 to run it (or the green "play" icon in the toolbar if you prefer the mouse).
Make sure there's no red errors on the screen first!
- When the simulator comes up, press Start, then Step repeatedly to watch Ruby collect the coin and take it home (look in
the status window after each step to see the values updated)
- If it says "Success!" when Ruby halts, everything worked and you are ready to program Ruby yourself.