Adventures in Computing
Yo, baby!
Yo, baby!
Adventures in Computing
Adventures in Computing
Adventures in Computing
Adventures in Computing
Tue Oct 30
Now that the web site is entirely complete we can schedule the final appointments.

Sat-Sun Oct 27-28
Here are the (minimal) solutions for the semester portfolios:

Task 01: Apache
Task 02: Unix/HTML
Task 03: Perl/Python
Task 04: CGI with Perl and Python
Task 05: Keeping state (CGI/hidden fields)
Task 06: SQL and MySQL
Task 07: PHP
Task 08: PHP sessions
Task 09: Database access from PHP, Perl and Python
Task 10: Implementing CGI sessions with Perl DBI

Fri-Thu Oct 5-11
Wrapping up the discussion about keeping state on the web: part a), part b).

All links in the material for last week work now.

Thu Oct 4
The sample project blog is growing, it will soon be finished.

Materials we might want to briefly visit this week (three links at the top).

Wed Oct 3
Programs we developed in class yesterday: one, two.

The fix we need to apply to two to eliminate accidental reloads: three.

Fri-Tue Sep 28-Oct 2
Here's an example of project blog for A348/A548.

Sequence of tasks for the semester portfolio now complete.

Thu Sep 27
We will test these programs in class today (closed-book test, random selection of problem).

The test will be 5-7 minutes long. After that you will take turns converting them to PHP.

Wed Sep 26
Here's the code we developed in class yesterday: perl script, php script.

We spent 25-30 minutes to develop the first, and only 3-4 minutes to get the second from the first.

Tue Sep 25
Today we discuss this diagram, and develop this program in CGI/Perl and PHP (images here).

Or, maybe we should start with the program discussed in the text (pp. 51-66).

Fri-Mon Sep 21-24
Useful link. Here's what you will find there:

Specifics for database connection for this semester (please use your port and password):


use DBI; 
use CGI; 

$q = new CGI; 

print "Content-type: text/html\n\n"; 

$DB        = 
$username  = "dgerman";             
$password  = "sp00n"; # put 
your own password, you can see mine if you highlight it

$dbh = DBI->connect($DB, $username, $password, {PrintError => 0})
  || die "Couldn't open database: ", $DBI::errstr; 

$query = "select * from players"; 

$sth = $dbh->prepare($query) || die $dbh->errstr;

$sth->execute() || die $sth->errstr;

Programs that you might want to test your PHP with:

<? session_start();
   if ($message) {
     $balance += $amount; 

     $message = "Balance is currently: " . $balance;

   } else { // initialize state 
     $message = "Balance is: "; 

     $balance = 0; 
     $message .= $balance; 

  <?=$message?> <p> 

  Amount to add: <input type="text" name="amount" size=4> <p>

  Press <input type="submit" value="Proceed"> when ready. 
This is similar to the one above, just uses client-side state:

   if ($message) {
     $balance += $amount;
     $message = "Balance is currently: " . $balance;
   } else { // initialize state
     $message = "Balance is: ";
     $balance = 0;
     $message .= $balance;

  <?=$message?> <p>

  Amount to add: <input type="text" name="amount" size=4> <p>
  Press <input type="submit" value="Proceed"> when ready.

  <input type="hidden" name="message" value="$message">
  <input type="hidden" name="balance" value="$balance">

We will explain them both, very thoroughly this coming week.

Wed-Thu Sep 19-20
Let's wrap up all the installations for this half of the semester by installing PHP:

Here's some code you could use directly:

./configure \
  --with-mysql=/nobackup/dgerman/mysql \
  --with-apxs2=/u/dgerman/apache/bin/apxs \
  --with-config-file-path=/u/dgerman/apache/conf \
  --with-xml --enable-track-vars \
The two lines you need to add to httpd.conf:
    AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps

The notes on the class notes page will not add much more to what's posted here.

Mon-Tue Sep 17-18
Add this line as the last but one command line argument to your mysql_start batch file:
--log-error=/nobackup/dgerman/mysqld-error.log \

Steps for installing MySQL: one, two, three, four.

Another set of notes with a shorter sequence of steps.

Sat-Sun Sep 15-16
What you need to turn in for credit in this class:

Wed-Fri Sep 12-14

Steps for installing a protected folder: one, two.

Code we will most certainly develop in class on Thu: one, counter.

Program to study: shuffle (see it running here). What's it doing?

Tue Sep 11
Sample programs we are interested in this week:

Fri-Mon Sep 7-10
Class Notes posted for the week.

Notes for the week posted/summarized under Class Notes.
Wed Sep 5
A few links to be used in tomorrow's lecture:
Tue Sep 4
Things we will cover this week:

  • brief review of Apache maintenance commands
  • basic introduction to Perl and simple CGI scripting.
  • discuss the two programs listed below (command prompt calculator, CGI script showing the time)
  • anticipating lab four (basic HTTP, review of some regular expression patterns in Perl)

Here's the command prompt calculator:


$balance = 0;
print "Your balance is: $balance\n";
print "Type> ";
while ($line = <STDIN>) {
  ($fun, $arg) = split(/ /, $line, 2);
  print "You want to $fun a value of $arg to the balance of $balance.\n";
  if ($fun =~ /^add/i) {
    $balance += $arg;
  } elsif ($fun =~ /^sub/i) {
    $balance -= $arg;
  } else {
    print "I am sorry I don't understand $fun.";
  print "The balance is now: ", $balance, "\n";
  print "Type> ";
Here's the program that reports the time, as well the contents of hashtable %ENV:

print "Content-type: text/html\n\n";

$time = localtime;

print "Hello! The time is now: $time";

foreach $key (keys %ENV) {
  print $key, " --> ", $ENV{$key}, "<br>";
Mon Sep 3
Notes for the week will be posted today (Perl, simple CGI).
Thu Aug 31
Today we create an archive and post it for public access.
Wed Aug 30
Class notes for this week posted.
Tue Aug 28
Here's the list of students and ports in use for this semester.

Apache installation notes:

Mon Aug 27
Class starts tomorrow at 7:00pm in LH115 (see section 29144).

There is also a graduate section for this course (see section 30446).

Brief overview of the class:

  • complete review of all general-purpose Unix commands
  • installation and maintenance of the Apache web server
  • object-oriented CGI programming using Perl and Python
  • installation and customization of MySQL RDBMS server
  • basic overview of relational database theory and design
  • PHP programming (includes sessions and MySQL database access)
  • database access from Perl and Python; server-side sessions with CGI
  • finite state machines for the web (a general methodology of development)

The main purpose of this class is to:

  • gently introduce these topics to students who need to know about them.