## Forum archive 2000-2006

### Arnold K. Pizer - Command line scripts

by Arnold Pizer -
Number of replies: 0
 Command line scripts topic started 4/27/2000; 3:58:01 PMlast post 4/27/2000; 3:58:01 PM
Arnold K. Pizer - Command line scripts
4/27/2000; 3:58:01 PM (reads: 5646, responses: 0)

### Description of all scripts and their commmand line arguments

Running any script without command line arguments will display a help screen listing the correct syntax for the required command line arguments.

alternateScoreProbSet.pl classID set5.def Takes two command line arguments. The first is the classID. The second is the set definition file.
E.g. alternateScoreProbSet.pl MTH140A set5.def.
Creates the data sets s5scr.csv and s5ful.csv. Similar to scoreProbSet.pl except that this script gets data from the .sco files instead of from the database. Also the list of problems and their respective values are taken from the set definition file. Used only when the database has become corrupted or lost.

columnPrint.pl inputFile outputFile Takes two command line arguments. The first is the full file name of the delimited input file. The second is the full file name of the output file (these names may be the same).

This script takes any delimited (with $DELIM delimiters) file and adds extra space if necessary to the fields so that all columns line up. The widest field in any column will contain exactly 2 spaces at the end of the (non space characters of the) field. For example ",a very long field entry ," at one extreme and ", ," at the other assuming that$DELIM = "," .

deleteLastColumns.pl classID s5ful numberOfColumnsToDelete Takes four command line arguments. The first is the classID. The second is the filename (with or without the extension), the third is the first column of a range ofcolumns to delete, the fourth is the last column of a range ofcolumns to delete.
E.g. deleteLastColumns.pl className s5ful 14 24  or deleteLastColumns.pl className s5scr 9 13or deleteLastColumns.pl className s5scr -6 -2.
Note that "ful" files contain 2 columns for each problem (a corr' and an incorr' column) where as "scr" files contain 1 column for each problem (a score' column).

l2hPrecreateSet.pl classID set1.def Takes two command line arguments. The first is the classID. The second is the set definition file. It also takes one or two additional optional arguments. E.g.
 l2hPrecreateSet.pl MTH140A set1.def
 l2hPrecreateSet.pl MTH140A set1.def 30000
 l2hPrecreateSet.pl MTH140A set1.def 30000 60000
Pre-creates latex2html output for each student for a problem set so that WeBWorK doesn't have to run latex2html in processProblems. The script will not recreate latex2html output if it already exists. Problems are pre created for all psvn's between lower and upper limits if the limits are given.

l2hPrecreateProb.pl classID set1.def 3 Takes three command line arguments. The first is the classID. The second is the set definition file. The third is the problem number. It also takes one or two additional optional arguments. E.g.
 l2hPrecreateProb.pl MTH140A set1.def 3
 l2hPrecreateProb.pl MTH140A set1.def 3 30000
 l2hPrecreateProb.pl MTH140A set1.def 3 30000 60000
Pre-creates latex2html output for each student for a single problem so that WeBWorK doesn't have to run latex2html in processProblems. The script will not recreate latex2html output if it already exists. Problems are pre created for all psvn's between lower and upper limits if the limits are given. Used e.g. after modifying a single problem in a set for which the images have already been pre created.

newpassword.pl classID loginName newpassword Takes three command line arguments. The first is the classID. The second is the loginName of the student. The third is the new password. E.g.
 newpassword.pl MTH140A cr001f mynewpassword
Creates a new password for cr001f. Can be used to change a password (e.g. to replace a lost password) or to add a new student to the password and permission file. It is best to change passwords and add new users from the web interface.

This is a specific routine for reading class lists which come from the registrar's office at the Univ of Rochesterand producing a classlist file usable by WeBWorK. It can be used as a sample for creating scripts to read class lists from other schools.

IT IS ASSUMED THAT THE REGISTRAR'S LIST IS DELIMITED WITH SEMICOLONS (;)

Takes three parameters. First, the full file name of the Registrar's class list file with the header material stripped off. Second, the full file name of the output WeBWorK classlist file. Third, the name of the section, e.g. Pizer or "Gage MWF" or "" (blank).
E.G.  readURClassList.pl reglist.txt MTH140A.lst "Pizer MWF9"
Classlist files from multiple sections can be concatonated into one large classlist file for a whole multisection course.

rebuildProbSetDBfromPSVNlog.pl classID set5.def mth140a.lst MTH140A_set:1_bak1.psvnlog Takes four command line arguments. The first is the classID. The second is the set definition file. The third is the classlist file. The forth is the psvnLogFileName. The psvnLogFiles are located in logs subdirectory of the main course directory.
E.g. buildProbSetDB.pl MTH140A set3.def mth140a.lst MTH140A_set:1_bak1.psvnlog.
This script takes the information in the set definition file and builds a problem set for all students in the classlist whose status in the classlist file is not "drop" or "withdraw" WHO ARE ALSO LISTED IN THE psvnLogFIle. For those students it recreates the problem set with the original psvn's and seeds so that the rebuild problem set will be identical to the original set. This script will not overwrite any information already in the database so it is safe to run it with an augmented classlist. Everytime buildProbSetDB.pl (or rebuildProbSetDBfromPSVNlog.pl) is run a log file (MTH140A_set:1_bak1.psvnlog, ..bak2..., etc) is created containing all psvn's and seeds entered into the database. If no psvn's are entered, an empty psvnLogFile will be created. In order to rebuild a set it may be necesary to run rebuildProbSetDBfromPSVNlog.pl several times starting with the bak1.psvnlog file, then the bak2.psvnlog file, etc. If a set gets corrupted, one can delete the set and rebuild it. Note that if one deletes a set, the .sco files and problem status are all deleted so unless one has already run scoreProbSet.pl, all scoring info for students who have already worked on the assignment will be lost. You might want to rename (mv) the .sco files before deleting a set. that in the setdefinition file the setNumber has not changed and that the number of problems has not changed. Usually the set definition file will have not changed althought one could change the due date and/or problem values.

recoverDataSet.pl classID s5bak3.bak Takes two command line arguments. The first is the classID. the second is filename (with or without the extension) of the backup data file, e.g. s5bak3.
E.G.  recoverDataSet.pl MTH140A s7bak3
Produces new versions of the corresponding ful and scr files, e.g. s5ful and s5scr. For example every time scoreProbSet.pl MTH140A 5 is run, a read-only backup file  s5bak1.csv, s5bak2.csv, ... is created. Normally, scoreProbSet.pl MTH140A 5 will be run only once and recoverDataSet.pl s5bak1 would only be run if the files s5ful and s5scr` were severely corrupted.

Notes:

Most files must be in the templates directory (or subdirectories) or in the scoring directories or subdirectories. Their paths are given relative to the templates (or scoring) directory.

The conversion script columnPrint.pl is an exception --it assumes that the path is relative to the current directory.

In order to use these scripts freely (without specifying the full path name to the script) you should either put the scripts file in your path, or define aliases for the scripts which you use frequently. If you use the latter method (and only teach one course) you have the freedom to define the alias so that the classID is automatically included in each command and/or to abrreviate the command name.

<| Post or View Comments |>