CSC 171
Homework assignment 1

Fall, 1998

In class:

Web browsing and directory structure

Visit the class page and follow a couple of links from it to familiarize yourself with using a Web browser. Follow the link to the downloads directory, and you'll see a list of the names of files in that directory. Your first task is to find, somewhere inside this directory, a secret message (you'll know it when you find it); in the process, you'll get practice with sub-directories, parent directories, etc.

Viewing and saving HTML files from the Web

Your second task is to get an HTML file from the Web and make it your own. Visit my "boilerplate" Web page with a Web browser. Notice how it looks on the screen: there should be indentations, different colors, different styles of text, etc. Now, from the "View" menu, select "Document Source" to see the HTML file as it was originally written. You should see the same text as before, but with a bunch of HTML commands (in <angle-brackets>) mixed in. These HTML commands tell the browser how to display various parts of the page, and you'll need to learn to use such commands. Notice also that many of them come in pairs: etc. Each pair begins with a special word inside <angle-brackets> and ends with that same word in angle-brackets, only preceded with a slash. All the text in between is affected by the command: etc. Notice also that these commands are nested: if you start one command and then another, you must end the second one before you end the first one. For example,
 <head> <title> This is the title </title> </head>
 
would be legal, but
 <head> <title> This is the title </head> </title>
 
would not.

OK, enough of viewing the document source. Close the "source" window, so that you're looking at the pretty, multi-colored rendition of the Web page again. Now, from the "File" menu, choose the "Save As..." command to save a copy of this Web page on your own computer.

Your own computer, just like my Web site, is made up of directories (also known as "folders"), sub-directories, and files; you'll need to move around among these directories to find a suitable place to put your copy of the boilerplate Web page before you can start changing it. We'll discuss exactly how to do this in class; however, I want you to find the C: drive, then the "users" folder within it, create a new folder within it labelled with your own name, and save the boilerplate Web page into this new folder.

Now you have your own copy of my boilerplate Web page on your own computer. This means that you can look at it even if your Net connection fails, or if panther fails, etc. Use the "open" command in your Web browser, navigate through the folders and sub-folders to where you saved the boilerplate page, and open it. It should look the same way it did before, but perhaps appear a little faster because it doesn't need to be retrieved over the Net.

Modifying a Web page

More interestingly, you can now modify your own copy of my boilerplate Web page. There are several ways to do this. The easiest (but least flexible) way is to press the "Edit" button near the top of the screen in Netscape, and the browser will allow you to insert, delete, and modify various parts of the Web page. We'll discuss more details of this in class. The somewhat less friendly, but more flexible, way to modify an existing Web page is to edit the HTML "source code" with a text editor. The text editor we'll be using for the rest of the semester is the one built into CodeWarrior, so let's start getting some practice with it.

You'll need to start CodeWarrior from the "Start" menu at the bottom of the screen. It'll take a few seconds, but eventually you should see a new menu bar labelled "Metrowerks Code Warrior" at the top of the screen. From the "File" menu, choose the "Open" command, navigate through the folders and sub-folders to your copy of the boilerplate Web page, and open it. You'll see pretty much the same thing you saw when you used the "View Document Source" command in the browser. But now you can change things just by pointing at a particular place on the screen, clicking your mouse button, and typing. Again, there are lots of details which we'll discuss in class. But your ultimate goal is to change the Web page into a personal Web page about yourself.

To be turned in:

A personal Web page

Modify the boilerplate.html file into a personal Web page about yourself. Give it an appropriate title and appropriate section headers. Include a paragraph or two about yourself, at least three different styles of text, and at least three links to other interesting sites on the World Wide Web. Next week, as soon as your panther accounts are set up, you can upload this page to your panther account so that it's available to people around the world on the Web. In the meanwhile, as soon as you're happy with it (and you can check how the page really looks by opening it with a Web browser), send it to Dr. Bloch by electronic mail.

A Web page that runs a program

So far we've been using HTML only to control the formatting of text and links among different Web pages. It can also be used for pictures and sound, but what we're really interested in now is that it can be used to run a program every time somebody visits the Web page. For an example of this, visit the Coalesce Continuous page and see what the applet does. Use the File menu selection "View Document Source" to see the HTML code (most of which we're not interested in). Using CodeWarrior, open the boilerplate file and "Save A Copy As" coalesce.html. Back in the "View Document Source" window, select everything from <applet> to </applet>, copy and paste it into the coalesce.html file on your own machine. (Do not use the code labelled "HTML:" that appears on the Web page itself, as that's not necessarily what the Web page actually uses.)

Now that the HTML file is saved on your own machine, you'd like to be able to modify it and view your own version. However, the HTML file's main purpose in life is to run a Java applet, which used to be "right next door" and now isn't even on the same computer, in the same state. If you try to view coalesce.html now, you'll get an error message saying "Applet can't start: class CoalesceContinuous not found". So you'll need to modify the HTML file. Look for the line that says

 codebase="../AllClasses"
 
As you've seen in exploring the "downloads" folder, ".." often means "the folder containing this one". So coalesce.html expects to find its Java applet by starting at the folder containing coalesce.html, moving up to the folder containing that folder, and then moving down to another folder named "AllClasses". Since coalesce.html used to be in the folder named http://www.vivids.com/ij2/assorted, moving up to the containing folder would take us to http://www.vivids.com/ij2, and then moving down to "AllClasses" would take us to http://www.vivids.com/ij2/AllClasses. So we'll skip all this, and simply tell coalesce.html to look for its Java applet in http://www.vivids.com/ij2/AllClasses. You can do this by opening coalesce.html with CodeWarrior's editor and replacing "../AllClasses" with "http://www.vivids.com/ij2/AllClasses". Now you should be able to view the page on your local machine.

Changing parameters to the program

Notice the lines in coalesce.html that start with <param name=. Each of these specifies a parameter, which is how an HTML file sends information to the Java applet it runs. (More generally, whenever one "entity" inside a computer asks another entity to perform a service, it sends specific information about what it needs done in parameters.) If you get tired of the Shelley quotation, you can replace it with one of your own. The parameter "TextCount" tells the Java applet how many lines of text there are, and the parameters "text1", "text2", etc. provide the specific text. You can also change the background color of the applet, how fast it runs, what font it uses, etc. by changing other parameters. Experiment with this, and send me the modified HTML file by email, together with comments on how it behaved when you changed various parameters.
Last modified: Fri Aug 28 13:42:24 EDT 1998
Stephen Bloch / sbloch@boethius.adelphi.edu