If two chickens lay a total of two eggs in two days, how long will it take 100 chickens to lay 100 eggs? In ten years of teaching, I have given this problem to every class on our first meeting, and something like eight students have ever gotten it right. If you solve it (answer next week), I have another problem for you: invent a new gradebook. In the past, I have used Easy Grade Pro (probably the best), PowerSchool (tries to solve all the problems of the world, imperfectly), and Blackboard (twelve clicks to even find the gradebook), and I have always needed a spreadsheet for additional analysis. Here’s one example. I assign and check homework every class, but if I added each of these small grades into the book, the sheer number of entries would obscure more important information, like tests.
So this fall, when I am teaching two classes at the local community college, I decided to simplify: my gradebook would be completely in Excel. I had to enter formulas for weighting grade components and so forth, but it took me less than two hours to set it up. Not rocket science.
This allowed me to enter and compute grades easily enough, but then I had the problem of communicating those grades to the students. I could have exported it to some other format (a MySQL database, for example), but it seemed simpler to just upload the spreadsheet each week. Fortunately, Excel will now save spreadsheets in XML format, which you can actually read, and PHP 5 provides a SimpleXML extension, which loads the spreadsheet into a single object. Here, for example, is what it takes to read the file and access the data at (row, column):
$xml = simplexml_load_file('../data/Grades.xml');<br />
$grade = $xml->Worksheet[0]->Table[0]->Row[row]->Cell[column]->Data;
There is a security issue, of course. The grades are in a plain text file on the web server. I want students to see their information, but not anyone else’s. So I put the database outside the public_html directory. The login page (which can work outside the box) finds the row in the spreadsheet that corresponds to the student’s ID, then displays the student’s grades. There’s probably still a security problem, and I would be grateful to hear from anybody who could tell me how to hack into this. The PHP source code and a sample of the gradebook are on the examples page.
I must tell you, I love PHP. It works on the server side, so the details are hidden away, and it greatly simplifies repetitive HTML coding. For example, each of the files on the examples page has two hyperlinks: one to view the file in your browser and one to download it. There’s a gross amount of HTML to code each file (about four lines), and there are currently eleven such files on the page (translation: 44 highly redundant lines of HTML). So I wrote a PHP function to output the HTML, and one short PHP snippet generates those four lines: <?php exampleFile('path', 'filename'); ?>
Footnotes
I know I promised last week that I would write about Flash, but Flash was not the problem of the week. So I’m going to stop making predictions.
In the new world of computing, as I noted earlier, help is everywhere. One side effect of this blog, which I did not anticipate, is that people would contribute ideas right here. George Anderson’s comments gave us three different web sites as good sources of JavaScript. Keep it coming.
[ add comment ] ( 22 views ) | permalink

Calendar



