Homework 4: Text added on 4/22/2008


Due Date: 5/02/08
Late homeworks will be accepted till 5/06/08 1:00 PM.  After that, 
late homeworks will NOT be accepted for any reason, not even for health 
or accident reasons.

Points: 50

NEW TEXT:  Remember to submit your code by email, as for HWK3.
You should also expect that we will test your program on the Web, possibly
during the time of the class, i.e., in public.
END NEW TEXT.

The purpose of this homework is to create a database with a Web interface.
Basically, you can start with p4, p5b, p6 discussed in class and modify and extend them
as needed.

Our topic is to build a primitive DATING DATABASE with WEB FRONT END using the same people that you 
already have in your database since Homework 1.  

Your table PERSON has to be modified so that it contains the following information:

PERSON:
- Complete Name
- Gender (m or w)
- Birth Year
- Person ID 
- Image link   (The URL of a picture, see below, stored as a varchar2(100)).

The PERSONINTERESTS table does not change.


Your Web frontend has to have

- A MENU letting you choose either a man or a woman
- An entry field MINIMUM AGE
- An entry field MAXIMUM AGE
- A MENU that allows you to select one INTEREST. One choice should be "do not care".
- A SUBMIT Button

A user would enter values into all these fields.
If nobody in the database conforms to these selections, then
an appropriate message should be given.

So....

When clicking on SUBMIT, the system should return all people in your database
with an age between MINIMUM and MAXIMUM (including these two values) which 
are Men or Women, as requested, and who have the one interest selected.
If the interest selected is "do not care" then people should be selected just
by age and gender.  In other words, people with all interests are fine in
this case.

Your program has to be YEAR SAFE.  In other words, you cannot include "2008"
in the code, because it still has to compute the correct ages in 2009, 2010, etc.

It should in a nice and friendly format print all information about each selected
person.  In addition, it should display a picture of each person.  You may use your
own private pictures.  

If you don't have any pictures, I have prepared a few pictures
in the web directory 632/Professors/.  This is the same place where you find the homework.
If you use my pictures, you should link directly to them, instead of copying them to 
your directory.  You need to store the URLs in the last column of your PERSON table.
Example: http://web.njit.edu/~geller/632/Professors/m1.jpg

You can assign pictures to people however you like, except
that a man should look like a man and a woman should look like a woman.

If a user of your system enters an unreasonable age (below 18 or above 100) the system
should give an error message. (Two different error messages.)
If a user enters no age the system should give a third error message (for MINIMUM)
and fourth error message (for MAXIMUM).

[Side note about pictures: I have attempted to store images directly in the table and display
them from there, but I ran into several technical difficulties.  So we do it by
prestoring URLS in the database, as shown in class. ]


*** Make sure your output looks nice and well organized.
*** Use colors, fonts, tables, etc.



Programming Hints (or Warnings).  

- PSP is very fickle with null values.  Never use a null value in a comparison with =.
You need to use "if [column etc.] is null then"

- One PSP procedure may be called directly by name from anywhere in the PL/SQL code
by just writing down its name with a ; after it.

- PSP will continue with the code right after such a PSP procedure call.  If you don't
want it to continue there you need to place a "return;" after the procedure call.
This is important when you create an error message in a separate Web page (procedure).
After sending the error message to the screen, you do NOT want to continue your normal 
program.  So you need to "return out of your normal program."


The business with AFS

Every NJIT CS student has an AFS account.  I believe that the login and password
are the same as for your UCID.  If this is not the case, and you don't have a password,
you need to go to the parking deck help desk and ask for a password reset.

There are two major ways how to get into AFS. 
Either you go to a SUN lab and log in with your AFS username and password.
Or you login from your PC using a program such as ssh, teraterm or (good old) telnet.

In either case, you are now in a window that looks like a DOS window.
You type commands and the system replies.  This is a UNIX window.  (Really, a dialect of
UNIX, but that is not important.)  Commands are different from DOS.

For this assignment, all you need to do is to type in the loadpsp command, as discussed in class.

However, your files need to sit in the same directory where you are typing the command.
How do you get your files there?

If you know ftp, you can "get" the files in this way.
You really should know ftp as an MS CS student!

OR

If you know the email program "pine" you can mail the files to yourself and then 
read pine on AFS and save the files in the AFS directory.

If you don't know any of the above, you will need to learn a few commands
in a UNIX editor.  The simplest one is pico.  I personally prefer vi.
Then you can cut and paste your file into the editor. 

Here is the sequence of how you would do this with vi.

At UNIX prompt>  vi filename.psp
i
Now copy and paste the whole file into this window.
ESCAPE key
ZZ
You are now back to the UNIX prompt.
Now you can do the loadpsp.

Like this:

loadpsp -replace -user yourNewUsername/yourRandomPassword@course.njit.edu filename.psp

NOTE:

If loadpsp does not work for you as above, this could be due to special
characters in your password or username.  In that case, surround them by double
quotes, like this:

loadpsp -replace -user "yourNewUsername"/"yourRandomPassword"@course.njit.edu filename.psp

Then in any on-campus browser type this:

http://prophet:7777/yourNewUsername/filename



THE FOLLOWING APPLIES TO ALL ASSIGNMENTS:


- Create a nice cover page with 
  your name, assignment number, class number and a descriptive
  title of the assignment.
  
  All parts of your assignment need to be stapled 
  together, or held together by a folder.  Points will be taken off
  for not complying with these rules.

  No handwriting anywhere.
  No handwriting anywhere.
  No handwriting anywhere.

  Make things look nice and professional.  

- Documentation:
  Do a reasonable amount of internal documentation.
  Internal documentation typically means that you explain
  your code or SQL statements.
  No external documentation unless I specifically ask for it.

- Test runs:
  Show your table after you build it.  Show testruns.
  Show as much as you can.  The burden of proof is up to you.
  NO TESTRUNS, NO POINTS. 
  (Or very, very few.)  You may record the results in a file.
  Thus, you don't need to do screen dumps.
  You will not be punished for too many test runs.

- Hardcopy:
  All code, documentation, and testruns will be accepted as Hardcopy
  (Printout) ONLY.  No email, No fax etc.

- Grading:
  Grading takes into account correctness of the results, but also
  how well they are documented, and what their visual appearance is.
  Things should look nice and PROFESSIONAL.  Not sloppy.  Use a spelling
  corrector for your comments or (later on) write-ups.  Some people do this
  very nicely.  Don't cut corners here, or you will look bad in comparison.

- Cheating:
  The usual policies apply.  0 points for "suspiciously similar" results.
  Report to the Dean in case of repetition.

- Files:
  You must keep all your files of every assignment up to the end of
  the semester.  If there is any doubt about your assignment I will
  ask you to demonstrate it online.

- Late policy:
  I will take off 10 points for being late up to 1 week.  Programs
  that are handed in more than a week late will receive no credit
  at all, unless you have a good reason with WRITTEN documentation
  (usually medical).