CSC 241 Lab 1
(Due September 10th, 2003)
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
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 that don't relate
to the course or use colors that make it hard to read on a workstation (i.e. a Purple background is NOT my favorite).
You will first 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:
- You should be on a SunRay in the Snygg's basement lab or
either of the CS labs (Snygg 103, 104).
- Make sure that the right side of the login window identifies the
session type as Common Desktop Environment (CDE). If it doesn't:
- Click the Options button.
- In the menu that pops up, choose sessions.
- Pick Common Desktop Environment, which is the first choice there.
- Login to the workstation. Your Oswego's username/password will work
here. If you are a transfer student, you will need to activate your
Oswego computer account first. You should the following window at the
bottom of the screen:
- Get rid of any other default window that may pop up, such as, the
file manager or the help tutorial by Closeing them from their
File 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 on the arrow button icon above the Desktop
Controls icon. Choose
Desktop_Controls in the menu that pops.
- find and double-click the Window Style Manager icon in
the Desktop Controls window that pops up. A Style Manager
window will pop up along with one of its subwindows:
Style Manager - Window.
- Activate point in window to make active. This allows
you to
move the mouse cursor into a window to activate it, instead of
having
to also click in its header. (You may want to adjust the
others later
on.)
- Activate Allow Primary Windows On Top as well.
- Select OK.
- Close all control windows.
- Select the arrow above the icon , the Following Menu will pull up: . .
- Click on Applications.
- Choose Desktop_Apps.
- Select Terminal from the Applications - Desktop_Apps submenu.
Move the Terminal window to some place on your
screen that you like.
- Close all windows except for the terminal window and the
CDE control bar at the bottom of the screen.
- Select the Exit icon (next to the Four button) 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:
Creating necessary directories
You need to be in your home directory.
- mkdir public-html--You may already have such a directory.
- 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. Highlighting and
clicking the scissor icon on top should accomplish that.
- 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.
- change all occurrences of jdoe
with your account name and all occurrences John Doe with your full 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(control-x,control-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.
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