![]() | ![]() Spring Semester 2007 |
Fri Apr 20The code is unindented on purpose. Can you tell why? (Michael's server is here.)
Sat-Thu Apr 14-19
Fri Apr 13
All programs implement the addition quiz.
Wed-Thu Apr 11-12
Fri-Tue Mar 30-Apr 10Basic Java review.
Thu Mar 29
for working with me after class and help
summarize the following:
Here are the settings in his ~/.profile:
Notice we specifically added the jdk1.5 directory to the path.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
That seemed to eliminate the servlet problems we had in class.
Also tested with Matt's help:
Mon-Wed Mar 26-28web.xml for new contexts.
Sat-Sun Mar 24-25Please registerWe will also install Tomcat and state the last homework assignment (Java servlets, JSP).at this URL.
Fri Mar 23Here'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-22In lab this week, a combination of:
Links below and previous class notes are to be used in the process.
Mon Mar 19Lab Notes for this week.
Here's an example from Chapter 15, and another one from the same chapter.
Sat-Sun Mar 10-18
Fri Mar 9(I am in Cincinnati today, at SIGCSE and will return to Bloomington at the end of the break.)
Thu Mar 8
Fri-Tue Feb 23-27
Thu Feb 22
Wed Feb 21
Mon-Tue Feb 19-20
Sat-Sun Feb 17-18The 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
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
<? 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:
The two lines you need to add to./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
httpd.conf:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
Mon-Wed Feb 12-14
Sat-Sun Feb 10-11http://www.libraries.iub.edu/scripts/countResources.php?resourceId=59555
Fri Feb 9Here 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#!/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 8Date: 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 7We 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
Sat Feb 03Date: 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
Thu Feb 01Basic set of slides discussing:
Wed Jan 31
Slides that have to do with Jeff's Tuesday presentation.
Tue Jan 30Lecture today starts with a guest presentation by Microsoft student ambassador and A348 graduate Jeff Gehlhausen.
Mon Jan 29Lab 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-28crontab -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:
We need to start Tuesday's class with a brief explanation of this.0 8 * * * /u/[username]/apache/bin/apachectl graceful
Fri Jan 26
Thu Jan 25We have already covered in class all we need to know (as far as CGI.pm goes).
Wed Jan 24What'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 23Date: 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
Sat-Sun Jan 20-21
Fri Jan 19And the second (smaller) program: code, actual program.
Thu Jan 18Lab 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 17Reading assignment (minute paper) for tomorrow: summarize pp. 21-26 in the text.
Tue Jan 16Adity'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:
Note the class notes have a different format now.chmod 711 ~ chmod 755 ~/public chmod 644 ~/public/whoa.tar.gz
Mon Jan 15Details in class tomorrow.
Sat-Sun Jan 13-14Pictures of your friendly and very knowledgeable TAs:
![]()
![]()
Todd Holloway
R 4-5:55 BH107Adity Upoma
F 12:20-2:55 LH025
Fri Jan 12Here's the program with which you can access archives by usernames.
Thu Jan 11Minute paper starts with summary of pp. 11-15, from the text.
Wed Jan 10Prototype for homework two, sample older midterm exam.
Tue Jan 9This 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.