spring 2005
homework assignment #1
due tue mar 1, by 6AM (electronic submission)

HW #1 notes (added 22-feb-2005)
1. when referencing URLs (as images or action locations in forms), please make sure you use LOCAL references (i.e., not fully qualified paths, but just the file names assuming everything is in the same directory).
2. your code that processes the movies.dat file should be able to accommodate comments -- lines where the first character is an # (your code can just skip over such lines.)

project overview.

During the semester, we will be building a movies database, complete with reviews contributed by everyone in the class. The system will maintain an inventory of movie titles and cast, plus links to trailers, soundtrack albums, news articles and reviews by class members. Registered users of the system (i.e., class members only) will be able to add movies to the database and enter reviews. Unregistered users can view database contents, but cannot add anything or enter reviews. Each of you will be creating your own interface to the shared database.

The four homework assignments will be broken down as follows:

to be written in perl; will read the database (text file) of movie titles and display them in a friendly web page
out mon feb 14; due tue mar 1; 10 points
to be written in C; will contain a login for registered users and will allow users to enter reviews of movies in the database
out tue mar 1; due tue mar 22; 10 points
to be written in C; will provide a mechanism for registered users to add movies to the database
out tue mar 22; due tue apr 14; 10 points
to be written in C++; will provide a search engine for movie titles, cast members, directors and review ratings
out tue apr 14; due tue may 3; 10 points

Note that every homework will include a documentation portion.


assignment description.

This homework assignment is the first part of your four-part homework project. As above, this hw1 will be written in perl and will implement a simple web page that reads a database of movie titles and displays information about the movies.

This assignment is worth 10 points. Distribution of points is indicated below.


I. README. (0 points)

Create a file named README and put any explanatory information about your assignment in this file. For example, things that you didn't have time to finish; problems that you know exist with the site; cool and interesting things you did that you want to make sure the graders take notice of...
This part is not worth any points, but will be very helpful to the graders in case your assignment has any ... unique and interesting "features", and will help put them in a good mood when they are grading your work.


II. movies data file. (1 point)

The movies data is stored in a formatted data file. The file is organized into a series of "records". Each record contains a number of "fields". Note that the exact number of fields varies from one record to another. The fields are all in the format: name = value. The field names can be any of the following:

As noted, not all of the fields are required. In fact, only the unique identifier (see below) and the title are required fields. For the cast and director, there can be more than one field name/value within a record (e.g., there are usually multiple "cast" fields). The remaining fields can be empty or there can be one value for each of them.
An example is in: movies.dat. (In case you're curious, the format is based on the BibTex format.) The record separator is the @ character followed by a unique identifier, followed by field name/value pairs, all contained within curly brackets ({ and }). Each field begins with the field name, followed by an equals sign (=), followed by the field value. If the field value is more than one word long, the value is surrounded by double quotes ("). The field separator is the comma (,).
Note that the unique identifier is your UNI (CS username) followed by a hyphen (-) followed by a number (1-4).
For this part of the assignment, you need to create your own movies.dat file which contains 5 entries, EXACTLY following the format specified above. The links to images should be LOCAL. The links to trailers should be ABSOLUTE URL's (i.e., fully qualified URLs beginning with http).


III. movies home page (0.5 points)

Create a home page for your interface to the movies database, named index.html. This should be written in html. It should contain the following links:

Use your imagination and creativity! This should not be just a boring text page with text links!


IV. about page (0.5 points)

Create an "about" page for your interface to the movies database, named about.html. This must contain:

Again, be creative!


V. list movies page (8 points total)

Write a perl script called list.cgi that will parse the movies.dat file and display its contents in a FRIENDLY and USEFUL manner. Read the data file and process it line by line, parsing it into records, i.e., movies, using the functions you've created, as described below.
(1 point)

The script must contain the following subroutines:

Hint: Fill a hash with each of the fields for which you can have no more than one value. Fill an array for each of the fields for which you can have more than one value. You can use this hash and these arrays as global variables (i.e., and access them from within the displayMovie() function, without having to pass them as arguments)...


VI. submit.

Just like with the labs, you need to submit your homework electronically. Make sure that you have followed the file naming specifications listed above (case included!) Failure to follow do so will result in 10% off the assignment grade -- ouch!

You need to submit: README, index.html, about.html, list.cgi, your version of movies.dat, and any image files that your movies.dat file references locally.