![]() |
![]() Spring Semester 2002 |
Thu Aug 8
Instructions for Students to complete CS evals through BEST: 1) Go to http://www.indiana.edu/~best/ 2) Click on "Students" under "QuizSite" 3) Click on Instructor and Course drop-down box 4) Choose link to desired course evaluation All choices are preceeded by "csci" *LECTURE SECTIONS: Lecture sections are preceeded by an upper-case letter (ie: csci-A110) *LAB SECTIONS: Lab sections are preceeded by lower-case letter (ie: csci-a110) 5) Choose "Do a Current Activity" 6) Highlight name of instructor you wish to evaluate 7) Click "Proceed" button 8) Answer the 30 questions and click the "SUBMIT" button. 9) **PLEASE REMIND STUDENTS TO CLICK THE SUBMIT BUTTON** 10) Repeat process for each additional lecture/lab instructor
Wed Aug 7
<html><body bgcolor="white"><script language="javascript"> acc = 0; function etupmoc(msg) { coin = document.forms[0].coin.value; document.getElementById("msg1").innerHTML = "You have typed: " + coin; if (coin == 'dime') { acc += 10; } document.getElementById("msg2").innerHTML = "Your credit is: " + acc + " cents."; } </script> <span id="msg1"> Welcome! </span> <p> <span id="msg2"> Your credit is: 0 cents. </span> <p> <form onSubmit="etupmoc('Bye'); return false;"> Enter coin: <input type="text" name="coin"> <p> <input type="submit" value="Deposit"> </form> </body></html> import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class Exam extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter w = response.getWriter(); response.setContentType("text/html"); w.println("<html><form>"); String coin = request.getParameter("coin"); String msg1 = ""; if (coin == null) { msg1 = "Welcome. <p>"; } else { msg1 = "You have typed: " + coin + "<p>"; } int acc; HttpSession s = request.getSession(); String credit = (String)s.getAttribute("tiderc"); if (credit == null) { acc = 0; } else { acc = Integer.parseInt(credit); } if (coin == null) { acc += 0; } else if (coin.equals("dime")) { acc += 10; } else { } s.setAttribute("tiderc", acc + ""); w.println(msg1); String msg2 = "Your credit is: " + acc + "<p>"; w.println(msg2); w.println("Enter coin: <input type=\"text\" name=\"coin\"> <p>"); w.println("<input type=\"submit\">"); w.println("</form></html>"); } }There's a help session tonight (Wednesday) from 6:30-8:30pm in LH102.
Notes for Monday posted (contain GenericClient
and
HTTPServer
)
Tue Aug 6
Mon Aug 5
Lab
today has been moved to SB221.
Fri Aug 2
Thu Aug 1
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class One extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); String one, two; String what = req.getParameter("picture"); if (what == null) { what = ""; } if (what.equals("one")) { one = "One"; } else { one = "<a href=\"/examples/servlet/One?picture=one\">One</a>"; } if (what.equals("two")) { two = "Two"; } else { two = "<a href=\"/examples/servlet/One?picture=two\">Two</a>"; } out.println("<html><head><title>Mamma mia!</title></head><body bgcolor=\"white\">" + "<table border><tr><td>" + one + "</td><td>" + two + "</td><td>Three</td><td>Four</td></tr>" + "<tr><td colspan=4 align=center>Picture</td></tr>" + "<tr><td colspan=4 align=center>Caption</td></tr>" + "</table></body></html>"); } }This was for the portfolio, as a servlet, and you need a JSP version of it, too.
Now help for the calculator, as JSP.
<html><head><title>My calculator</title></head><body> <% Integer a = (Integer)session.getAttribute("acc"); if (a == null) { a = new Integer(0); } String argument = request.getParameter("arg"); if (argument == null) { argument = "0"; } int conv; try { conv = Integer.parseInt(argument); } catch(Exception e) { conv = 0; } a = new Integer(a.intValue() + conv); session.setAttribute("acc", a); %> <form> The accumulator is now: <%= a %> <p> <input type="text" name="arg"> <p> </form> </body></html>This is only the starting point, and you need a servlet version of it as well.
Please look
carefully at the programs so you don't take either one of them for an incorrect,
not working program. They both work, but you need to be skilled in obtaining what
you need from both of them. And you also need to finish them.
Wed Jul 31
Tue Jul 30
dgerman-A348
).
Mon Jul 29
Text of Homework Five and Six to be posted tonight.
Sun Jul 28
burrowww.cs.indiana.edu% pwd /nfs/paca/home/user1/dgerman burrowww.cs.indiana.edu% ls -ld ~/tomcat/*/* -rw-r--r-- 1 dgerman 4568 Jun 11 00:09 [...]/LICENSE -rw-r--r-- 1 dgerman 3084 Jun 11 00:09 [...]/README.txt -rw-r--r-- 1 dgerman 2358 Jun 11 00:09 [...]/RELEASE-NOTES-4.0*.txt -rw-r--r-- 1 dgerman 2548 Jun 11 00:09 [...]/RELEASE-PLAN-4.0.1.txt -rw-r--r-- 1 dgerman 2683 Jun 11 00:09 [...]/RELEASE-PLAN-4.0.txt -rw-r--r-- 1 dgerman 5955 Jun 11 00:09 [...]/RUNNING.txt drwxr-xr-x 2 dgerman 512 Jun 11 00:09 [...]/bin drwxr-xr-x 2 dgerman 512 Jun 11 00:09 [...]/classes drwxr-xr-x 4 dgerman 512 Jun 11 00:09 [...]/common drwxr-xr-x 2 dgerman 512 Jul 25 10:45 [...]/conf drwxr-xr-x 2 dgerman 512 Jun 11 00:09 [...]/lib drwxr-xr-x 2 dgerman 512 Jul 27 22:33 [...]/logs drwxr-xr-x 4 dgerman 512 Jun 11 00:09 [...]/server drwxr-xr-x 2 dgerman 512 Jul 27 22:33 [...]/temp drwxr-xr-x 7 dgerman 512 Jun 11 00:09 [...]/webapps drwxr-xr-x 3 dgerman 512 Jul 25 10:47 [...]/work burrowww.cs.indiana.edu%When you're done installing Tomcat please:
Sat Jul 27
And a brief summary of the more salient features:
burrowww.cs.indiana.edu% pwd /nfs/paca/home/user1/dgerman/public burrowww.cs.indiana.edu% ls -ld jaka* -rw-r--r-- 1 dgerman faculty 4241667 Jul 25 08:54 jakarta-tomcat-4.0.4.tar.gz burrowww.cs.indiana.edu%
gunzip
on it, I then tar xvf
it, with
burrowww.cs.indiana.edu% which tar /usr/local/gnu/bin/tar burrowww.cs.indiana.edu%and I don't get any checksum error. No I don't.
4.0.4
, extension
.gz
, and that I use GNU's tar
.
Fri Jul 26
They now provide EVERYTHING that's needed to finish Homework Four.
Thu Jul 25
server.xml.username
files have been generated in
/u/dgerman/public/a348/tomcats
for everybody.
Please let me know if you run into any trouble when you try to use them.burrowww.cs.indiana.edu% pwd /nfs/paca/home/user1/dgerman/public/a348/tomcats burrowww.cs.indiana.edu% ls -ld server* -rw-r--r-- 1 dgerman 2765 Jul 25 11:22 server.xml. -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.aaeveret -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.ajflynn -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.ajstrain -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.bfonde -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.blayden -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.bmartins -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.bminton -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.cstucker -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.dgerman -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.dwhitmor -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.ggrumbli -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.heyoon -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.jihong -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.jmbennet -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.jvorwald -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.kgleason -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.kstanley -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.kwittste -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.mbuulolo -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.mchablan -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.mmccrack -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.mngantun -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.mrock -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.nbahri -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.pksander -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.rwgeorge -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.ryaosbor -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.shlgrego -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.sizhao -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.sshayan -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.taajones -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.tizhang -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.tthaker -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.wflint -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.yjchang -rw-r--r-- 1 dgerman 2774 Jul 25 11:23 server.xml.yli burrowww.cs.indiana.edu%
Wed Jul 24
Mon Jul 22
Here's a potential solution to part of your lab assignment:
<? function get_book_cats($isbn) { $conn = db_connect(); $query = "select dgerman_php_catboo.catid, catname from dgerman_php_categories, dgerman_php_catboo where '$isbn' = dgerman_php_catboo.isbn and dgerman_php_categories.catid = dgerman_php_catboo.catid"; $result = @mysql_query($query); if (! $result) return false; $num_cats = @mysql_num_rows($result); if ($num_cats == 0) return false; $cat_array = array(); for ( $count = 0; $row = @mysql_fetch_array($result); $count++ ) $cat_array[$count] = $row; if (! is_array($cat_array)) { echo "No categories currently available. <br>"; } foreach ($cat_array as $row) { $url = "show_cat.php?catid=".($row["catid"]); $title = $row["catname"]; do_html_url($url, $title); } } ?>
Fri Jul 19
Thu Jul 18
Wed Jul 17
Long overdue list of useful books (so far):
![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() |
Tue Jul 16
Mon Jul 15
Thu Jul 11
Tue Jul 9
#!/usr/bin/perl &printHeader; &readParse; # builds, or tries to build, an %in if ($ENV{REQUEST_METHOD} eq 'GET') { $in{number} = int(rand(100)); $in{tries} = 0; $message = "The game has started."; } else { # assume POST if (!$in{number}) { $in{number} = int(rand(100)); $in{tries} = 0; } if ($in{guess} == $in{number}) { print "You win.\n"; &printTrailer; exit; } $message = "Try lower"; $message = "Try higher" unless $in{guess} > $in{number}; $in{tries} += 1; if ($in{tries} >= 10) { print "You lost.\n"; &printTrailer; exit; } } print qq{ <form method="POST" action="$ENV{SCRIPT_NAME}"> Please enter a number: <input type="text" name="guess" size=4> <p> <input type="hidden" name="number" value="$in{number}"> <input type="hidden" name="tries" value="$in{tries}"> <p> $message You have used $in{tries} tries thus far. <p> (The secret number is $in{number}) <p> When done please <input type="submit" value="Click Me!"> </form> }; &printTrailer; sub printHeader { print "Content-type: text/html\n\n<html><body>"; } sub printTrailer { print "</body></html>"; } sub readParse { if ($ENV{"REQUEST_METHOD"} eq 'GET' ) { $input = $ENV{"QUERY_STRING"}; } elsif ($ENV{"REQUEST_METHOD"} eq 'POST') { read (STDIN, $input, $ENV{"CONTENT_LENGTH"}); } else { print "Unsupported method."; &printTrailer; exit; } @input = split(/\&/, $input); foreach $elem (@input) { $elem =~ s/\+/ /g; $elem =~ s/%(..)/chr(hex($1))/ge; ($key, $value) = split(/\=/, $elem); $in{$key} = $value; } }
Help session tonight at 6:30pm in LH102.
There's an exam on Thursday, in class, at 9:30am. Here's what you might want to look into while I prepare the notes for this week, and post more info about the exam:
Sat Jul 6
These notes are somewhat special: they bring a lot of information and explanations are extremely detailed. Please look at them as an example of complexity that an A348 semester project should exhibit (especially the server side technique, second set of notes).
Thu Jul 4
Tue Jul 2
Here's the Java code we wrote in class today:
// One.java, only illustrating how we set up the I/O connection import java.io.*; class One { public static void main(String[] args) throws IOException { BufferedReader phone = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Type something: "); String line = phone.readLine(); System.out.println("You typed: " + line); } } // Two.java illustrating the basic calculations class Two { public static void main(String[] args) { int acc = 0; System.out.println(acc); // user says add 5 and we understand it int arg = 5; acc += arg; System.out.println(acc); // user says sub 3 ... arg = 3; acc -= 3; System.out.println(acc); // and so on ... } } // Three.java, that uses objects to implement the same thing class Acc { double balance; void add(double arg) { balance = balance + arg; } void sub(double arg) { balance = balance - arg; } double show() { return balance; } // Acc() { } } class Three { public static void main(String[] args) { Acc one = new Acc(); System.out.println(one.show()); one.add(5); System.out.println(one.show()); one.sub(2); System.out.println(one.show()); } } // From here on we went into the Lab Notes (Five)First part of the first part of the notes on keeping state posted.
Program is included but more yet is to come, especially more explanations.
Mon Jul 1
Sat Jun 29
Thu Jun 27
MySQL
. Here's the simple (standalone, to be used from the Unix prompt) calculator we wrote in class today:
#!/usr/bin/perl $acc = 0; print "Hello, your account is: ", $acc, "\n"; while ($line = <STDIN>) { if ($line =~ /^bye/i) { last; } if ($line =~ /^add (\d+)/) { $acc += $1; } elsif ($line =~ /^sub (\d+)/) { $acc -= $1; } else { print "I am sorry I don't understand $line."; } print "The account now is: ", $acc, "\n"; } print "Thanks for using this program.\n";
Wed Jun 26
Mon Jun 24
Also, here's the script we developed in class today:
#!/usr/bin/perl print "Content-type: text/html\n\n"; print qq{<html><head><title>Experiment</title></head><body bgcolor="white">}; foreach $key (keys %ENV) { print $key, " --> ", $ENV{$key}, "\n<br>"; } print "</body></html>";
Sun Jun 23
Prototype for Homework One also updated.
Here's the script we developed in class last Thursday:
#!/usr/bin/perl print "Content-type: text/html\n\n"; $date = localtime; print qq{ <html> <head> <title>My First Script</title> </head> <body bgcolor="white"> <h1>Hello! </h1> <font size=+6>It's $date. </font> </body> </html> };
Thu Jun 20
Wed Jun 19
Please let me know if any of them doesn't work for you.
Also here are our office hours.
Tue Jun 18
Mon Jun 17
For 2-3 days we will be using the notes from the Spring semester for lecture and labs, after that I will update the website to contain notes that I will be writing especially for this summer course. (These new notes will, of course, include most of the material covered last semester, but new material will be added, and the old material will be presented in a new form(at)).
A348/A548