Category Archives: Software

Pivot Tables and Weighted Averages

Pivot Tables are a very useful feature in Spreadsheets, they allow you to do things that might otherwise require code to iterate around on.  My mental model of them is not great though I find there is a great deal of trial and error to get them working for me.

Anyway I recently had to calculate a weighted average and found this web page:

very useful.  Essentially you need to add an extra column in your data with an intermediate step of weight*value that you can then sum in the pivot table.

Although the tutorial example there is done in Excel I actual used Libreoffice as despite the fact I now mainly fill out electronic paperwork I have clung onto my Linux box 🙂


Plotting 2D Unstructured Data Using Free Software – an update.

A while ago (ten years ago!) I wrote a post called  Plotting 2D Unstructured Data Using Free Software

I thought it might be useful to revisit that post to see how things have moved on.  Nowadays I do most of my plotting in Matplotlib – a library which has matured nicely since 2007, though I get confused quite a lot 😦

In the previous post I looked at GSharp, gri, gnuplot and matplotlib.  I will talk here about only about gnuplot and matplotlib.  Amazingly gnuplot has changed very little – the script I wrote ten years ago works without any modification and produces the same sort of output, i.e. not hugely impressive.  You might be able to get better outputs if you have more skill with gnuplot than me.


The matplot script however required modification to run.  A user called darksid3 pointed out a much better way of doing in 2010 but I think the matplotlib library has developed somewhat so the code is now very straightforward.  My script is now as follows:

Script to plot contour data using Matplotlib
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import griddata

# Read and assign data
data = np.genfromtxt('contourdata.dat',names=['x','y','cp0'])
x = data['x']
y = data['y']
z = data['cp0']

# Do the interpolation
xi = np.linspace(x.min(), x.max(), 500)
yi = np.linspace(y.min(), y.max(), 500)
zi = griddata((x, y), z, (xi[None,:], yi[:,None]), method='cubic')

# Plot using the interpolated data
plt.xlabel("tang / [m]")
plt.ylabel("radial / [m]")
plt.title("Loss Coefficient CFD Jan 2006 - matplotlib")

You might be able to make it a bit smaller but I favour a longer, readable code over something that is very compact.  The output is pretty straightforward too:


A better reference can be found in the SciPy cookbook.

So it is nice to see things advancing in the free software world!!

Search Problems with Thunderbird

Recently I have found that Thunderbird search has been a bit annoying.  You will search the database and get results that you want, e.g. the document that Fred sent you two years ago about widgets.  You can see some details about the e-mails – a tantalising glimpse of the header and the attachments but when you click you cannot access the full e-mail.

The solution appears to Rebuild the Global Database:

Which I am doing at the moment.  Tools -> Activity Manager allows you to watch the process…..

Update: this works as intended.  I can now find my e-mails in Thunderbird.

Fixing Ubuntu 14.04 Menus after 13.10 Fiddling Around

Dear Reader,

If you had used Ubuntu 13.10 and fiddled around with the menu settings you may have found that when you upgrade to 14.04 some of the menus appear odd.  Two things I noticed:

  • In Nautilus I found that the silly icons that replaced file menus were still there after the update but were not there in a fresh install of 14.04.
  • In firefox the menus were absent no matter what menu position that you selected in All Settings -> Appearance in the System Settings.

I traced the problem (after a lot of going around in circles) to the fact that I had tweaked things in Ubuntu 13.10 and this had unintended consequences during the upgrade.

So in 13.10 I had used this web-page: (or similar) to remove the appmenu-gtk appmenu-gtk3 appmenu-qt indicator-appmenu packages.

When you search in 14.04 they have been replaced with other packages – I searched and installed these manually and solved all my problems!

A quicker solution would be re-install indicator-appmenu and this should pull in all the dependencies that you need:

sudo apt-get install indicator-appmenu

Ubuntu 13.10 Review

So in order to get mdframed working in pdflatex I decided it was time to upgrade from the trusty 12.04 to something else.  So far this has turned out to be a mistake 😦  Let’s look at the pluses and minuses of the new distribution.  The plus points:

  • mdframed works as the Tex Live installation is much more up-to-date.  This does mean I have some of the world’s most pretentious handouts now:Screenshot from 2014-01-29 00:09:12
  • The Font problems I have been having with LibreOffice have disappeared and my Open Document documents look better!
  • the log-out boxes are larger

The negative points are longer:

  • Printers now magically appear – how do I know which is which?  I now have a list of every printer on the network….  Printing also seems much slower – but that might just be subjective bias on my part.  It also seems to be more flaky.
  • The menus have moved on a random selection of applications.  So Evince and Nautlius (now called files) have icons in the top right of the screen with a confusing array of icons from to click on like a monkey  whilst you search for things that have been in the same place since the 1980s!  I am not a fan.  This is Evince, what exactly is the difference between the spanner and the gears?  You have to click to find out!!!evince Screenshot from 2014-01-22 13:04:05
  • Nautlius has been renamed files and has a much poorer user interface.  The “Connect to Server” dialogue has been gutted and you now basically have to type in a command to connect to the server.  There is no longer support for the nice tick icon which shows you whether your files have been synchronised with Ubuntu One or not.  Finally the menus have moved to a selection of gears and arrows like Evince – expect they are are different so again you have to guess and click to see what they mean!nautlius Screenshot from 2014-01-22 13:03:36
  • The new interface is not particular consistent however – as gedit for example still has menus.  So as a user you are a bit confused about where to look for things.  Why this is an advance is a mystery for me – but I’ve never had much of a desktop vision.
  • Multiple desktops have disappeared.  This may not be a bad thing as the previous implementation in 12.04 was a bit buggy.  You can enable them quite easily and the when you do the bling factor has improved the desktop quite a bit.
  • I’ve also had problems with Ubuntu One synchronisation – but that might well be unrelated to the 13.10 upgrade.  There is now a much more meaningful widget thing that sits near the clock to control Ubuntu One.

Overall my impression is that the focus of Ubuntu has moved away from the traditional desktop onto touch interfaces.  I think that is pretty exciting but it does mean that there isn’t very much exciting going on in the latest release of Ubuntu and the current release lacks polish.  This is of course not an LTS release so I am looking forward to 14.04 where hopefully some of the rough edges will be knocked off.

Youtube Channel

Screenshot from 2013-11-11 23:25:30

Over the past few months I’ve put a few videos up on YouTube to complement the courses I am teaching at the small and well formed University where I work.  The following are my observations about this process:

  • The number of views of these videos exceeds the registration on the course by a considerable margin.  However speaking to the folk on these courses it is clear that they have not all watched the videos three or four times each, or if they did they don’t seem to have absorbed much of the material.
  • My production process is a bit cumbersome.  I basically use a microphone and record the screen as I talk.  I have an Ubuntu 12.04 setup at home and I use recordMyDesktop via gtk-recordMyDesktop 0.3.8 to well record my desktop and PiTiVi 0.15.2 to edit the videos.  recordMyDesktop is quite a mature tool (despite the version number) but PiTiVi appears to be progressing faster.  By cumbersome I mean dropped audio and being very awkward to chop off the bit at the beginning and end when you are reaching for the off button on screen.
  • The process is a real time suck – it takes a whole evening to produce a single five minute video.  This is because you end up doing it again and again to try and avoid making mistakes in your exposition.  I find you don’t make fewer mistakes as you go along at some point your standards just drop as you want to go to bed.
  • I’ve no idea if this helps or hinders student learning.  It seems to be popular but I think we need more this sort of thing in Higher Education.  Students like being given things – they like copies of slides, numerical answers, worked solutions, audio of the lectures etc. etc.  My personal view is that this is largely a waste of everyone’s time but without evidence either way this is just an opinion.
  • It does however provide a different sort of educational material.  I think it would be great to show worked solutions as you can add a live commentary to it and students can see how the solutions develops in a way you cannot with a static handout.  Of course I haven’t actually made a video like this yet – but it is on my list…..

The Channel is at if you want to keep up with the white heat of the revolution….