Due Monday, Sept. 21 on Gradescope. Be sure to get a
UNIX/Linux account for cs637 by Monday, Sept. 14, to list
your username for the needed mysql account, and gain access to our
server pe07.cs.umb.edu.
1. a. Basic HTML and URLs: if you really know HTML, you can skip part a.
of this problem. Just state so on your homework submission.
Read Chap. 1-3 of Duckett for basic HTML. Learn about absolute
and relative URLs, by reading Chap. 4 of Duckett and looking at the
examples in Murach & Harris (M&H), pg. 29 (either edition) For
more practice (optional), go through the HTML tutorial at http://www.w3schools.com/html/
through "HTML Lists". Use a plain editor to compose a web page
test1.html with page title "My title", contents entitled "Important
links", and a relative link to a copy of this file (hw1.html) named
hw1copy.html, also in the same directory on the server, and an absolute
link to the root of our departmental website, with appropriate
descriptive text for the user to see. Include the text of
test1.html in your homework submission.
b. HTTP. Since hw1.html is in directory cs637 of our departmental webserver's document root, its URL is http://www.cs.umb.edu/cs637/hw1.html, as you can verify by browsing to to this URL in your browser. Show the HTTP GET request and response, to the level of detail of the example shown on pg. 7 of M&H and also on slide 16 for the first class. Use Chrome Inspect to find these four headers. See for example, this article found by Googling "using chrome inspect for headers".
2. Review SQL. Read M&H Chap. 18. Go to sqlzoo.net, Pull down the Tutorials menu, and select the following tutorials:
Show your answers (copy and paste the SQL query). If an error message
seems useless, try another database for the query--it might give better
error messages.
3 MySQL. Within a week, user ronghui, for example, will have an account
on mysql on pe07 with username ronghui, password ronghui, and a database
named ronghuidb. To access it, login to pe07 and use the command:
mysql -u ronghui -D ronghuidb -p
and enter ronghui at the password prompt. Another way is shown on pg. 111 of M&H:
mysql -u ronghui -p
Enter password: ronghui
use ronghuidb
Verify your mysql account is working by logging in to system pe07.cs.umb.edu and using the mysql command. See Access to cs.umb.edu systems from offsite for instructions on logging in from offsite.
a. Create a table named t1 with columns "id", and integer, and
"message", a varchar(40). Insert 2 rows into it and then display the
rows. Show a script of this session in your homework. To make a
script, type script
at the Linux prompt before using the
mysql command, then do the database work, exit from mysql, and do
another exit to finish the script.
4. a. Until students have XAMPP installed, we'll use pe07 or users or
users1 for simple PHP execution from the command line. Code up the
future value for loop of pg. 77 (either edition) in a complete php
program future_value.php and execute it from the command line: $
php future_value.php
. Create directory hw1 in your cs637
directory and put future_value.php in it, making it have a filesystem
path ~/cs637/hw1/future_value.php. The original code is available on
pe07 in book_apps/ch02_future_value/display_results.php, i.e. full
filesystem path
/var/www/html/book_apps/ch02_future_value/display_results.php. If
necessary (2nd ed), replace "$future_value =" with "$future_value +=
..." that calculates the same amounts. Note that your program should
have no HTML in it, since there is no browser involved here. Use echo to
print the answer. Show your program in your homework submission and
report your success or problems running it.
b. Run the future value example as a web application by browsing to the
URL http://pe07.cs.umb.edu/book_apps/ch02_future_value/
.
You can only do this directly from inside the departmental firewall. Try
it with the text-based browser lynx
from users or users1
or pe07 itself (command lynx <url>)
. Then set up a
tunnel as explained in AccessToCSHosts
and then browse to http://localhost:8000/book_apps/ch02_future_value.
Try out valid values and invalid values as shown on pg. 81 (either
edition). Note that if some of the fields are valid and others invalid,
the form is redisplayed with the valid values filled in. Users hate to
loose valid input!
c. Make the app display a different error message, and explain what you did to make it happen.
5. Report on your DevelopmentSetup progress and/or problems.