April 2004
S M Tu W Th F S
28 29 30 31 1 2 3
^ASSIGNED
4 5 6 7 8 9 10
^DUE
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
First things first. Don't forget to think of a final project. I can now articulate my criteria for an A, after several people have made proposals and helped me figure out what I am looking for. If you just use a language to do database front-end or user-interface, that's some kind of B. If you use the power of the server to provide some extra processing or functionality or je ne sais quoi to the cgi program, then you are in the hunt for an A. So ask yourself, what is it that the server-side provides? In the image-processing stuff, it provides access to the UNIX (programming) environment, cpu, and specific programs like djpeg -scale. In the mebay stuff, it provides hi-bandwidth connectivity and caching. In the case of yahoo mail, the server can look at incoming mail across users and decide what is bulk mail. You might want a cgi front-end to a multi-player game. That's an A for just about any game. Here, you are an opponent server, not just a dynamic web page server. Did I show you gawkterm, which I use in cs100 to teach programming without requiring use of a UNIX editor? There, you are using the server for its UNIX programs, but you are using the cgi to bypass the shell and the editor.
Now, on to the hw. Do the following in php.
Let's start by supposing a calculator with 26 alpha buttons, a-z. I don't want to see images here (don't waste your time). Just use hyperlinked text. <a href=alphacalc?i=a>a</a>, for example. Permit the entry of a string, one character at a time, just like you permitted a number to be entered in your numerical calculator.
Now, add a few functions: first, last, and length, which operate on the current string (destructively) to return the first char, the last char, and the length. Add the function toupper and tolower, and also a word count. You might look at php.net/strlen to see what goodies php provides for strings.
We are going to add more interesting functions. How about substitution? You'll need to add two more strings, since substitution requires a "find" string, a "replace" string, and a target string. You should probably display all three strings in your "calculator" (it's ok to hide one numeric value in an arithmetic calculator, but hiding two strings is kind of a stretch).
If you are good, you'll add special characters for regular expressions (and you'll need the numbers, too). I don't want to see fancy GUI here -- I just want you to explore the string function library of php.