All posts by Colin

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.



Installing Android Nougat on a Stock Galaxy Tab 10.1

My daughter uses an Android Samsung tablet (coded GT-P7510) which ended official support on Android 4.0.4. Unfortunately I didn’t pay any attention to this issue until the apps she most wanted to use, namely Netflix and YouTube stopped working on it as the Android version was too low.

I found a ROM to upgrade to Android 7.1 (Nougat) with some cost – for instance, the camera doesn’t work, but Aimee doesn’t care about that. So I decided to try upgrading it since the tablet was otherwise now utterly useless.

To make things more difficult, most of the information on upgrading this tablet on the Internet is outdated or wrong, or pre-supposes that the device was long since updated. I also don’t run Windows, and ran into some problems with the Heimdall alternative.

So this quick article is the result of a couple of evenings running into dead ends. It might help someone else. Certainly if I ever need to do it again it’ll help me.

But as usual, if you break something, you own all the parts. These instructions are completely specific to this particular tablet, and the wifi only version at that. Make sure your device is fully charged before you start.

A new recovery image had to be installed first, and some steps had to be undertaken just to get that far.


First of all there’s supposed to Windows software called Odin that is used to update the ROM, especially from a stock start. I can’t run that without emulation since I don’t run Windows, and in any case, I suspect it might behave badly in a virtual machine, and probably wouldn’t run correctly on modern Windows.

So I installed a Free and Open Source alternative known as Heimdall. For me, this was simple as it was Debian packaged. I couldn’t get the frontend to be useful, and I couldn’t get the Java version of the frontend to work online or offline. So I defaulted to the command line.

So, as root on Debian GNU/Linux:

This is also ensuring all the command line tools for android debugging are installed (I already had these).

Receiving TWRP

The device needs to be made ready for Odin / Heimdall upload. Turn the device off, and then hold Power and Volume Down till it appears with two icon choices. You want the one on the right. Use Volume Up to select, and use Volume Up again to bypass the dire warnings.

I had no success in using the Heimdall frontend, your mileage may vary. I got the correct archive for my purposes from here.

I downloaded the archive, and used tar xvf to extract the contents. You will find two .img files, recovery.img and hidden.img. You’ll need both.

Note that the partition target on the device for recovery is not called recovery but is called SOS at least on my device.

Because of the no-reboot option note that the tablet will continue to warn you not to restart it. You’ll need to watch the command line progress carefully to ensure that it is on. Now reboot the machine once again into the Odin / Heimdall mode again. I.e. power it off, and turn it on with Power and Volume Down.

Now flash

For me this successfully got TWRP 3.0.3 loaded. It was a major odyssey of conflicting information to get this far. When you reboot make sure you hold down volume down to get to the recover menu, (and now choose the left hand option). If you don’t do this, the stock ROM overwrites the new one and you’ll need to start again.

Using TWRP

From here, things were relatively plain sailing. I got the ROM from here. Incidentally, I’d tried other recovery ROMs I got onto the device before when I couldn’t get TWRP onto it, they did not allow the following steps to work.

I then used TWRP’s wipe option to wipe Cache, Data, and Dalvik Cache.

I used the Advanced button and put the device into sideload mode.

I then, from the Linux command prompt executed

I then did not reboot but went back in TWRP and selected sideload again, this time I was careful to uncheck the wipe data and cache items since I’m loading other items on top of the basic ROM image.

and I repeated the same for the last package

finally I selected to reboot the tablet. It took a pretty long time to boot. Don’t forget it’s a relatively underpowered device.

The device is up and running and now runs the apps my daughter wants again.

The Deceptiveness of Coincidence

A friend of mine recently posted about a chain of events – people sharing birthdays – that was so unlikely that a lottery ticket purchase was called for. Most people might make similar comments as the oddity of these events struck them. There followed some discussion about these problems and it made me think of trying to set out the issues more carefully.

I’ve done a lecture, in some variations (for school audiences), almost every year about the deceptiveness of common sense in mathematics. Indeed, it provided the title of this blog.

The  Birthday Problem

One of the problems I examined is the famous birthday problem. Let’s look at two aspects of this.

How many people must be in a room before we are certain that two of them share the same birthday?

This can be answered by using the so called pigeon hole principle. In this case, the pigeon holes are all the days of the calendar in a year, 365, or let’s say 366 to allow for the worst case scenario of a leap year. The people in the room are the pigeons. You can place 366 pigeons into the holes and keep them all separate, but any more ensures that at least two must share one of the holes. So, similarly, you need 367 people to be absolutely sure that one pair in the room shares a birthday.

Let’s look at a more subtle question.

How many people must be in a room so that it is more likely than not that two of them share the same birthday?

It turns out this number is deceptively low. We reach a 50% chance (more likely than not) with just 23 people in the room. Perhaps even more surprisingly we reach a 99.9% chance with 70 people in the room. The calculations for the probabilities are set out in the link to the lecture, and the wikipedia article as mentioned above, but I don’t want to focus on that. I want to focus on why the result is so shocking to most people.

The issue is the collision of relatively rare events (a birthday) with numerous combinations. For instance if you want to consider how many pairs one can form in the room we can see this.

If there are three people in the room, A, B and C, there are three possible pairs: AB, AC, and BC. If there are four people in the room, A, B, C and D, there are six possible pairs: AB, AC, AD, BC, BD, and CD. There’s actually a nice formula for this and you can work this out for more examples.

You don’t need to know the formula, but if you want it is  \frac{n!}{(n-2)!2!}.

People in Room Possible Pairs
3 3
4 6
10 45
15 105
20 190
23 253
30 435
50 1225
70 2415

You can see just how rapidly the number of pairs increases. It might seem un-obvious that 23 people is as likely as not to produce a duplicate birthday, but it’s perhaps less so when you realise that we are not predicting which pigeon hole has two pigeons in it to go back to our analogy. But given 253 possible pairings, it seems less unlikely even intuitively that there will be “collisions” within one of those pairs.

Coin Tosses

Let me talk about a similar problem, flipping a (fair) coin to get a Head (H) or a Tail (T). Let’s consider that we flip the coin three times. The possible outcomes are:


These are all absolutely equally likely, and even this is sometime unintuitive. The coin has no memory of how it performed, and no desire to conform to some concept such as a “law of averages“. But we tend to categorise these 8 possible events into 4 categories.

  • Three Heads: (one way this can happen, so 1/8 probability)
  • Two Heads, One Tail: (three ways this can happen, so 3/8 probability)
  • One Head, Two Tails: (three ways this can happen, so 3/8 probability)
  • Three Tails: (one way this can happen so 1/8 probability).

In doing so, we can see why the HHH and TTT events look particularly exciting and rare. They are no more rare than any other individual outcome, but it’s the groupings of how one can get two heads that makes that collection of events more unexciting.

To take this to more of an extreme. If we flip a coin ten times, then these outcomes are all exactly equally likely.


But some will be far more remarked upon that others. But even if we have an experiment that flips a coin 10 times over and over again enough times, we will expect to see all of these (more or less, eventually) equally often, but we will probably not consider these exciting except maybe outcomes 1,5 and maybe 2.


Another example, closer to home. Let’s assume that there have been 7,500 generations of Homo Sapiens since its emergence as a species.

The probability that in each of those 7,500 generations in both your paternal and maternal line that all the pairings took place between the right people at the right time in the right circumstances to give rise to you is astronomical. You have two parents, four grand parents, 8 great grand parents and so on. Just for that collection of people. If we add you into the mix, then the number of pairings involved over these 7500 generations is


That number has 2259 digits, you can see them here on Wolfram Alpha.

That’s the number of people involved to get to you, including you. They all had to survive and meet at the right time, and um, do everything else at exactly the right time in the right way. What are the odds? And yet you are here… You might find that exceptional, and of course in a way it is, but the point is, you are not more likely or unlikely than most other human beings that have been born, or countless potential humans who might have been but were not born because their parents never even met. The fact that you specifically exist is unlikely, but the fact that if you did not someone else would exist instead is highly likely and predictable.

Naturally, however, we tend to think of our own existence rather more than some random person on the other side of the planet. But each one of us is an example of the coin flipping perfectly as needed every single time. Sometimes a Head, sometimes a Tail, but that exact perfect sequence essential to produce you. Naturally we are each quite taken with the outcome that produces us and also our nearest and dearest. But if it had not happened, we wouldn’t be here to wonder about it.

Availability and Psychology

As you can see there is more to this than mathematics and probability, there is also perception and psychology, specifically a concept called the Availability Heuristic. Some things stand out to us as being significant when they are no more significant than other events we ignore.

You might live in a city of a million people. You might personally know only a hundred. You might pass a thousand on your commute to work each day. You do that hundreds of times a year. The number of possible combinations of people you will see over a year is enormous, but you won’t remember it as a special event when you bump into all the people who aren’t dear to you.

The Anthropic Principle

A nice example of this thinking is the question that many people have asked which is essentially: why is the Universe, and our Earth, set up so nicely to allow humans to exist? If certain physical constants were just a bit different then matter as we know it couldn’t form. If we were just a bit closer to the Sun we couldn’t survive and so on.

These things are all true. But in a Universe with inappropriate physical constants there will be no matter by definition, and certainly no sentient matter like us to notice.

If the Earth was closer to the Sun, homo sapiens would not exist as it currently does, but like as not some other species would, and it would also think how perfectly the world was formed for them. This concept, that we tend to think the Universe is so special to have created us, despite the fact that if not we wouldn’t be here to think about it, is often called the Anthropic Principle.

We believe that the improbability of life itself or us as a species is an example of the collision between billions of individually improbable events with the billions of events than could have occurred, and the billions of years in which they might have done so.

We end up having to think about such things with great care because our evolution on the African savannah didn’t really equip us to consider them. So we shouldn’t be surprised that we are surprised, but we still are.

It’s the old cliché: you are unique and special; just like everyone else.

You are unique, just like everyone else

There are always dangers in imagining our special place as a species.

“This is rather as if you imagine a puddle waking up one morning and thinking, ‘This is an interesting world I find myself in — an interesting hole I find myself in — fits me rather neatly, doesn’t it? In fact it fits me staggeringly well, must have been made to have me in it!’ This is such a powerful idea that as the sun rises in the sky and the air heats up and as, gradually, the puddle gets smaller and smaller, frantically hanging on to the notion that everything’s going to be alright, because this world was meant to have him in it, was built to have him in it; so the moment he disappears catches him rather by surprise. I think this may be something we need to be on the watch out for.”

Douglas Adams, The Salmon of Doubt


Python Script To Copy a Playlist and Linked Files

Most tools for copying files onto MP3 players (often actually a phone these days) work on the basis that you copy your entire music catalogue and then make playlists linking to various files on it.

It can be a trickier process to copy your favourite selected audio files – the ones specifically used in your playlist, that usually exist in a deep structure of their own. There seem to be some proprietary tools for it, but here’s a Free (in all senses) and Open Source solution.

I adapted my previous Python scripts (that allow for files to be appended to a playlist on the command line, and shuffle a playlist from the command line) to make a – well – bit of a Frankenstein’s monster that will take a playlist as input, and copy the playlist and all its referenced file to another directory. It will create the required directory structure, but will only copy the actual music files on the playlist.

I have used this successfully to move a playlist and the selected directory structure onto more modest sized music players.

Usage looks something like this.

Have fun, use with care, and I’ll try to clean it up at some stage. If you break something, you own all the pieces, but feel free to write me a (nice) comment below.

At some point I’ll move these scripts to Python 3 and off the deprecated option handling code module.


Resistance in Aikido

If you spend a little bit of time on-line looking at what other martial arts practitioners have to say about aikido, one of the thing you note is that people with little or no experience whatsoever about aikido still have plenty to say about it.

The most common comments is that aikido has no sparring and doesn’t train against opponents offering resistance.

Let me first take the latter point. What others assert here is that in aikido dojos people don’t train to execute a technique against someone actively resisting it.

The is a little bit true, a little bit false, and a whole lot completely missing the point.

What people see as training against no resistance is the stage when beginners are learning a technique and need to understand its shape. At this stage the uke, the attacker, who ideally will be a more senior student will indeed sometimes help the other person complete the technique.

This is not dissimilar to early training in other martial arts where people punch thin air, or cut it with bokken.

However, as the student progresses you can expect the uke to be much less of a push over, literally and metaphorically – at least in most dojos. People don’t just fall over when the technique is wrong, there may indeed be some resistance. There will be a touch here and there that could have been a counter strike. How much of this resistance there should be is a point of real controversy. It is possible to find dojos who think it should always be none, and others who think it should be immense and unrelenting.

In the main there is a recognition that it does not demonstrate skill to prevent a technique that you know is coming, and so it’s poor form to do so for its own sake when people are first learning a technique.

For some people this demonstrates the inefficacy of aikido, but it’s no different than suggesting that a person in another art, knowing that a kick to the head is coming, can easily avoid or counter that.

The Way of Harmony

But the main point here is what ai ki do means – the way of harmony with ki of your attacker, or the energy of your attacker. In other words, when an opponent resists, they resist a specific thing. The whole point of aikido is not to force your technique against your opponent’s energy. Yes, you may be able to force it on. But that is not aikido. There are also tricks of the trade that can make a technique work even when it’s probably stupid to apply it, but these should be reserved for moments when you find yourself in the equivalent of having your heels on a cliff edge with tigers below.

So what should an aikidoka do, when they begin technique A and their opponent resists it? Pretty much anything other than A.  When you watch someone do aikido badly, you can see this tension all the time, the nage, the defender, has a plan to do technique A. The painful bit is that if A is not possible, the longer it takes nage to work this out, and move on, the movement between attacker and defender jams up, it is actually a point of real vulnerability, not strength for the nage.

So aikido is about learning that the instant A becomes untenable, you let go of it, and move to B, C, and so on. The more someone resists a specific thing, the more vulnerable they become to its opposite.

So coming back to the lack of “sparring”. This is actually also untrue, this kind of practice does occur in many dojos – it’s usually a different kind of sparring – and it’s valuable if controlled, but real aikido happens all the time when the initial technique goes wrong, the challenge is to realise that trying to push through resistance is completely the wrong approach.

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.


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.


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.



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:


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.

Workload Allocation Modelling Update – Scalability

I have been doing some more work on my software to handle Academic Workload Modelling, developing a roadmap for two future versions, one being modifications needed to run real allocations for next year without scrapping existing data, and another being code to handle the moderation of exams and coursework (which isn’t really anything to do with workload modelling, there’s some more mission creep going on).

Improvements to Task Handling

Speaking of mission creep I noted in the last article I’d added some code to capture tasks that staff members would be reminded off and could self-certify as complete. I improved this a lot with more rich detail about when tasks were overdue and UI improvements.

I wanted to automate some batch code to send emails from the system periodically. I discovered that using a Django management command provided an elegant way to the batch mode code into the project that could be called with cron through the usual Django script that it creates to handle its own internal related tasks for the project from the command line.

It was easy to use this framework to add command switches and configuration of verbosity (you might note I haven’t disabled all output at the moment so I can monitor execution at this stage). I have set this up to email folks on a Monday morning with all the tasks, but also on Wednesday and Friday if there are urgent tasks still outstanding (less than a week to deadline).

I’ve been using this functionality live and it has worked very well. I used Django templates to help provide the email bodies, both in HTML and plain text.

Sample Task Reminder Email
Sample Task Reminder Email

Issues of Scale

My early prototype handled data for one academic year, albeit with fields in the schema to try and solve this at a later stage. It also suffered from a problem in that if other Schools wanted to use the system, how would I disaggregate the data both for security and convenience?

In the end I hit upon a solution for both issues, a WorkPackage model that allows a range of dates (usually one academic year) and a collection of Django User Groups to be specified. This allows all manually allocated activities, and module data to be specified with a package and therefore both invisible to other packages (users in other Schools, or in other Academic Years). I was also able to put the constants I’m using to model workload into the Django model, making it easier to tweak year on year.

I’m pretty much ready to use the system for a real allocation now without having to purge the test data I used this this year. I can simply create a new WorkPackage.

I need to write some functionality to allow one package’s allocations to be automatically rolled over to the next as a starting point, but I reckon that’s maybe two or three more hours.

Future Plans for the Application

The next part of planned functionality is an ability to handle coursework and examination and the moderation process. It will be quite a big chunk of new functionality and moving the system again to something quite a bit bigger than just a workload allocation system.

This of course means I need a better Application name, (WAM isn’t so awesome anyway). Suggestions on a post card.

Django Issues

I think I’m getting more to grips with Django all the time – although I often have the nagging feeling I’m writing several lines of code that would be simpler if I had a better feel for its syntax for dealing with QuerySets.

The big problem I hit, again, was issues in migrations. I created and executed migrations on my (SQLite) development system, but when I moved these over to production (MySQL) it barfed spectacularly.

Once again the lack of idempotent execution means you have to work out what part of the migration worked and then tag the migration as “faked” in order to move onto the next. This was sufficient this time, and I didn’t have to write custom migrations like last time, but it’s really not very reassuring.

Further Details

As before, the code is on GitHub, and the development website on, if you want more details.

How Effective Is Aikido?

I based this on a response I made to the same question on Quora. But it’s a question I get asked a lot. Along with the somewhat related “how often do you need to use aikido?” which I address below.

It’s very popular for people (often who have never studied aikido) to tell other people that it takes years for aikido to be “effective” or that it is never effective. Sometimes aikidoka say this themselves. This may even be true. It’s as likely for any martial art. It certainly will be true if you believe it.

Often people hint that a short time in another martial art is effective. This may be believed of aikido too of course. However I’ve written before about the dangerous arrogance of assuming that a few hours (or indeed even years) in any given martial art confers some sort of invincibility on you. A high ranked martial artist I knew, with Dan grades in many martial arts, got effectively taken out at a bus stop because he literally didn’t see the attack coming.

But what do you mean by effective? Is it effective at maiming other people? Is it effective at killing other people? Is it effective for defending yourself in a fight? Is it effective at getting you jailed? Is it effective at stopping fights? Is it effective in your daily life? There are lots of ways of looking at this.

Usually people are asking how effective it would be in some cage based gladiatorial contest, but how often is that likely to happen outside your choice, outside finding yourself in a bad Star Trek episode stripped to the waist and compelled to fight your friends and colleagues? This doesn’t reflect the lives of most people or the situations they might find themselves in.

An argument from anecdote, but an interesting one. I had the pleasure of training in aikido with an 80 something year old English gentleman called Harold. He had begun aikido in his 50s when he was working as a bus conductor in London. He told me that in his job before starting aikido he had frequently gone to the upper deck to check tickets to find people who had long since passed their stop or otherwise had not paid. Occasionally a tussle would ensue. He wondered what would happen after he started training in aikido the next time such a tussle happened, but the interesting thing is that no tussles ever occurred again.

Who knows why? Likely his posture, his lack of fearful response or more harmonious manner. I have directly experienced these things successfully defusing what seemed an inevitable fight.

This is also interesting when people ask me and “have you ever had to use aikido?” to which the answer is, all the time, and not necessarily in the way you think. It has worked well, most of the time, but not always. Much to learn, I still have. Martial arts – at least real ones – are about a lot more than just self defence.

Effectiveness doesn’t necessarily mean winning a fight. It doesn’t necessarily mean picking a striking response to a situation that will quite likely get you arrested. It can sometimes just mean a different stance, a different approach so that fights don’t happen at all.

The Art of Fighting Without Fighting

Martial arts are full of clichés. But as with all clichés it doesn’t mean they aren’t fundamentally true. Even proponents of striking martial arts will often say the greatest skill is not to fight at all. It is the most effective way.

We live in the 21st century in an age full of laws. It’s time to reflect upon what effectiveness means in that context. The purpose of training in a martial art is to make the responses part of your innate instinctive reaction. If your instinctive reaction to a minor bit of aggravation over a spilled drink is to punch or kick someone I would suggest that is not very effective. You will likely get in a severe fight and be more likely to be badly injured and / or arrested. Note this doesn’t mean I’m criticising other martial arts, merely observing that the issue of effectiveness is more complex than it first appears.

P.S. Harold was in his 80s when he was still training, he has passed away now. You’ll know an effective real martial art because older people still do it. If it’s a young person’s game only then what use will it be when you are older?