Fall Semester 2009


Fri Nov 20
Lab notes from today's lab.

Thu Nov 19
Notes from today's class.

Tue Nov 17
Notes from today's class.

Fri Nov 13
Notes for today's lab.

Thu Nov 12
Notes for today's lecture and lab.

Check Nov 29 in this document.

Tue Nov 03
Code worked with Ying today during office hours:

<script>
  function Robot() {
    this.giveCards = function giveCards() {
      cardOne = this.deck.pop(); 
      cardTwo = this.deck.pop(); 
      this.handOne.push(cardOne); 
      this.handTwo.push(cardTwo); 
      document.getElementById("oneHand").innerHTML = this.handOne;   
      document.getElementById("twoHand").innerHTML = this.handTwo;   
    }
    this.initialize = function initialize() {
      this.deck = [];
      this.handOne = [];
      this.handTwo = []; 
      for (i = 0; i < 4; i++)
        for (j = 0; j < 13; j++)
          this.deck.push(j); 
      for (var i = 0; i < 100; i++) {
        var index = Math.floor(Math.random() * this.deck.length);
        var other = Math.floor(Math.random() * this.deck.length);
        var temp = this.deck[index];
        this.deck[index] = this.deck[other];
        this.deck[other] = temp;
      }
      alert(this.deck); 
    }  
  } 
</script> 

<form>

<table>
  <tr> <td> Player One <td> <span id="oneHand"></span> 
  <tr> <td> Player Two <td> <span id="twoHand"></span> 
</table>

<input type=button value=Hit onClick=coraline.giveCards()> 

</form> 

<script> 
  coraline = new Robot(); 
  coraline.initialize(); 
  coraline.giveCards(); 
</script>
 

Mon Nov 02
Sent to the distribution list earlier today:
Date: Mon, 2 Nov 2009 09:57:29 -0500 (EST)
From: Adrian German 
To: Karthik Narayan Muthuraman Jacob Levi Marsh Daniel Arthur Wick Jennifer Jean Hughes China Rose 
Williams Ying Wang Nicholas Tyler Sorosky Tyler Scott Peterson Anthony Chad Brown Raymond James Keller 
Kaitlin Louise Herkamp Na Li Park Aaron Henry Deutsch Jimmy Floyd Denton Beibit Zhumabekov 
Subject: semester project and this week's plan

Hello and I hope everybody is doing well!

I am currently working on updating everybody's grades in the online
blogs. I have given individual feedback in person in lab. Office hours
for this coming week are listed here:

http://silo.cs.indiana.edu:8346/cgi-bin/fall2009/schedule

This week we wrap up Javscript/DHTML and install Tomcat in labs. We then
proceed to study the basics of OOP in Java, Javascript, Python and PHP. In
another week you will be able to finish Homework Seven which is the last
homework assignment this semester.

There is another thing we need to discuss: semester projects. A semester
project is a (mostly) independent-study-kind-of activity in which one is
attempting to use the knowledge accumulating thus far to either (a) write
a bigger application than our homework assignments, or (b) learn one of
the web frameworks of the moment. Here's and example (by Karthik M.) from
the second category:

Title of project: CakePHP, the rapid development PHP framework.
Basic outline: in this project I will study this framework.
Milestones:
0. Choosing to study CakePHP
1. Implementation of a web Blog (following the on-line tutorial)
2. Implementation of a simple ACL controlled application (same)
3. Implementation of the Flag Quiz or a similar problem in CakePHP.
4. Wrap-up: summary of what I have learned (pocket reference format).

Tomorrow in class we will briefly discuss step 1 of the list above, to
just give an example of why it's easy and how you actually can and should
learn a lot from it, as a matter of fact.

Please be ready to tell me what you want to do for a semester project when
I send you individual e-mail messages today. Feel free to ask for advice -
but you also need to let me know what you might find interesting to work
on. I will try to send a list to choose from.

Sincerely,
Adrian German

--
Thu Oct 29
This is your lab exercise for today (and tomorrow).

Tue Oct 27
Today we discuss object-oriented programming.

Take a look at this example.

We will discuss Python, Javascript and Java (the basics).

You can look through chapters 15 and 16 of the .pdf text.

Sat-Sun Oct 24-25
Take a look at this image to understand how the new approach works:
We start from this collection of files: an engine inside a car driven by a person.

-bash-3.2$ ls -l
total 40
-rw-r--r-- 1 dgerman faculty  720 Oct 22 11:41 template.py
-rw-r--r-- 1 dgerman faculty 2469 Oct 22 11:46 client.py
-rwx------ 1 dgerman faculty  152 Oct 22 13:16 one
-bash-3.2$
one is the car, with wheels, that can be driven on land.

Call one and it will drive on land. It will work.

Now here is the "boat":

-bash-3.2$ ls -l
total 40
-rw-r--r-- 1 dgerman faculty  720 Oct 22 11:41 template.py
-rw-r--r-- 1 dgerman faculty 2469 Oct 22 11:46 client.py
-rwx------ 1 dgerman faculty  152 Oct 22 13:16 one
-rw-r--r-- 1 dgerman faculty 1795 Oct 22 13:35 server.py
-rwx------ 1 dgerman faculty   75 Oct 22 13:17 two
-bash-3.2$ 
two is the boat.

If

server is only adding the propellers to the car.

In server the wheels are not used. (We expected that, we knew that).

But

Thu-Fri Oct 22-23
Part II:

Now copy server.py into the same folder (see below).

Also copy two and make it executable.

two works with the database and provides the server side version of one.

Just make sure that there are non references to my username, port, server in the file. Mine can be accessed from here:

http://silo.cs.indiana.edu:8346/cgi-bin/1022/two
You should see the content of the table as the program is accessed by various people:
mysql> select * from hwFive;
+------------+---------------------------------+------+------+------+------+---------------------+
| session_id | message                         | n1   | n2   | m1   | m2   | modified            |
+------------+---------------------------------+------+------+------+------+---------------------+
| 58974425   | Very good.Score now: 2 out of 4 |   26 |   23 |    2 |    4 | 2009-10-22 13:36:24 | 
| 11848907   | Welcome                         |   17 |  -18 |    0 |    0 | 2009-10-22 13:36:42 | 
| 24997385   | Very good.Score now: 1 out of 1 |  -37 |   48 |    1 |    1 | 2009-10-22 13:37:40 | 
+------------+---------------------------------+------+------+------+------+---------------------+
3 rows in set (0.00 sec)

mysql> 
Notice that one still works, as below, and the two share code but keep state in different places.

Thu Oct 22
Part I (of what to do when you're done with the exam):

  1. Go to (create it if necessary) ~/apache/cgi-bin/1022
  2. Copy in that folder template.py
  3. Now copy client.py into the same folder.
  4. Finally copy one make it executable and access it from the web.
  5. To access use URL http://silo.cs.indiana.edu:xxxx/cgi-bin/yyyy/one

Now let's go to MySQL:

cd /nobackup/dgerman/mysql-5.0.22/
Locate the file that allows you to log in as regular user:
-bash-3.2$ ls -ld connect_as_lbird 
-rwx------ 1 dgerman faculty 105 Oct 13 12:26 connect_as_lbird

-bash-3.2$ cat connect_as_lbird 
mysql --socket=/nobackup/dgerman/mysql/mysql.sock \
  --port=8974 --host=silo.cs.indiana.edu -u lbird -p
-bash-3.2$ 
Get in with the right password:
-bash-3.2$ ./connect_as_lbird 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
At the mysql command prompt select your database:
use awards;
Then create the table:
create table hwFive (
  session_id char(8) primary key,
  message varchar(240),
  n1 int,
  n2 int,
  m1 int,
  m2 int,
  modified   timestamp
);
Then exit.

Wed Oct 21
Code for the "reasonable" problem from the exam study guide: here.

Tue Oct 20
Notes to discuss briefly today: here

Notes wrote in class today: here.

------------------------------------------------------------------------
Date: Mon, 19 Oct 2009 10:41:06 -0400 (EDT)
From: Adrian German 
To: ...
Subject: office hours this week and exam info

There is an exam on Thu, it is take home. Think of a problem,
let me know what it is, and once I approve it -- solve it. Use
any technology you like: PHP with/without sessions or CGI/Perl
or CGI/Python. Then on Thu come and write the solution up with
no help, closed-book. Then on Thu and Fri in lab you will have
a chance to grade your test and fix it if need be. More details
about that part then. Office hours this week:

http://silo.cs.indiana.edu:8346/cgi-bin/fall2009/schedule

Material describing basic problems you could claim on an exam:

http://www.cs.indiana.edu/classes/a348/fall2009/exam.pdf

Don't expect me to agree to a simple problem, but the material
starts from a very simple problem and builds on it.

Sincerely,
Adrian German

--
Fri Oct 16
Summary of notes about next week as seen from this week's lab.

Nice bug example provided by Karthik in lab on Thu:

  1. start with this program (play with it here)
  2. the program works fine: server-side state, reloads don't count, but they are acknowledged!
  3. make a change to turn it into this program (play with it here)
  4. this new program (start it from a brand new ID and session!) works differently
  5. but it differs by one character only! what's happening?

Thu Oct 15
URL to discuss in class today:
http://www.cs.indiana.edu/classes/a348/fall2008/whatsnew/hwFive.txt

Simple PHP notes from a while ago, PHP tutorial at w3schools.com.

Basic steps to get started with MySQL.

Fri Oct 09
Notes to look at before starting the lab today.

The code we wrote in class today.

Thu Oct 08
Program developed in class today.

Notes to be used in lab this week: or here.

Notes distributed in class today.

Tue Oct 06
Notes from earlier today.

Sat-Sun Oct 3-4
Office hours appointments for next week can be scheduled here.

Fri Oct 02
Notes for lab today. Additional notes for help with Homework Two.

Thu Oct 01
Notes for the lab and lecture today.

Fri Sep 25
Here are some notes from the Fri lab: here.

Here's an example of how to start implementing a variation of war: notes.

For Hangman /usr/share/dict/words is useful.

(How many 5 letter words with 2 vowels are there?)

Thu Sep 24
In lab today and tomorrow we work on Homework Two:

  1. Choose a problem, describe it.
  2. Write a prototype for it.
  3. Design as we did in class today.
  4. Implement it.

Notes from today's class can be found here.

Code for one of the programs discussed in class Tue is here.

Wed Sep 23
Office hours for this week can be scheduled here.

Thu Sep 17
Python tutorial focusing on CGI: here.

The program we developed in class today: here.

The source code for the card game that is the model for Homework Two: here (read carefully).

Sat-Sun Sep 12-13
Here's the link to available times for office hours, please use it to make appointments.

Fri Sep 11
Lab notes from today's lab.

Thu Sep 10
Lab notes from today's lab.

Lab notes from today's lab.

Notes from today's class, in real time.

Wed Sep 09
List of links distributed in class on Tue.

Website for this semester instantiated.

Last semester's website will remain available to you.

Mon-Tue Sep 7-8
Individual student blogs updated.

Thu Sep 03
List of students and ports this semester.


Updated by Adrian German for A348/A548