San Jose State University
CS122 Spring 2008 Schedule

The schedule is updated frequently. Please, check regularly. Unless otherwise stated, all reading and programming assignments are from Deitel’s “Perl How to Program”.

Date Description In-class activities Reading Assignment Programming Assignment
01/24 Course Overview Questionnaire (10 points). Section 1.12 and Chapter 2.
  1. Install ActivePerl 5.10.0.1002
  2. Complete Exercises 2.7 and 2.12 pp. 58-59.
    Solutions to 2.7 and 2.12
01/29 Introduction to Perl and UNIX
  1. Pop-Quiz One: Chapter 2 (20 points).
  2. Programming Workshop 1:
Chapter 3. Exercises 2.9, 2.11, 3.10
Solutions to 2.9, 2.11 and 3.10
01/31 Basic Perl Constructs. Programming Workshop 1 (not graded).
  1. Chapter 4.
  2. Learn about the Caesar Cipher here
    and about the Simple Substitution Cipher here
Exercises 3.13, 3.14(a), 4.5, 4.6, 4.8
Solutions to 3.13, 3.14(a), 4.5, 4.6, 4.8
02/05 Perl Arrays.
textbook errata (thanks to Ervi Bongso for finding the link)
Programming Workshop 1 (checked in class).
Additional programming exercises
Chapter 4.
  1. Print Programming Workshop Two handout, answer questions (a)-(d); bring your work to class on February 7.
  2. Compete today's additional programming exercises.
02/07 Perl Arrays and Hashes Programming Workshop 2 (10 points): Chapter 5. Exercises 4.7, 4.9 and 5.10.
Solution to Exercises 4.7, 4.9, and 5.10
02/12 Lists, Arrays, Hashes and Control Structures Programming Workshop Two due:
Check submission guidelines
Chapters 1-5.
  1. Quiz One Review
  2. Exercises 5.6 and 5.9

  3. Solution to Exercises 5.6 and 5.9
02/14 Lists and Perl functions Quiz One Chapter 6.
  1. Deitel Exercise 5.6, p. 169. Prompt the user for input and make sure to check the validity of the input. If the input is invalid (less than zero), warn the user and redisplay the prompt message.
  2. Deitel Exercise 6.4, p. 215
  3. Deitel Exercise 6.5, p. 215. Prompt the user for input and make sure to check the validity of the input. If the input is invalid (radius is less than or equal to 0), warn the user and redisplay the prompt message.
  4. Deitel Exercise 6.6 p. 215.
Solutions to 5.6, 6.4 and 6.6
02/19 Control structures, subroutines script with unless and next control structures Chapter 6
  1. Self-Review Exercises 6.1, 6.2, 6.3 pp. 212-214.
  2. Programming Exercises 6.7, 6.8, and 6.9 p. 215.
    If you need to review HTML, read Deitel Perl How to Program: Chapters 24 and 25.
Solutions to 6.7, 6.8 and 6.9
02/21 Variable Scope and Packages Programming Workshop Three
HIV1.txt
HIV2.txt
Chapter 7
  1. Modify your caesar_1.pl program to make use of subroutines. Save the new version as caesar_2.pl. Note, that the welcome menu for caesar_2.pl should look as follows:
    ****************************************
    Welcome to Caesar cipher!
    Please, read the menu options below:

    To encode your text enter 1
    To decode your text enter 2
    To decode with unknown key enter 3
    To generate a random key enter 4
    To compute character frequencies enter 5
    To quit enter -1
    ****************************************

    Implement subroutines for the following four tasks:
    Print greeting and menu
    Encode (returns encoded text as a string).
    Decode (returns decoded text as a string).
    Brute force decoding (prints decoded strings on the screen).
  2. Add a new menu option: 4 to your program to randomly generate a key (shift) for encoding. Place the new code into a subroutine. Output the generated key and redisplay the main menu. Make sure the key is really randomly generated (rerun your program multiple times and compare the keys) and think about the correct range for the rand() function.
  3. Implement a new subroutine (option 5) to compute frequency of occurrences of each letter of the alphabet in a text file. Assume the filename for this option is large.txt. The new subroutine should read in a file and return a hash. The hash key-value pair represents a unique letter of the alphabet and the number of times this letter was seen in the given file. The valid alphabet for this subroutine consists of lower-case characters of the English alphabet (convert all upper case letters into lower-case using lc() function and ignore digits and punctuation characters. Do not use any matching operators or regular expressions. Simply check the hash for the existence of the element using exists() function). In the main portion of the program, process the hash and output the results in the tabular format, sorted alphabetically. The frequencies of occurrence should be displayed as percentages of the total number of characters in the file, with two digits after the period, e.g.:
    a: 0.01%
    b: 2.5%
    ...
    z: 0.00

    Note, that option 5 outputs frequencies of ALL characters of the alphabet, i.e. your total count should be 26 and even if one of the characters never appeared in the given input text, you should output this character and its frequency (0.00).
    Test option 5 with a few very large text files (at least 2000 words). Which letter is most frequent? Which is the least frequent? How can you use this analysis to crack an unknown ciphertext?
The following programs are due Tuesday, February 26, 2008, beginning of the lecture.
02/26 Variable Scopes. Recursion vs Iteration. Perl scope rules
notrample.pl
DNA.pm
Paired t-test
Chapters 1-6. Prepare for Midterm One:
Midterm Review
Midterm Practice Exam
02/28 Exam One   Chapter 7 First CGI script (10 points) due Tuesday, March 4, 2008, beginning of the lecture.
Self-Review Exercises 7.1-7.4 (do not submit).
Programming Exercises 7.7 and 7.8 (do not submit).
Solutions to Exercises 7.7 and 7.8
03/04 Exam One back. Post-exam review
Sample solutions to Problems 3-9.
Chapter 7 and Chapter 6 (Sections 6.14 and 5.15) Test all CGI examples from Chapter 7
Due March 11, 2008 by midnight: each student should collect 10 non-spam (text) e-mail messages and 10 spam (text) e-mail messages. Each group should e-mail 20 spam and 20 non-spam messages to me by the deadline. One e-mail per group, please. Details are found here
03/06 Perl CGI Programming Workshop Four
HTML for Exercise 7.9
Set up Apache in DH450
httpd.conf file
Chapter 8
Naive Bayesian classifier.
Self-Review Exercises 8.2-8.4
Programming exercises 8.5 and 8.6
   Solutions to 8.5 and 8.6
Print the following
handout, understand and answer all the questions and submit one copy per group on March 11, 2008 at the beginning of the lecture (10 points).
Quiz Two given in Spring 2007
03/11 Perl Modules and CGI PW Four Chapters 1-8 Prepare for Quiz Two.
An excellent tutorial on Perl Modules from Wrox
03/13 Bayesian classifier Quiz Two: 30 min
Programming Workshop Five
   training data
Chapter 8. Programming Exercises 8.7 and 8.9 and PW5
    Solution to 8.7 and 8.9
03/18 Bayesian classifier Quiz 2 Key (DNA.pm was posted on 02/26)
PW 5
    POD info
   test case 1
   test case 2
Chapter 9 Work on classifiers.
    additional source for RegEx
    quiz on RegEx given in Spring 2007
03/20 Bayesian classifier PW 5 due end of class (20 points):
   training set 2
   test case 3
Chapters 9 and 10 Self-Review Exercises 9.2, 9.3, 9.4, 9.5, 10.1 - 10.4 pp. 341-342.
Programming Exercise 9.7, 10.5, 10.6 and 10.7 pp. 343-344.
   Solutions to 9.7, 10.5, 10.6 and 10.7
03/25 Spring break      
03/27 Spring break      
04/01 Regular Expressions Lecture Chapters 1-10 Bayesian classifier by Srilatha Attaluri and Sean Gilpin (Spring 2007)
Bayesian classifier by Yue Chen and Tom Chien (best in Spring 2008)
Midterm Two Review
Midterm two given in Spring 2007
Practice midterm given in Spring 2007
04/03 Midterm Two   Chapter 11 Programming Exercises 11.5, 11.6, 11.8, and 11.9
Deitel's solutions to 11.5, 11.6, 11.8 and 11.9 are available here
04/08 Regex Lecture/PW Six
   On-line agenda interface
Chapter 12 PW Six
04/10 File I/O Lecture/PW 6 Chapter 12 PW Six
04/15 RegEx and CGI Lecture/PW 6 Chapter 16 (CGI) PW Six
04/17 CGI PW 6 Chapters 1-12 Self-Review 12.1, 12.2, 12.3, and 12.4
Programming Exercises 12.5 and 12.6. Input file for Exercise 12.6 is available here
Quiz Three given in Spring 2007.
04/22 Quiz Three PW 6 demo due Chapter 12 and
Perl format primer on the web.
Programming Exercises 12.7 and 12.8. Please, have your solutions to 12.5 and 12.6 (assigned on 04/17) on Thursday in class.
04/24 Formatting Lecture/Lab
lab description
lab files
Chapter 13 pp. 400-432. Self-Review Exercises 13.1, 13.2, 13.3 (a, b, c, d), and 13.4.
Exercise 13.5 p. 438
   Solution to 13.5
04/29 Formatting and References Lab
    lab description
Chapter 13 Complete labs of April 24 and April 29.
05/01 Multi-dimensional Data Structures PW 7
    Today's files
    Matrix multiplication
    Solutions to 1-4.
Chapter 14 Self-Review 14.1-14.3.
Programming Exercises 14.5-14.7.
05/06 Multi-dimensional data structures Today's lab
RLE information
Chapters 1-14 Prepare for Quiz 4
05/08 Multi-dimensional data structures Quiz 4
sample programs
   
05/13 Final Review      
05/21 Final Exam      

©2007-2008 Natasha Khuri