CSCI399
Autumn Session, 2009
Actually, it's the same assignment as 2008 because the 2008 class seemed to enjoy this one.
Assignment 1: Web basics and Apache
You should complete exercise 1 before atempting this assignment.
This assignment aims firstly to introduce you to the basics of creating a web of documents for which you compose the HTML and Javascript, then to provide some limited experience in the basics of web programing with CGI (using C/C++), and finally to perform some minor Apache administration tasks such as setting controls on directories.
The assignment should be completed in the laboratory using the Ubuntu (Linux) environment. The necessary software has been installed on the laboratory machines and the Apache server that you are to use has been configured as required.
Such software can be downloaded from the Internet and installed on your own Linux or Windows machine. Installation and configuration of such software is NOT part of the assessment. The installation and correct configuration of the software is likely to prove time consuming. You may use your own machine, but the extra work entailed should not be considered a part of the work done for this subject.
The objectives are for you to:
Resources
The Ubuntu machines have a Zend/Oracle Apache installation. (The correct configuration of an Apache/PHP/Oracle-client system is time consuming! Zend corporation, the professional PHP company, has a downloadable pre-configured system.) CSCI399 will be using this installation for assignments 1..3 (the web basics assignment, the Perl assignment, and the PHP assignment). Each Ubuntu machine runs its own copy of Apache.
The Zend/Oracle Apache system will allow access to the CSCI Oracle server that runs on the "wraith" machine. CSCI is the main Oracle server for undergraduate CS assignments, all students enrolled in CSCI399 will have accounts on this Oracle server. Your database username, and initial database password, are usually the same as your Unix login identifier. You will receive email from "yuan" (the database administrator) confirming the existence of your Oracle account and password. Standard Oracle client software has also been installed on the Ubuntu machines, so you will be able to use the sqlplus program for basic database adminstration tasks.
The Apache configuration was created for ease of use in this assignment and does not represent a good example of a secure system! It is configured to allow the use of "user directories" - i.e. each of you can have a public_html directory in your home directory. Your files should be placed in your public_html directory or subdirectories (see later for some specific directory arrangments).
The Apache runs as user "nobody". This creates a problem in relation to the CGI program. Your CGI program will be launched by the web server and so will also run as user "nobody". Unfortunately, your CGI program will need to update a data file (using a database from C++ is simply too painful). Your data file, and the directory it is in, will both need to permit "write" access by others. Such "write" access is dangerous (if someone in the class doesn't like you, he/she can scribble all over your files). You should be careful to enable write access to the appropriate file and directory only for the time that you are actually testing your CGI program; remove the "write" permissions as soon as you have run your tests.
The following support materials are available:
Those who have not had any practical experience with Web technologies should checkout the WDVL (Web Developers) site. This has numerous tutorials:
It is not common practice to write client-side Javascript from scratch! Instead, you notice a web-site that has an interesting feature - view source - take inspiration from the Javascript code!
In the first part of the assignment (the web part) you are required to make use of Javascript for "enhancing the user experience". My support materials include some simple illustrations of "roll-over" and "pop-up menus". Provided you acknowledge the original source, you can use any other more interesting examples that you may have encountered on the Web.
Your overall task is to write a report detailing how you completed the various subtasks listed below. You will be marked on your report. The report is to be submitted as a PDF file (the /share/cs-pub/399 directory contains a "driver" that you can add to your Windows machine that will let you "print" PDF files from Word or another word processor program; the OpenOffice word processor on the Ubuntu machines has a convert to PDF option.)
For this part of the assignment, you are to create web pages containing HTML markup, content text etc, and where appropriate Javascript code. These pages are to be created using an ordinary text editor. One of the aims of this part is for you to become more familiar with the HTML markup language so that you can later write programs that generate correct HTML markup in dynamic pages.
Your web should be composed of material that you might later wish to post to your "Facebook" or "MySpaces" web site - just the usual vanity press "about me" material. It should be constructed as a number (6..12) relatively small interlinked pages. (It is probably worth skimming the book "Don't Make Me Think" for some general advice on web page design.) For this part of the assignment, you should save your HTML files in your public_html directory, with images in an "images" subdirectory. Javascript code will mostly be short and can be included in the HTML page; however, if you do import a large Javascript script then it might be better if you saved it a "jscripts" subdirectory and use links in the HTML pages.
The material that you develop for this first part will be redeployed in the later stages when you experiment with aspects like Apache's access controls.
You need to use:
The above required elements are all typical of things that you will have in dynamic pages generated by server programs.
Features like "framesets" and "client pull" (attractor pages) are optional - use them if you feel that they enhance your site.
Your report on this part of the assignment should consist of:
The PBase photo site provided the "inspiration" for this CGI exercise. PBase is a site where people publish galleries of photos and receive comments on their work. Some galleries are "pretty" and get comments about their prettiness; others are more concerned with mechanics of lenses, lighting conditions etc. Of course, FaceBook, MySpaces and numerous other social sites have similar facilities for comments by your friends on aspects of your vanity pages.
You will create a static HTML page with:
|
|
The form should "post" the data to a compiled C++ CGI program for action.
Your program should
You will probably find it simplest to base your CGI program on my examples (like the Echo.cgi program provided in the supplementary materials).
Your C++ source code should be stored in some directory other than your public_html directory. You compile your code, along with the CGIHelper class if you choose to use it, and rename the a.out executable as "MyCGI.cgi" (the file extension must be .cgi). You move this .cgi program to your web area.
The Apache system has been configured to permit .cgi executables in "user
directories" and their subdirectories. You can store the .cgi program in
your base public_html directory, but it might be better to use a subdirectory
(by convention named cgi-bin) to keep different files in separate areas.
Your form would reference your cgi program as action="./cgi-bin/MyCGI.cgi".
The file with the table of comments ("Comments.html") should be created initially with simply the HTML markup for the table and its column headers. This file should be placed in a "data" subdirectory of your public_html directory and should created with global write permission; the "data" directory itself must also allow for global writing. It is this file and this directory that represent your greatest security risks; keep the file permissions as normal except when you are testing your CGI code.
Your C/C++ code doesn't have to be careful about freeing memory. Each time it runs it only handles a single set of input data before terminating, so any memory leaks are inconsequential. A CGI setup that uses files can encounter problems with multiple concurrent updates. The approach suggested could lose all records of some updates; but it isn't worth dealing with the vagaries of the use of lock-files etc so the potential problem should be ignored.
Your report for this part should comprise:
Traditionally, CSCI399 involved a lengthy but easy exercise on Apache configuration. But things are just becoming too simple. On Windows - install Apache means double click on a file icon. Most Linux systems these days come with Apache pre-installed and their auto-updaters will get the latest version for you. Then you get organizations like Zend who supply little helper scripts that step you through the install process anyway. It just isn't fun any more.
The Apache exercise for this year is consequently reduced to handling minor aspects such as content negotiation and access control>
The configuration file for the Apache that you are using specifies default options for your public_html directory:
MultiViews Indexes SymLinksIfOwnersMatch IncludesNoExec ExecCGI
and has the language options defined for European languages, Japanese, Korean, and Chinese (traditional and simplified).
But, since the directory specification also defines:
AllowOveride All
You can create .htaccess files in your public_html directory, or in subdirectories, to change options. (The Apache manual, which has details of option settings for things like "Server Side Includes" and "Authentication" should be accesible on your local Apache at "/manual/index.html".)
Complete the following Apache/HTTP exercises.
Prepare a second language version of your web-sites primary Welcome page and reorganize your site so that the version of the page that is returned is appropriate to the browser's language preferences settings.
For this part of your assignment you will need to submit:
The due date for submission will be announced in lectures; provisionally set for April 3rd
You are assessed on a report summarizing your work. This report should be prepared using a word processor and converted to PDF format prior to submission. You have to include several screenshots; screenshots can be obtained on the Ubuntu systems via the "Take Screenshot" accessory in the Applications menu.
For CSCI399, asignments are submitted
electronically via the turnin system. For
this assignment you submit your assignment via the command:
turnin -c csci399 -a 1 A1.pdf
Late submissions would be submitted as:
turnin -c csci399 -a 1late A1.pdf
Remember, turnin only works when you are logged in to the
main banshee undergraduate server machine. Transfer your
report file to banshee using an ftp client. Then login via ssh and
run the turnin program.