Category Archives: Free Software

Pretty Printing C++ Archives from Emails

I’m just putting this here because I nearly managed to lose it. This is a part of a pretty unvarnished BASH script for a very specific purpose, taking an email file containing a ZIP of submitted C++ code from students. This script produces pretty printed PDFs of the source files named after each author to facilitate marking and annotation. It’s not a thing of beauty. I think I’ll probably write a new cleaner version in future.

 

 

OPUS and Assessment 3 – Regime Change

This is the third and final article in a short series on how OPUS, a system for managing placement on-line, handles assessment. You probably want to read the first and second article before getting into this.

Regime Change

It’s not just in geo-political diplomacy that regime change is a risky proposition. In general you should not change a regime once it has been established and students entered on to it. If you do, there is a risk that marks and feedback will become unavailable for existing assessments, or that marks are calculated incorrectly and so on. Obviously it is also non-ideal practice for the transparency of assessment.

Instead you should create a new regime in advance of a new academic year, change the assessment settings in the relevant programmes of study to indicate that regime will come into force in the new year, and brief all parties appropriately. All of this is done by the techniques covered in the first two articles. If you have done all that, well done, and you can stop reading now.

This article is about what to do if students are on a given assessment regime in OPUS, and somebody decides to change that regime midstream, when marks are already recorded for early items.

TL;DR DON’T DO THIS, TURN BACK NOW!

This shouldn’t ever happen, as noted really you need to ensure your regime changes are correctly configured and enabled before any students start collecting marks.

And yet, it does happen, or at least it has happened to me twice that I have been asked to make tweaks to a regime where student marks already exist. Indeed it is happened to me this week, hence this article.

Even changing small details like titles will effect the displayed data for students from previous years. Tweaking weightings could cause similar or more serious problems.

So what happens if we create a new regime and move our students onto it midstream? Well, the existing marks and feedback are recorded against the old regime, so they will “disappear” unless and until the students are placed back on that regime.

If you want to do this, and copy over the marks from the old regime into the new regime, there is a potential way to do this. It is only been used a handful of times and should be considered dangerous. It also probably won’t work if your original marks use a regime where the same assessment appears more than once in the regime for any given student.

But, if you’re here and want to proceed, it will probably be possible using what was deliberately undocumented functionality.

You will need command line, root access (deliberately – this is not a bug), in order to do this. If you haven’t got root access you need to get someone who does so you can… Read all the instructions before starting.

0. BACK UP ALL YOUR DATA NOW

Before contemplating this insanity, ensure your OPUS database is backed up appropriately. I’d also extract a broadsheet of all existing collected assessment for good measure from the Information, Reports section of the Admin interface.

That said, this functionality deliberately copies data, it doesn’t delete it – but still.

0. NO REALLY, BACK UP ALL YOUR DATA NOW, I REALLY MEAN IT.

 

Ok, you’re still here.

First of all this approach only makes sense (obviously) if the marks you have already captured are valid. I.e. the assessment(s) you want to change are in the future for the students and haven’t been recorded. If not, then obviously OPUS can’t help you do anything meaningful with the marks you have already collected.

1. Make your New Assessment(s)

Maybe you plan to just change from one stock assessment to another, or perhaps you want to adjust a weighting on an existing assessment that hasn’t been undertaken by students in this year. In this case, you can skip this step.

But if needed, create and test any new assessments following the approach laid out in the second article in this series. Do make sure you spend some time testing the form.

2. Add and Configure a New Assessment Regime

Create your new assessment regime, as detailed in the first article, but don’t link it to any programmes yet.

Your new regime should be configured as you wish it to be. Remember, for there to be any point in this exercise, the early assessments already undertaken by the students need to be the same (though not necessarily in the same order) – otherwise OPUS can’t help and you need to sort out all the marks in transition entirely manually.

3. Note the IDs of the Old and New Regimes

Things start to get clunky at this point. Remember, we are heading off road. You will need the database ID of both the old regime and the new one.

You can obtain these by, for instance, going to Assessment Groups in the Configuration menu and editing the regimes in turn. The URL will show something like this:

URL

At the very end, you will “id=2” so 2 is the id we want. Write these down for both regimes, noting carefully the old and new one. It’s almost certain the new id will be larger than the old one.

4. Choose your timing well

You want to complete the steps from here on in, smoothly, in a relatively short time period. It is advisable that you switch OPUS into maintenance mode in a scheduled way with prior warning. This can be done from the Superuser, Services menu in the admin interface, if you are a superuser level admin – if you aren’t you shouldn’t be doing this without the help of such a user. You can also enter maintenance mode with the command line tool.

5. Use the Command Line Tool with root access

OPUS ships with a command line utility. With luck, typing “opus” from a root command prompt will reveal it. It’s usually installed in /usr/sbin/ and may not require root access in general, but it most certainly will insist on it for this use.

OPUS Command Line Tool

 

 

 

 

 

 

 

 

If that didn’t work, go find it in the cron directory of your OPUS install and run it with

If you needed this to work, you’ll need to use instead of just using “opus” in the next command. We need a command called copy_assessment_results and you’ll note it’s not on the list. It’s not on the dev_help list either, because … did I mention this is a stupid thing to do? You need to enter in the command as follows changing the id for old and new regimes to be those you wrote down in step 3. All on one line.

Don’t run this more than once, the code isn’t smart enough not to copy over an additional set of data with possibly “exciting” results.

This copies assessment results and feedback, and marks from one regime to another. It’s potentially wasteful but it can’t identify the correct students and doesn’t delete data as an obvious precaution.

6. Enable the New Regime for Students

Even in maintenance mode, Superuser admins can log in and act. You can switch over your regime now. Maybe do this for one programme and test the results before using the bulk change facility discussed in the previous article.

With luck you will see your shiny new assessment regime with the old marks and feedback for the existing work in the old regime copied over. Older students on the old regime should still show their results and feedback correctly.

If not – well, this is what that backup in step 0 was for, right? And you’ll have to do it manually from the broadsheet you exported as well.

7. Re-enable Normal Access

Either from the command line tool with

or from the Superuser, Services menu, re-open OPUS for formal access.

8. Corrective Action

Explain to relevant colleagues the pain and stress of having to do this and that in future all assessment regime changes should be done appropriately, before students begin completing assessments.

OPUS and Assessment 2 – Adding Custom Assessments

This is a follow on to the previous article on setting up assessment in OPUS, an on-line system for placement learning. You probably want to read that first. This is much more advanced and requires some technical knowledge (or someone that has that).

Making New Assessments

Suppose that OPUS doesn’t have the assessment you want, then you will have to build your own, from scratch, or by modifying an existing one. This takes some minor HTML skill and access to your OPUS code to add a new file. So if you can’t do this yourself, ensure you get appropriate support.

Look at an existing assessment closely first. Go back to Advanced on the OPUS admin menu, and then Assessments.

For each assessment, clicking on Structure allows access to underlying variables that are captured. These can be numeric, text, or checkboxes, and some validation is possible too.

The Structure of an Assessment

you need to work out what things you will capture, and create a skin for the assessment, most usually from modifying one from another. This following snippet from a related Smarty template shows this is just HTML, but OPUS, through Smarty drops in an $assessment variable that gives access to any existing values, and any validation errors.

This is a representative snippet. You can see this full template here. Note the “special” code in between braces { }. The variables in the template pertain to the names in the structure.

Create and Save Your Template

Create your template, probably using one of the existing ones to help you understand the format. This provides the layout and skin for your pro-forma and allows you to do anything you can wish with HTML/CSS. Be mindful of security considerations, but you aren’t writing main code, just an included bit. OPUS will top and tail the file for you when it runs.

Save it under the templates/assessments directory in your OPUS install. I recommend you make a subdirectory for your institution.

Avoid using the “uu” directory. This is used for pre-shipped assessments and those used at Ulster University. There is a chance your changes will get clobbered by a new OPUS version if you put your template in there.

Adding the Assessment variables into OPUS

Then you need to create your new Assessment item itself as at the top of the article. Once you have created it, click on structure and add each variable you will capture in turn, whether it is text, a number, or a checkbox, and any simple validation rules – such as minimum or maximum values.

The final detail of one variable
The final detail of one variable

The description appears in feedback and validation, so make sure it is meaningful to the end user. The name is the variable name as it appears in your template. The weighting field is used to determine if numeric values contribute to the score. Usually use 1 if you want the score to be counted, and 0 if you want the score to be ignored. Finally you can choose whether each field is compulsory or not. Optional fields will be ignored in a total when OPUS creates a percentage.

Once complete, add your new assessment into a test regime as detailed in the first article and do some careful testing before adding the regime to live students.

OPUS and Assessment 1 – The Basics

OPUS is a FOSS (Free and Open Source Software) web application I wrote at Ulster University to manage work based learning. It has been, and is used by some other universities too.

Among its features is a way to understand the assessment structure for different groups and how it can change over years in such a way that legacy data is still correct for audit.

You don’t have to use the in-built assessment functionality in OPUS, but the features were written to promote transparency of assessment, and ensure all stakeholders could easily access assessment information for a student.

So here’s how to do it, it takes a bit of set-up but then should run smoothly until you ever decide to change how you assess. This is one of a short series on the matter.

Assessment Regimes

OPUS uses a “bank” of individual assessments that can be built from different weightings into as assessment regime. To be precise OPUS provides a means of capturing the rubric for each assessment and the feedback to students. Each assessment has a Smarty template which “skins” the assessment form. These can be found in the Assessment section of the Advanced tab of the admin interface.

A list of OPUS assessments
A list of OPUS assessments

For most people using OPUS, you build an assessment regime from these components in a pick and mix fashion. Head to the Configuration tab, and select Assessment Groups. This may well be empty, in an out-of-the-box install, in which case create a group with an appropriate name and some commentary on what it is for.

A list of Assessment Groups
A list of Assessment Groups

Once you have a group, you will see an option to edit the regime that is associated with it.

A typical assessment regime.
A typical assessment regime.

When we add an item, a dialog appears to enter some information.

A regime item.
A regime item.

In this we pick which of the assessments from the very start we want to use, you might decide, for instance, to use the same assessment twice in a given regime, at different stages. Give the student a description of what the assessment name should be for them, a weighting (which could be zero for formative only assessments).

You can also specify who should assess this – it could be the academic tutor assigned to the student, the workplace supervisor, the student themselves or labelled as “other”.

The year is specified in relation to the year of placement, and should usually therefore be zero. Finally start and end are the month and day (MMDD) for when work should begin on such assessments, and the deadline. These are used to help prompt staff and order assessments for students.

Adding Regimes to Programmes

Once an assessment regime has been created, you need to tell OPUS you want to use it with students in a given programme.

Go to Configuration and then Organisation Details and get to the school of study that’s relevant and pull up their list of programmes. For each programme you can click on assessment, from here you can select which regime is appropriate for the programme, and the year in which the regime started and ended being valid. You can leave out an end year to let the decision roll on.

More often than not you wish to apply these changes to at least a School. Clicking on Bulk Change Assessment will allow you to select all the programmes within a School, the new assessment regime you want and the start year, and it will do the rest.

Once you have done this the functionality in OPUS to show the assessments, their structures and marks, and to enable marking will appear for all relevant students and the staff working with them.

Sample Assessment Information
Sample Assessment Information

A table like that above will appear under each related student (this one is dummy information) and students can click view to see the pro-forma whether complete or not to understand how they will be assessed, or what the results were as appropriate.

An assessment pro-forma
An assessment pro-forma

Naturally staff who have no business with a student cannot see the marks or information pertaining to them.

When completing an assessment on a student a member of staff has 24 hours to edit their findings before the results “lock” and can only be removed by an administrator – this allows most minor errors to be corrected.

Boot problems with systemd? Check /etc/fstab

My (actually this) Debian server failed to boot after a power failure last week, it turns out the graphics card failed too, probably because of the cold and the thermal shock, but replacing the card did not allow the computer to boot.

With systemd, if something happens in the boot process, despite some obviously specific failure triggering the problem, it tends to fob you off with a message to run

This feels like the machine equivalent of “Hey, I just saw some needle go past that broke the machine. Let me hand you a haystack so you can find it.”

The command that is a whole lot more useful, is:

which allows much more rapid diagnosis of many problems. In my case the whole thing turns out to be an old line in /etc/fstab – an obselete line to mount /proc/bus/usb. It shouldn’t have been there anymore, but I am slightly amazed and irritated that the whole boot process was abandoned because of one line in /etc/fstab.

But hopefully someone else in this situation will find the suggestion to check that file first useful.

Manually completing a botched django migration

I wrote a lot of code for my Workload Allocation system on Friday, and had been developing it on the machine with django’s built in lightweight web server, and a (default) sqlite database backend. In production I decided to use a MySQL backend in case sqlite was, well, too lite.

One of the things that is really neat about django, but which also profoundly scares me, is that it handles changes to the database schema automatically. I am used to doing all of this by hand. It has been a pleasant change, but I wondered what would happen if it went wrong.

Which it did on Friday. The migrations had worked perfectly well on the development server and after some testing I decided to roll the code into production, whereupon the migration failed. I’m still not sure why, but something in the django deep magic failed. To make things worse the process is, I have discovered, not idempotent, and trying to run the migration again caused it to fail in new places because some of the database schema changes had been successful; so it was now bailing out with “already exists” kind of errors.

Removing some tables and trying again didn’t quite do the trick. I thought about trying to fix the schema manually, since with the mysql command line tool I could see what fields needed to be added, but upon inspection the restraints added by django were complex and I was unsure how important they were.

So this is my clumsy workaround, that will no doubt come back to haunt me.

I used the following commands from the top of the django app directory to find the name of the migration that was failing, and than used –fake to force django to forget about having to apply it.

I then created a “manual” django migration that added the new fields.

It turns out that getting the dependency right at the top is very important, it needs to be previous migration.

The name of this script is important, follow the naming convention of your most recent failed migration, changing auto to custom and the timestamp appropriately. I discovered that django, would not run this migration. It detected a conflict with the previous migration that should have created the fields and wanted me to try and merge them. That would be pointless since the previous migration failed. I also discovered to my surprise there was no –force command line switch to override this logic, though Google perhaps suggests that previous versions of django allowed this.

So, I used the sqlmigration django command to output the correct SQL that it would produce if this migration did run. Once I got it showing in the shell, I forwarded this to a file.

Finally I used the mysql command line tool

to get access to the database, and then used the following command to import and run the SQL produced above.

And so far so good. I had been getting Server Errors on pages relating to the botched model before and at the moment they seem to be behaving correctly. Hopefully this may help you and not come back to haunt me.

Workload Allocation Monitoring (WAM) Prototype

I decided to start writing a workload allocation monitoring system for Higher Education. I found one written as part of a JISC project at Cambridge, but despite my experience with PHP I found it difficult to set-up, a bit crude (sorry) and hard to maintain. It was clearly very flexible, and I wanted something flexible, simple and clean.

So I decided I’d try writing something quickly using the Python django framework. This is my first web-app written in Python and so I dare say I would do some things differently with more experience, but I have now reached the point where I have a workable prototype that I can start to use myself. I’ve got to say, I found django to be pretty neat.

At its heart is a list of the loads against Academic Staff in a department or school. The idea is to try and increase transparency. There are problems with this approach: some known irregularities of loading can be for confidential reasons; small numbers of staff with key skills can cause issues as well, but it is intended to provide a basis.

Overall loads for staff.
Overall loads for staff.

 

 

 

 

While classically the word semester implies that there are two of them, most Universities operate a three semester system with the third covering the Summer. Unevenness in loading over the Summer is another cause of potential trouble, so the system tries to show loading as spread across semesters. A scaled column accounts for staff who do not have a 100% FTE contribution but their hours are up-scaled for comparison.

Naturally staff will want to see some granularity of these loads and they are broken into individual activities that are allocated to given members of staff.

Breakdown of activities for a staff member.
Breakdown of activities for a staff member.

An individual activity can be specified as occupying a number of hours, or alternatively a percentage of a staff member’s time. It can occupy one or more semesters (in which case it is spread evenly across them). Types can be allocated for activities to help track contributions of different types. It might be that an activity is related to a module or study, or not.

Activities are long term parts of work allocated hours or a percentage of time.
Activities are long term parts of work allocated hours or a percentage of time.

Speaking of modules basic information is stored for these, and another issue I think will help, tracking the submission of exams and coursework through various QA processes.

At a glance the most recent information about the exam and coursework status can be seen.
At a glance the most recent information about the exam and coursework status can be seen.

While activities are considered to be events with long engagements, another issue for staff are tasks that are allocated to them, usually of comparatively short duration. It can be hard to staff to remember all of these tasks, and hard for manager to follow up their completion, especially without annoying staff who have completed them already.

Tasks can be allocated against individual members of staff or groups or both.
Tasks can be allocated against individual members of staff or groups or both.

The web-app will allow tasks to be defined against one person, many people, categories of people and so on.

A list of tasks and their deadlines.
A list of tasks and their deadlines.

 

 

 

 

 

It is possible to easily see which tasks are still open and whether their deadline has come and gone.

The staff required to complete a task are shown, and those that have indicated completion. The system politely nags those still outstanding.
The staff required to complete a task are shown, and those that have indicated completion. The system politely nags those still outstanding.

A look at a given task will show who has completed it and who still needs to.

A given staff member can sign off their own task.
A given staff member can sign off their own task.

 

It is often the case that admin and clerical staff check off colleagues who have responded to a given call, so the system allows for staff with given permissions to indicate someone has having completed the task. Alternatively the member of staff can do this for themselves.

So while it is still a bit rough and ready I’ve reached the point where the system is stable enough for use. Of course the challenge comes when we consider the assumptions to come up with the hours and percentage loading in the first place. So I hope to pick the brains of some colleagues about this and start testing the system.

I’ve yet to make a formal release, but the code is Affero GPL (you can use the code free of restrictions (and charge) but cannot deprive others of the same freedom on derivative works) so feel free to have a look at it.

My roadmap for an initial release can be found on foss.ulster.ac.uk, where I will eventually host the code as well, but at the moment it can be found at GitHub. My previous post detailed how to get the app to work with a central authentication system your University likely has, or something similar.

Yeah… design and CSS is not my strongest skill, more work to be done on that.

Share and enjoy.

Django, CAS authentication and Apache

I am certainly no stranger to Web Development, but I decide to really look at the Python web framework django in some detail last week to write a small web application for Workload Modelling for Academic Staff.

Yes, this is a geeky, programming post.

In doing so I ran into some trouble trying to get CAS authentication to work with the app. I tried using a django-cas client I found, having found no direct CAS support in django. This took a reasonable number of code modifications, in several source files (really only a pain because I would have to maintain both development code and production code on different authentication). However the critical problem was that while I could get authentication into the “userland” parts of the app, I was getting redirect issues with the django generated administration interface.

So, I found a totally different approach. Django does have generic remote user support built-in which I hadn’t initially found. There are some details here. As you can see there are only two lines of code needed to enable this support.

I found this worked without any drama when I used Apache to force the CAS authentication. So the code required (in version 1.8 of django) is simply as follows, in the settings.py file.

The Apache Configuration looks something like this.

You will need to ensure you have Apache’s CAS and wsgi modules installed and enabled too.

I wasted a couple of hours going around the houses on this one, so hopefully it may save you. I will be hosting the project for my modeller on foss.ulster.ac.uk along with the code once I move it from GitHub.

OPUS and ASET, ten years on

Ten years ago today, I and a few colleagues from Ulster University presented some of our work on on-line Placement Management at the ASET conference in York. At that time our system was simply called the Placement Management System or PMS, and yes of course this led to more than a few comments.

At that stage we had been working on the project for some 5 years, so it’s a useful reminder just how much time I ended up spending on that project.

Now called OPUS that system still exists, was released as Open Source and was and is used by a number of Universities. Though Ulster is developing an alternative system it hasn’t yet subsumed all the functionality in OPUS and I’m back to maintaining the system in a low key way.

I recently fixed some bugs introduced by a well meaning volunteer over two years ago, which felt quite good – while they were low on impact they were irritating in some aspects of usage. In the process I found that our custom framework, written by myself and Gordon Crawford for version 4 of both OPUS and the PDSystem to work with the Smarty Template Engine, is broken with Smarty version 3.

I intend to fix that problem, and do what may be a last release of OPUS, which will bring some improvements in speed, and localisation and internationalisation. Of course the source is still available directly from the version control on the site, so nobody has to wait on me – but I’ve had some recent queries from HEIs in India, so there is still interest in the system and its Debian packaging.

For those wanting the walk down memory lane, and for my own archival purposes, those slides from ten years ago are here: aset-york-pms-2005-09-05.

Upgrading from Serendipity to WordPress on Debian

As you may have noticed, I have upgraded from Serendipity, which was creaking a bit, and seems to no longer be supported by Debian to WordPress. It was a moderately complex task, as I wanted to preserve backwards compatibility and a lot of content with mathematics and code.

I installed the Debian package, and tried to follow the instructions on the Debian wiki but they are perhaps out of date. I got an error trying to setup the database, but found it was there and functional.

I  then used this excellent script to help import the old serendipity data. It wasn’t without problems, the script needed to be placed (on the Debian installed package) under /var/lib/wordpress/wp-content/plugins/ within a directory to be registered by WordPress as a plugin, but I got that working in the end.

This was an attempt to preserve ID fields as well. It seems to have worked – which has simplified redirects (see below). Comments have been “flattened” as the script warned, and there’s clearly a character-set issue here and there, but these weren’t serious issues for me. Your mileage may vary.

I found a good plugin for GeHSI style code formatting which I was using in Serendipity, albeit the syntax is very slightly different so I have some work to do editing a few entries (I don’t want to attempt a global SQL regexp find and replace if I don’t have to). I found this excellent seeming plugin for Latex and switched it into site-wide mode. So far, checking a few old articles, it JustWorks (TM).

Some of my old posts have images in the serendipity media folders that will need moved, but I was keen to have links to the old blog redirect automatically. I was able to use

in my Serendipity Apache configuration to jump to the new articles.

I can start to dismantle the rest of serendipity, except for the media, quite soon now. It’s nice to have a platform that respects multiple device layouts, and hopefully comment spam will be easier to control too. A sample of most articles show they render OK, there are a few gotchas, and I’ll try to work through them in time.