CSC 241 Lab 1
(sec 800: Due September 8, 1999; sec 810: Due September 9, 1999)
HTML & Applets
Theme ...
This lab is designed to get you set up for the web and running applets.
In the process, you will learn to operate effectively in a SUN workstation
environment. You may already have a webpage, or you may not. Either way,
you need to make one for this course. Some of your programming assignments
and labs will have applet front-ends and you will make them accessible
through this webpage. This should help me find your applets quickly when
evaluating them or when helping you find your bugs. My
241 page will be linked to
yours once you complete this lab. Your web page for this course will consist
of a header, title, a little text, and some links. Feel free to add things
to it, but, please don't clutter it with graphics and things that don't relate
to the course.
You will first copy some important files, create some directories, and set
the needed protections to get things started. You will make some
modifications to your Sun workstation environment. The next step is to fire
up netscape and bring up this page. There are several links in this
page that are only meaningful in a web browser. For example, part of the way
into this lab, you will bring up a webpage that you will copy from and paste
into an xemacs window which you will also have open at the time,
effectively,
creating your webpage with a few key strokes. I could have just given you
the template to copy at the start, but, this is a good practice for handling
multiple windows. This lab ends with you copying an applet and making it
accessible from your page. Once you have completed all tasks, you will have
a web page like 241.html.
Set up your workstation environment:
- Login to a Sun workstation (basement of Snygg).
- get rid of default file manager and help tutorial by Closeing them.
- The following steps will save the
current workspace settings and file manager and help tutorials won't load
automatically each time you login to a workstation.
- Login to a Sun workstation (basement of Snygg).
- Get rid of default file manager and help tutorial by
choosing Close from their File pull-down menu.
pull-down menu.
- The following steps will save the current workspace settings and
file manager and help tutorials won't load
automatically each time you log in.
- Click the left mouse button on the icon for the desktop
display . A Style Manager window will pop up.
- Click on the Window button.
- Activate point in window to make active. This allows you to
move the mouse cursor into a window to active it, instead of having
to also click. (You may want to adjust the others later
on.)
- Activate Allow Primary Windows On Top as well.
- Select OK when asked if you want the workstation manager to restart.
- Close the Style Manager.
- Select the arrow above the fourth icon , the Following Menu will pull up: . .
- Choose Applications.
- Select Terminal from the Applications submenu.
Move the Terminal window to some place on your
screen that you like.
- Select the Exit icon (next to the Four icon) to log out.
The next time you log in your screen should look just as you left it.
Follow these steps in order:
Login on a workstation and perform the following UNIX commands in your
Terminal window:
Copy dot-files:
- cp .cshrc old-dot-cshrc
- cp .login old-dot-login
- cp .emacs old-dot-emacs--(don't worry if says `no such file')
- cp .Xdefaults old-dot-Xdefaults--(don't worry if says `no such file')
- cp /csclass/dl/sample-dot-cshrc .cshrc
- cp /csclass/dl/sample-dot-login .login
- cp /csclass/dl/sample-dot-Xdefaults .Xdefaults
- cp /csclass/dl/sample-dot-emacs .emacs
- Then logout and login again. Optionally, later edit any of these files
to include anything in your old versions, or in the various default
versions in /src/etc.
Creating necessary directories
You need to be in your home directory.
- mkdir public-html
- mkdir public-html/classes
- mkdir public-html/classes/csc241
Setting permissions
- chmod og+rx .--don't forget the dot
- chmod og+rx public-html
- chmod og+rx public-html/classes
- chmod og+rx public-html/classes/csc241
Netscape
- In the Terminal window type: netscape &. The "&" is important here
as it starts netscape up as a separate subprocess leaving the Terminal
operating.
- Click Accept when Netscape starts up; if you have started
netscape on a workstation before, you won't have such a button to click.
- Bring up this lab by typing the following URL in the Location text
area:http://www.cs.oswego.edu/~mohammad/241/labs/lab1.html
- Use the scroll-bar on the right of the window to get to this portion of
the document. You shouldn't need the hard copy version from here on.
- For a few quick tips on HTML tags, you can follow the link to
Basic HTML Tags, but return to this page to continue
the lab.
Create 241.html
- get into your public-html directory.
- In the Terminal window, type cd to make sure you are in
your main directory.
- cd public-html
- start xemacs by typing xemacs 241.html &
- We have set up xemacs to work in html-helper mode which starts
you with a prompt for title name and generates a template of an html
file . For the purpose of this lab, you give this page a dummy name
to continue and delete the template that appears.
- In Your netscape window:
- Follow the link to sample.html.
- Starting from the line that has <html>,
highlight the content of that page.
- From the Edit pull-down menu, pick copy.
- Now, move your pointer into your xemacs window and press the Paste
button on your KEYBOARD.
- The only thing that you need to change is all occurrences of jdoe
with your account name.M-x replace-string could come in handy
here. M- implies you hit the Esc key, not hold it
down before you hit x.
- Once your page is completed, save it(cntrl-x,s).
Make your page accessible to others
The following will take place in your Terminal window:
- ls--(you should see "241.html" listed)
- chmod og+rx 241.html
Note: any subsequent files added to public-html or its subdirectories
must also have the permissions changed by using the chmod
command, if you want them to become accessible through the Web.
However, do not change permission on your .java files, if
they are intended for this course.
Testing your page
Type the URL http://www.oswego.edu/~your user name/241.html in the
Location text area of your netscape window. Your page should
load up in all its glory! Return to the lab1 page.
Note: You may come across pages on the Web that have features that you
like. If you want to see how they are implemented, you can use the
Document Source option in the Netscape's View pull-down menu.
This will show the html code generating the page. You can also save a web
page in your account via the Save As ... option available in the
File pull-down menu.
Make an Applet
I am assuming that you are in your public-html directory in your
Terminal window. pwd is the unix command that tells you where you are.
Type each of the following commands:
- cp /csclass/mohammad/public-html/hello1.java . -- don't forget the dot
- cp /csclass/mohammad/public-html/hello1.html . -- don't forget the dot
- javac hello1.java to compile hello1.
- chmod og+rx hello1.html to make the html file accessible.
- chmod og+rx hello1.class to make the .class file accessible.
Simply, go back to your 241 page and click on the hello1
link there. The Applet should load up.
Hand in
email the URL for you 241 page to
mohammad@oswego.edu, it should be
something like this: http://www.oswego.edu/~your_user_name/241.html