Posted by & filed under Work.

Recently the college decided to implement a piece of software that allows professors to assign students math homework via the web.  Professors can pick a bunch of math problems from a library of math problems, students do the work, and they are given grades.  Fairly simple really.

The install process wasn’t so easy.  To be fair there are instructions for installing WebWork on Ubuntu 10.04 but if you deviate from the instructions you have to start all over again.  I learned that when I tried to install it in the /var/www directory rather than the /opt directory it asks for.  Luckily a friend had warned me, so I only made that mistake once.

We’ve made the decision to migrate from the MAA (which hosts WebWork if you have under 100 users) to our own installation.  Unfortunately, we’re doing it this week and I just got the archives of the courses last week, so I’m in a mad dash to figure out how to do all of this.  And of course, in true Rosalyn format, I’m going to write a blog post on the topic.  Hopefully these instructions will come in handy this summer as I move the rest of the courses to the WebWork server and figure out LDAP authentication for the system.  So here it goes, I know how much you all love this:


1) Determine what Archives I need to Migrate

So when I requested the archives from the folks at MAA they sent all of our courses, even older ones.  But nothing in the course name indicated what semester these archives were from.  So I needed to figure it out on my own.  After extracting one course, I noticed there was a log directory with two files, one that talked about when people submitted answers and one that showed the last time users logged in.  Beautiful.  I decided to go with the answers log, since I felt that would be a more accurate portrayal of when the course was from.  I extracted each one separately and just took a peek at the last entry.

tar -xvf {tarball.tar.gz} {path/to/file}

Turns out there were only three current courses that needed to be migrated.  And then luckily one professor said they would continue using the MAA server until the end of the semester (and option we offered them).  Yay.  Less work for me.


2) Import the Course

So the first step is to move the archives to the server.  Now in order to unarchive the course, they need to be in the /opt/webwork/courses folder.  I sftped the files to my server, and then went into the admin interface and clicked unarchive course and followed the prompts.


WebWork Unarchive Course

WebWork Unarchive Course

When all was said and done I couldn’t log into the course.  This was the moment that everything that I thought was slightly off about the software came to make sense.


3) Change the Admin Password

So each course gets their own tables in the webwork database:

  • coursename_key
  • coursename_password
  • coursename_permission
  • coursename_problem
  • coursename_problem_user
  • coursename_set
  • coursename_set_locations
  • coursename_set_locations_user
  • coursename_set_user
  • coursename_setting
  • coursename_user

No you’re reading that right.  There isn’t a global table for users and passwords, there are user and password tables for each course.  I know, I know…my normal form loving brain hurts thinking about it too.  But I guess it makes it easier to maintain each course??? (I’m really trying to be an optimist)

Since I don’t know the password for the admin user I realized I needed to change the password if I wanted to be able to get into the imported courses.  So I went into the database on my server and ran a select query so I could find the hashed up password of an account where I knew the actual password.

select * from coursename_password;

For some added annoyance WebWork can use spaces and other characters that you wouldn’t normally include in a MySQL table name.  I have actually never run across this before so I wasn’t sure what to do.  I tried containing the table names in single quotes and double quotes.  Turns out you need to use the accent mark located below the tilde on your keyboard.  Yay for trial and error.

So once I got the hashed up password of an account I knew the password for, I updated the table for the newly imported course in WebWork:

update `coursename_password`
set password = "<newhashedpasswordhere>" where user_id = "admin";

Once you’ve done that you should be able to log in to the course as the admin user.

Comments are closed.