Verifying Students have Posted to the Newsgroup

WARNING! This document should be considered transitional; it will need to be edited as it is confirmed fixed up and translated appropriately for BitterSuite.

A utility that will download posts from a newsgroup, newsarchiver.py, is attached to this document (the Wiki insists on appending .txt... just rename it). It will be wrapped by a program similar to the following:

#!/bin/bash

export PATH=`/bin/showpath gnu standard`
cd /u/cs135/newsgroup
./newsarchiver.py uw.cs.cs135 >/dev/null
tmpfile=a0_late.$$
realfile=a0_late
grep '^From: ' `grep -l '^References: $' *`\
        | perl -lne 'print $1 if /\<(.*?)@.*uwaterloo\.ca\>/' > $tmpfile
mv $tmpfile $realfile

Changes that can/should likely be made include:

  • Using #!/usr/bin/env bash as the language; the Solaris /bin/bash is ancient, and a newer one will be selected from the PATH.
  • Ensuring this script is in the same directory as newsarchiver.py (which it was anyway), so that the cd line should be able to be changed to the less fragile cd $(dirname $0).
  • sed 's/late/done/g'? The marking script seems to look for done; this was likely a mid-term modification so students could continue submitting to the assignment after the deadline.
  • Making the use of a command like whoami to avoid hard-coding in a particular course name.

The test.exe program can then take an action similar to the following:

#!/usr/bin/env bash
POSTS="/u/$course/newsgroup/a0_done"
if [ `grep $student $POSTS |  wc -w` -gt 0 ]; then 
        echo '100' >&3
        echo "The appropriate email address was used for a newsgroup post."
else
        echo '0' >&3
        echo "An e-mail from $student's uwaterloo address was not found on the newsgroup."
fi

This will need to be verified in BitterSuite once the proper facilities are built in...

Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt newsarchiver.py.txt r1 manage 5.7 K 2009-07-23 - 14:15 TerryVaskor Utility that will download newsgroup articles
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2009-07-27 - TerryVaskor
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback