Spring Semester 2007


Fri Apr 20
Code worked out with Michael Sutherland after the lab on Fri.

The code is unindented on purpose. Can you tell why? (Michael's server is here.)

Sat-Thu Apr 14-19
Code developed in class this week; some of last Thu's code.

Fri Apr 13
Programs developed in lab today:

All programs implement the addition quiz.

Wed-Thu Apr 11-12
Homework Four programs from Homework Two.

Fri-Tue Mar 30-Apr 10
Notes updated, link to one (of many) project ideas posted.

Basic Java review.

Thu Mar 29
Thanks to Matt Carroll for working with me after class and help summarize the following:

Here are the settings in his ~/.profile:

PATH="$HOME/bin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/ucb:/usr/bin/X11:/usr/openwin/bin:/usr/dt/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/local/gnu/bin:/l/jdk/bin:$PATH"
export PATH

EDITOR=pico
export EDITOR

JAVA_HOME=/l/jdk1.5
export JAVA_HOME

CATALINA_HOME=/u/chmcarro/apache-tomcat-5.5.17
export CATALINA_HOME

CLASSPATH=.:$CATALINA_HOME/common/lib/servlet-api.jar
export CLASSPATH

PATH="$JAVA_HOME/bin:$PATH" 
export PATH
Notice we specifically added the jdk1.5 directory to the path.

That seemed to eliminate the servlet problems we had in class.

Also tested with Matt's help:

  1. A JSP that implements the flag quiz.

  2. It can be tested already as shown in class, you need one more JSP and two servlets for Homework Seven.

  3. This JSP keeps state in sessions.

Mon-Wed Mar 26-28
Here are some old notes helping with servlet intro, JSPs and web.xml for new contexts.

Sat-Sun Mar 24-25
This coming week we have individual appointments.
Please register at this URL.
We will also install Tomcat and state the last homework assignment (Java servlets, JSP).

Fri Mar 23
Here's the code developed in lab today.

Here's the code we developed in class yesterday.

Also, as you may recall, all homework and labs have always been listed here.

Tue-Thu Mar 20-22
A good reading assignment for Thu is 15.2 (pp. 119-124) followed by 15.3.

In lab this week, a combination of:

Links below and previous class notes are to be used in the process.

Mon Mar 19
Lecture Notes to support Chapter 15 in the text.

Lab Notes for this week.

Here's an example from Chapter 15, and another one from the same chapter.

Sat-Sun Mar 10-18
Spring Break.

Fri Mar 9
The seven stages of chapter 13 discussed yesterday are here. Have a good spring break.

(I am in Cincinnati today, at SIGCSE and will return to Bloomington at the end of the break.)

Thu Mar 8
Midterm grades have been posted (log into A348-0107).

Fri-Tue Feb 23-27
Older lecture notes: one, two.

Thu Feb 22
Lab Seven notes posted.

Wed Feb 21
Here's the second part of assignment four, in sudoku format.

Mon-Tue Feb 19-20
Here's the first part of assignment four, in sudoku format.

Sat-Sun Feb 17-18
So I have been asked if I can offer some help with Homework Four.

The code below would be my contribution. What do you think of it?

<?

 
if ($fl_gs) {

   
$flags explode(','$fl_gs);
   
$flaeg array_pop($flags);

   
$flags implode(','$flags);

 } else {
   
$initial = array("one""two""three");
   
shuffle($initial);
   
$flags implode(','$initial);
 }

 
?>

<form>

<font color="#0066cc"><?=$flaeg?></font>

<input type="submit" value="Proceed">

<input type="hidden" name="fl_gs" value="<?=$flags?>">

</form>

Fri Feb 16
Thanks to Muhammed Ali Alan for his help in lab today.

After installing PHP we developed this program and explained it:

<? session_start();
   if ($message){
     $num+=1;
   } else {
     $message = "This is my program";
     session_register ("message");
     $num = -3;
     session_register ("num");
   }


 ?>
The number is : <? echo $num ?> <p>
Click <a href = " " >here</a> to add 1 to the number.
We then changed it to client-side state:
<?
   if ($message){
     $num+=1;
   } else {
     $message = "This is my program";
     $num = -3;
   }


 ?>
The number is : <? echo $num ?> <p>
Click <a href = "?num=<?=$num ?>&message=<?= $message?> " >here</a> to add 1 to the number.
We then converted this last program to CGI with client-side state:
#!/usr/bin/perl

use CGI;
$q = new CGI;
$message=$q->param('message');
$num=$q->param('num');

print $q->header, $q->start_html;

   if ($message){
     $num+=1;
   } else {
     $message = "This is my program";
     $num = -3;
   }

print qq {

The number is :  $num <p>
Click <a href = "?num=$num&message=$message " >here</a> to add 1 to the
number.
};
print $q->end_html;
You see that the logic inside does not change at all.

Thu Feb 15
Programs developed in class today:

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

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

   } else { // initialize state 
     $message = "Balance is: "; 
     session_register("message"); 
     $balance = 0; 
     $message .= $balance; 
     session_register("balance"); 
   } 
 ?>

<form> 
  <?=$message?> <p> 

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

  Press <input type="submit" value="Proceed"> when ready. 
</form> 
Here's the transformed program:
<?
   if ($message) {
     $balance += $amount;
     
     $message = "Balance is currently: " . $balance;
     
   } else { // initialize state
     $message = "Balance is: ";
     $balance = 0;
     $message .= $balance;
   }
 ?>
    
<form>
  <?=$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">
     
</form>
Here's the configuration file for PHP:
./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 \
  --prefix=/u/dgerman/apache
The two lines you need to add to httpd.conf:
    AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps

Mon-Wed Feb 12-14
Snowy days.

Sat-Sun Feb 10-11
Useful resource:
http://www.libraries.iub.edu/scripts/countResources.php?resourceId=59555

Fri Feb 9

Here are reading assignments up to the Midterm Exam:

Tue Feb 13 pp. 51-55
Thu Feb 15 pp. 55-61
Tue Feb 20 pp. 61-66
Thu Feb 22 pp. 67-74, 74-82
Tue Feb 27 pp. 82-84
Thu Mar 01 Midterm Exam
Thu-Fri Mar 01-02 Practical Exam

Fri Feb 9
Specifics for database connection for this semester (please use your port and password):
#!/usr/bin/perl

use DBI; 
use CGI; 

$q = new CGI; 

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

$DB        = "dbi:mysql:demoOne:silo.cs.indiana.edu:port=14518"; 
$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;

Thu Feb 8
Sent to the class distribution list just now:
Date: Thu, 8 Feb 2007 01:09:03 -0500 (EST)
From: Adrian German <dgerman@cs.indiana.edu>
To: A348/A548 Spr. 2004 Distr. List <dgerman@indiana.edu>
Subject: some clarifications re: homework three (a348/a548)


There were some questions as to what exactly is Homework Three,
I am going to summarize below the answers I have given thus far:

In general for every homework we need to act as a car factory. I
tell you what program (car) we need, and you need to build a car
just like that, from scratch. Since this is meant to be a learning
experience we show you how you could build similar cars, then you're
free to use that in the way you build your car.

For Homework Three you need to act more like a dealership. We give you
a used car, you need to check it, fix it (if necessary) and sell it back
to us for the best price you can. Explain how it was built, and so on.

The car in this case is the chess tournament problem. Here's what you'd
need to do if you were to be a car factory for this problem:

a) design the database
b) create the database (the actual tables in MySQL)
c) populate them with data
d) write SQL for the queries of interest

You won't have to do these from scratch. Because: if you didn't know
anything about databases (although most of you do know a lot about them)
it would be really hard and it would take you a lot to do all of the above
successfully. So instead we give you:

a) a database design and a rationale
b) an Access database with queries

and we ask you that

a) re-create the database in MySQL
b) take the data from Access and put it into your MySQL database
c) check all SQL queries we gave you, fix them where needed, and
d) make 3-4 of these queries available on yyour website as CGI/DBI scripts

Tomorrow in class we show how this will be done in lab this week.

In lab we will guide you through these.

It may be necessary to first install MySQL in lab. Takes 60 minutes.

After that the rest of Homework Three takes less than 60 minutes (45-50).

Next week we install PHP and move on.

Homework Four will be to write the Flag Quiz in PHP in two ways.

One way: with hidden fields, as until now. The other: using sessions.

See you in class and if you have questions or need help please let me know.

Sincerely,
Adrian German

P.S. After Homework Four there is no more Homework until the Midterm.

Wed Feb 7
These two programs truly cover everything needed for Homework Two.

We have discussed them in lab and lecture. Source code is available through links above.

My protected is available via the combination lbird/dribl as mentioned in class.

Sun-Tue Feb 4-6
Stay warm!

Sat Feb 03
Sent to the class distribution list on Friday night:
Date: Sat, 3 Feb 2007 00:27:08 -0500 (EST)
From: Adrian German <dgerman@cs.indiana.edu>
To: A348/A548 Spr. 2007 Distr. List <dgerman@indiana.edu>
Subject: A348/A548 Feb 2 Update

Dear A348/A548 Friends,

I just looked at the servers and some are down, some are not updated
with your latest work. I am going to write this weekend to all of you
one by one. If I point out briefly what's missing on your site it won't
mean that I won't be looking forward to your updating it. It's just some
feedback, one month into this semester. And now a summary of what we have
achieved thus far:

a) we've installed Apache
b) we know some Unix commands
c) we can write Perl/CGI programs that keep state (using hidden fields)
d) some of us have installed MySQL successfully

Next week we continue our database design lecture notes and try to solve
Homework Three (text pages 41-46). I will also try to determine how many
of us have the text. The IU Bookstore is indeed out of copies (a rather
weird, definitely unexpected situation, I will call them on Monday) and
I have been told TIS does not have the text either. So I need to know if
you have tried to get the book and could not, since without the text it's
a bit harder.

Next week we want to be able to create databases, define tables in them,
populate them with data by hand or using Perl scripts (reading data from
text files rudimentary formatted) and write SQL for a variety of types of
queries. The week after that we install PHP and move on to Homework Four
which will be (sort of) like Homework Two.

Individual messages are forthcoming. Have a great weekend and all the
best.

Sincerely,
Adrian German

Fri Feb 02
Upcoming Career Service Events (slides sent yesterday by Jeremy Podany).

Thu Feb 01
A202 is working on a Blackjack game, which would make a good A348 project as well.

Basic set of slides discussing:

Wed Jan 31
If the final exam were today, what would it contain?

Slides that have to do with Jeff's Tuesday presentation.

Tue Jan 30
Great tackle by A348 student Troy Grossfield makes the front page in IU Home Pages.

Lecture today starts with a guest presentation by Microsoft student ambassador and A348 graduate Jeff Gehlhausen.

Mon Jan 29
This week we leave Perl and CGI behind, at least for a while.

Lab this week includes HTTP experiments, also the installation of MySQL.

Reading assignments: pp. 35-40 for Tuesday, and pp. 47-50 for Thursday.

Your Homework Three is explained in Chapter 8 and will be posted soon.

Sat-Sun Jan 27-28
Just so we don't forget: crontab -e allows you to edit your crontab file.

Here's a Knowledge Base entry on this issue. Before doing this better set your default editor to pico.

Starting next week we should set up our crontab file to:

0 8 * * * /u/[username]/apache/bin/apachectl graceful
We need to start Tuesday's class with a brief explanation of this.

Fri Jan 26
Information about the Perl splice function used in class yesterday.

Thu Jan 25
Link to CGI.pm (courtesy Michael Sutherland) should you need it.

We have already covered in class all we need to know (as far as CGI.pm goes).

Wed Jan 24
Code developed in lecture on Tuesday.

What's Due updated, too. Trying to meet the suggested due dates works best.

If you can't, we of course prefer that you turn things in late instead of never.

The only penalty for turning things late is that they may not be graded, if they're really late.

Check with us, just to be sure. It's better late than never, so stay in touch.

Tue Jan 23
Date: Tue, 23 Jan 2007 10:26:24 -0500 (EST)
From: Adrian German <dgerman@cs.indiana.edu>
To: A348/A548 Spr. 2007 Distr. List <dgerman@indiana.edu>
Subject: A348/A548 Week 2 Update

Dear A348/A548 Friends,

Homework One (which requires an up and running own website, with
picture and a brief description of the semester project) has the
date 01/23 next to it which means that we won't start grading it
before that date.

In lab this week you will set up a password protected folder, so
you can start turning in source code along with your assignments
in it, off your own website.

The method we will promote (at least for the next couple weeks,)
involves setting up a symbolic link (as a .txt file under htdocs)
to your program in cgi-bin. This is the cheapest, fastest and in
many respects one of the most reliable way of posting code---and
we will briefly demonstrate it in class today.

Other things we should have accomplished by now include: posting
the archive for lab1, installing (and posting) the portfolio and
calculator CGI scripts. In lab we have used the CGI.pm package and
emphasized that little is needed to get started; the basic framework
is short and simple, and sticks with us after as little as 30 minutes
of programming.

See pp. 33-34 for instructions to this week's lab. (They will also be
reviewed in class on Thu.) Lecture notes for today have been posted. We
will discuss the two examples posted last week and will start developing a
very simple card game which, hopefully, will help us with Homework Two.

If you have questions or need help please let us know.

Sincerely,
Adrian German

Mon Jan 22
Reading assignment for minute paper on Thu: pp. 33-34 in the text.

Sat-Sun Jan 20-21
Reading assignment for minute paper on Tue: pp. 31-32 in the text.

Fri Jan 19
Here's the code for the program developed in lab Fri morning.

And the second (smaller) program: code, actual program.

Thu Jan 18
Reading assignment (minute paper) for Tuesday: summarize pp. 27-32 in the text.

Lab notes for today posted. Here's how lab two used to be.

Todd's office hours: 1-3p on Weds in the lobby of LH201 (or in LH201D).

Wed Jan 17
The programs to be discussed in lab this week: portfolio, calculator.

Reading assignment (minute paper) for tomorrow: summarize pp. 21-26 in the text.

Tue Jan 16
Adrian's office hours (LH201D): MW 10-11am, TR noon-1pm or by appointment.

Adity's office hours will be on Thursdays from 2:30-3:30pm in LH 305.

On your website please include a brief description of what your project might be.

Recall the need to grant the following permissions for your archive to be accessible:

chmod 711 ~
chmod 755 ~/public
chmod 644 ~/public/whoa.tar.gz
Note the class notes have a different format now.

Mon Jan 15
We will be adding project statements to our websites this week.

Details in class tomorrow.

Sat-Sun Jan 13-14
The reading assignment for the minute paper next time: pp. 17-20 in the Nietzsche text.

Pictures of your friendly and very knowledgeable TAs:

Todd Holloway
R 4-5:55 BH107
Adity Upoma
F 12:20-2:55 LH025

Fri Jan 12
This link reports access to your lab one archive for my grading program.

Here's the program with which you can access archives by usernames.

Thu Jan 11
Class notes to be updated by today.

Minute paper starts with summary of pp. 11-15, from the text.

Wed Jan 10
Grading information, list of ports and students.

Prototype for homework two, sample older midterm exam.

Tue Jan 9
Here's our class entry in the registrar's data: A348, A548.

This is where we can look to determine the date for the final exam.

Here's the back and front covers of the text for this class.


Updated by Adrian German for A348/A548