UNC
School of Information and Library Science
INLS760 – Web Databases, Spring 2008
INLS 760

Main Page

Announcements

Calendar/Notes

Assignments

Links

Course Policies

Grades

In-Class Exercise #1

Unix Exercises

Do the following exercises in your ruby.ils.unc.edu account.

  1. Create a directory named "ex1" and copy the following two files into it. Try using a wildcard character to copy both files at once.
    		   /htdocs/courses/2008_spring/inls760_001/ex1/sample1.txt
    		   /htdocs/courses/2008_spring/inls760_001/ex1/sample2.txt
    		
  2. Read the man page for the Unix uniq command. Use the sort and uniq commands along with the pipe operator to write a one-line statement that will list all the lines that appear in both sample1.txt and sample2.txt (i.e. the intersection of the two files).
  3. Do the same as above, execpt instead of showing the intersection of the two files on the screen, write the lines out to a file called overlap.txt
  4. Set the permissions on the overlap.txt file so that you can read and write the file, users in your group can read the file, and all other users of the system cannot read or write the file. No other permissions should be set.

PHP Exercises

Do the following exercises in your ruby.ils.unc.edu account.

  1. Write a php script that creates a three-dimensional array called "circle" with the following data:
                   area  circumference
                1    3         6
                2   12        12
                3   28        18
    		
    The php script should then loop through all the keys (i.e., 1, 2, 3) and print the area and circumference for each key.
  2. Write an html page with a form with 2 fields (username and password) and a submit button labelled "Login". Make the username be a text field and the password be a password field. Have the form action be to call a php script called login.php. The php script should return a message saying "Hi username!" if the password matches "12345". If the password does not match "12345", then the script should print "Wrong password." If the password is wrong, for this simple example, users will have to use the back button on their browser to try again.