CS637 Homework 1 Review, Setup, HTML5 part 1

Due Monday, Feb. 6, in class, on paper. Be sure to get a UNIX/Linux account for cs637 by Friday, 1/27, to list your username for the needed mysql account, and access to topcat.cs.umb.edu.

1.  Basic HTML and URLs: if you really know HTML, you can skip this. 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. 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 "Mytitle", contents entitled "Important links", and a relative link to a copy of this file (hw1.html), 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.

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. User ronghui, for example, will have an account on mysql on topcat with username ronghui, password ronghui, and a database named ronghuidb.  To access it, login to topcat 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 topcat.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.

b. Note that the book applications are available at http://topcat.cs.umb.edu/book_apps on the web and since the web server root is at /var/www/html on topcat, they are available in the topcat filesystem at /var/www/html/book_apps. Copy the SQL script my_guitar_shop1.sql from the _create_db subdirectory to your cs637/hw1 homework directory on topcat. Try to load your mysql database on topcat with this script and report on your success or problems.  Note: You will need to edit out the create database and create user commands from my_guitar_shop1.sql, as you have access only to your own database, and no privileges to create additional users.

4. a. Until students have XAMPP installed, we'll use topcat for simple PHP execution from the command line.  Code up the future value for loop of pg. 77 in a complete php program future_value.php and execute it from the command line: topcat$ php future_value.php. Create directory hw1 in your cs637 directory and put future_value.php in it, making it have path ~/cs637/hw1/future_value.php. The original code is available in book_apps/ch02_future_value/display_results.php. 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 and report your success or problems running it.

b. Run the future value example as a web acpplication by browsing to http://topcat.cs.umb.edu/book_apps/ch02_future_value/. Try out valid values and invalid values as shown on pg. 81. 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!  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.