Archived News Item
Good, Fast, Cheap
[Friday Sep 26.03 ¬ 5:35 PM]Good, fast, cheap — pick any two.
This time it was cheap and good, but obviously took a while. However, what’s done is done, and this is done; the Daily Bulletin Update page is alive and ready.
Basically the concept here is that the BHS daily bulletin, a more-or-less daily missive containing various pieces of information, is sent out via the e-tree every day. Why is this good? It’s good because the actual bulletin is pretty hard to come by, especially now that it’s being read over the PA system rather than distributed to classrooms. So if you want to make note of something that’s mentioned in the bulletin, having it in your email is a good thing.
Except not everybody wants to subscribe to the e-tree just for the sake of getting the bulletin. So an even better idea would be for me to post the contents of the bulletin to the site every day, making it accessible to anybody who can get to the site. The only trouble is that I’m a human being, and manually doing that every day is slow, fallible, and irritating.
The best of all worlds is a 100%-automated system wherein the bulletin is sent out, hits my computer, and the site updated by the infernal digital beasts that dwell within. It’s faster than waiting for me to get home and take care of it, it’s more reliable, and it makes me a happy panda.
So that’s how it will be, and that’s how it’s done. Drop by the bulletin page whenever you want to check on it, and it will be there, ready and waiting.
[The following is a much geekier explanation of the process by which the automatic update is performed. Non-programmers or web developers will probably not be interested.]
Basically, when I sat down to do this, I felt that I had two options: Perform the updating server-side, grabbing the email as it was received and parsing it to a web-accessible page, all on the server — this made possible because the BH.org website and the email address that receives the e-tree messages (mine) are on the same server.
The other option would be to allow my personal computer to get involved, downloading the email, running a local script (AppeScript would be the most obvious choice, as I’m on OSX) outputting the email as a web-friendly format, then uploading it back to the server via FTP.
I ended up opting for the second method, mainly because the task of sniffing email content on the server, routing data around, performing permissions voodoo, and everything else involved in the necessary server manipulation, would require far more under-the-hood Unix mastery than I’ve got. I’m not too sharp with AppleScript either, but comparing the two is like choosing between learning the ABCs and learning French.
I muddled around, using the opportunity to brush up my knowledge of AppleScript and taking copious advantage of the expertise of others. The final version of the script ended up performing as follows: A rule in Mail.app is created that can identify the bulletin email (by the subject and sender); it performs the action of running a script. The script parses the contents of the message, creating a text file on my desktop called “index.txt.” Then Transmit, my FTP app of choice, is opened, pointed at the BH.org server, navigated to the correct directory, and used to upload the index.txt file (first deleting the remote version already there, to eliminate the problem of responding to the “File already exists” error dialogue).
An alternative option would have been to upload from the command line (using curl or something else), but again, Unix guts scare me, and if I’m going the pansy method of client-side scripting, I might as well use all of the tools at my disposal to ease the task.
In case anyone wants to perform something like this for their own uses, you can get the script I used here: uploader.sit.
Much thanks for the significant help on this from 2 and 2 make 5 of Subnova, and from Rob of AppleScript.net.
— Brandon
View/Post Comments (4) °