The first part of the project demonstrated that web scripts are essentially closures. This part of the project continues the exploration into the connections between concepts in web programs and core concepts in programming languages.
After completing this stage of the assignment, you should be able to:
The project is due October 14 (Sunday) at 11:59pm via turnin (use assignment name project2).
Start with a version of the CGI scripts that does NOT implement the personalization feature. You may use your own version, or you may start with one of the sample solutions (see the "links and hints section" below). Tell us whether you started from your own or a sample solution, and tell us the URL for your version for this assignment.
Enter the name and address on the first page. Bookmark the second page. Start a new browser, visit the bookmarked second page, and try to place an order. What happens and why?
Edit your current set of scripts to save the name and address using cookies.
Using the cookies version, get to the second page and bookmark it. Open a new browser, visit the bookmarked second page, and try to place an order. Does the order come out properly? If not, what goes wrong and why?
On the same computer, open a new browser and go to the first page. Place a new order with a different name and address.
Open a new browser and visit the bookmarked second page that you saved in step 2. Place an order. Does the order come out properly? If not, what goes wrong and why?
Go to http://www.amazon.com. Add an item to your shopping cart (you'll be able to cancel the order without buying it later). Duplicate your amazon window (by doing a "New Window" operation from the file menu). Add a second item to your shopping cart from the new window. Use the back button in the new window to return to the page you were on before you added the second item to your cart. Return to the first window and add another item to your cart. How many items are in your shopping cart? What does this tell you about shopping cart data (where it is located, its relationship to the life/contents of browser windows, etc)?
What do these exercises tell you about the nature of cookies? When are they appropriate and when are they inappropriate for writing web applications?
copies of all html files and scripts that you wrote for the cookies version of the web prototype. No specific naming convention is required. Also leave the scripts in place in your account so we can test them (starting from the URL supplied in the report).
a single text file (under filename report.txt) containing the your answers to the questions above.
Suggestions for links to additional tutorials and pages that you find useful in doing this assignment are welcome.
Netscape's description of cookies and how they work. Note that most languages provide some facility for managing cookies, so you don't need to implement this specification manually.
A cookie library for Perl. If you know of other libraries that work better with versions of software installed at WPI, post them to the discussion board (this will not be considered a violation of the academic honesty policy).
The Perl sample solution was done by a member of class as part one of the assignment. [page1 | script1 | script2]
Sample of how to use the MzScheme/DrScheme CGI library with cookies. If you wrote your scripts using MzScheme, this example will show you how to add cookies to a script.
The Scheme sample solution is version two from the cgi programs that we discussed in class. This version does not implement the personalization feature.
CCC's page on using CGI at WPI will help you get started writing CGI scripts. It also explains WPI's policies on running your scripts.
If you use Perl, the sysadmins suggest that you put the following line in your script, right after the #!/usr/local/bin/perl line:
use CGI::Carp 'fatalsToBrowser';
If you search for "cgi" in the DrScheme help-desk, you'll get a tutorial on writing CGI scripts in MzScheme.
A CGI-tutorial from python.org and another intro to writing CGI scripts in Python
This is an individual project. Collaboration is not permitted on this assignment. The course staff are the only people you may approach for help with this project. You may not ask anyone outside of the course staff questions on any aspect of this project, including how to write and run CGI scripts; this includes webmaster@wpi or helpdesk@wpi. If you believe there's a problem with running CGI scripts from your account that warrants CCC assistance, get permission from the course staff to contact helpdesk.
In particular, do NOT bother webmaster@wpi or helpdesk@wpi if you get an "Internal Server Error" while developing your code. This error likely appears due to a bug in your script, not a problem on the server. If you are convinced you have a server error, contact the course staff before contacting any systems staff.