CS1116/CS5018 Lab 1

Part 1

Together we will review some of the details mentioned in the lecture:

Part 2

In your public_html/cgi-bin directory, create a new directory called lab1 (no spaces, all in lowercase!!!!!!). Change the directory permissions to 701.

Take a copy of the following two files (right-click on each link and choose 'Save link as…') and save them in your public_html/cgi-bin/lab1 directory:

Don't forget to fix their permissions!

spies.html contains a form that allows a user to enter his/her firstname and surname. Do not modify spies.html in any way.

spies.py contains a server-side Python program. The program receives the user's firstname and surname from the form. The program outputs a Web page that greets the user in 007-fashion. For example, if the user enters 'James' and 'Bond', the Web page will contain the following paragraph:

                Your spy name is: Bond, James Bond.
            

If the user enters 'Kevin' and 'Kavanagh', the Web page will contain instead the following paragraph:

                Your spy name is: Kavanagh, Kevin Kavanagh.
            

However, spy.py is full of bugs. Fix it.

Part 3

Take a copy of the following file (right-click on the link and choose 'Save link as…') and save it in your public_html/cgi-bin/lab1 directory:

lengths.html contains a form that allows a user to enter a length (a number) and to choose units from a menu. Do not modify lengths.html in any way.

Write a server-side Python program in a file called lengths.py in your public_html/cgi-bin/lab1 directory. The program receives the user's data from the form, and converts the number to the other units. It outputs all three values in a Web page that contains an HTML table.

For example, if the user enters '13' and chooses 'Feet', then the table will look like this:

Inches:156.00
Feet:13.00
Yards:4.33

For example, if the user enters '22.5' and chooses 'Yards', then the table will look like this:

Inches:810.00
Feet:67.50
Yards:22.50

Submission

There is no formal submission of this week's exercises. However, for my records, this weekend I will run a program that checks to see whether you have done the work or not.