Virtual Machines and Swap

For a while now I have been using VirtualBox to run various windows guest operating systems on my Linux host. One thing that I have always been wary of when using them is how the disk image gradually grows over time. This is because on the host operating system the disk container uses a sparse file so that the virtual disk can appear to be bigger than it actually is, but it can only do this when the guest operating system is not using the space, and the data is effectively set to zero. When you delete a file on the guest operating system it doesn’t bother to set the file contents back to zero, it just removes the record of where the files data was located.

This is not really a problem and most people know that you can use a tool such as sysinternals SDelete to zero the free space. Then using the command

vboxmanage modifyhd --compact <diskimage.vdi>

the space can be reclaimed.

However in windows there is one file in particular called pagefile.sys (also known as the swap file) that is constantly being written to and then subsequently erased. Its possible that windows does this intelligently and re-uses the same sectors of the virtual disk for the pagefile, but it seems more likely to me that windows doesn’t do this, after all it isn’t aware that its really writing to a virtual disk.

What made sense to me was to create a second virtual disk specifically for the pagefile. I made the second disk image immutable. What this means is that all writes to the disk are stored in a differencing image which is thrown away when the guest machine reboots. Because of this I can ensure that it never gets any bigger. This also has some other advantages.

Firstly I can use the same immutable image for all my Virtual machines. These currently include; Windows XP, Windows 7, Windows 8.1, and Windows 10. Secondly because the image is immutable it allows all guests to use the image while all running at the same time.

Thirdly the fun part, I can host the differencing images to the immutable base image in tmpfs meaning that the guests get the advantage of having very fast i/o for their pagefile.sys. This is the advantage I like the most because it certainly seems to improve performance.

Binary Universe

I have recently been wondering about probability. What is it? Well obviously I know that its “The chance of something happening” but how does probability manifest itself in our universe. Firstly I have made the assumption that for something to happen, you must have a time component. For example a universe with 0 dimensions, and no time, cannot have probability. A point could exist in such a universe, since a point is as Euclid defined “that which has no part” or in other words a point has no dimensions. But in a 0 dimensional space there is no time and so it cannot appear. However in a 1 dimensional universe where the only dimension is temporal, this gives rise to something being able to happen. Admittedly this kind of universe is still only big enough to contain a point, but it can either be there, or not be there. It is a binary universe, and the only event that can ever happen in that universe is the emergence of a point. You could go so far as to say that the entropy of this simple universe starts low, and then at some point becomes high. The trouble with this model is that its time reversible. If you look at this simple universe with time going backwards the point simply exists to start with, and then disappears. So in that sense the temporal dimension is not temporal at all, since it has no arrow of time.

Site Downgrade

I have decided to move the RapCAD website to a new hosting solution. There are two reasons for this, firstly I don’t see the need any more to host two separate blogs, and secondly because the new solution is cheaper. As a result of this change the bug tracker and forums have gone, (they were not being used anyway) and git hosting has moved primarily to github.

How to fix your buttons – Ubuntu

For some reason, with each new major version, Ubuntu keeps changing the location of the minimize maximize and close buttons on the window decorations. Its really annoying because as soon as you get used to one way, they put it back the other way. Once and for all I wanted to fix this problem and have my buttons where they should be, where they have always been (for me this was on the right having come from windows)

gconftool-2 --set /apps/metacity/general/button_layout --type string ":minimize,maximize,close"

Now at least I can get used to them in the right place!

EDIT: For ubuntu 13.04 you need to do this:

gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'

Offset advantage

I implemented an offset module in RapCAD a while ago. I developed it primarily for calculating print outlines, since the outline must be smaller than the required shape by half the width of the printed filament. The module can also be very useful in other applications such as creating a hollowed out shape. Usually we can create a hollowed out shape simply by performing a difference operation. However when the shape is complex it can be tricky to create a smaller shape of the correct proportion to subtract. In the above image the top 2D shape is created using the offset module, whereas the bottom shape is created using a naive translate and scale technique. Where the scale module simply shrinks the shape uniformly in all directions, the offset module shrinks the shape to the correct proportions offsetting the outline of the shape by the same amount at every point.

Version 0.9.0 is available this month. See the Download Page for details.

Go Ahead

This is something that really bugs me.  united biscuits manufacture a bar under the brand go ahead!™ boasting that its only 74 calories per slice. The brand name, their marketing campaign and everything about this biscuit, is geared towards this being a healthy option.
“The go ahead! brand offers consumers delicious snacks they can feel good about eating”
However in reality the information being provided isn’t very helpful, and doesn’t allow the consumer to make healthy eating choices at all. Firstly there are two slices per pack, so its really 148 calories. Secondly the bars are tiny only 36g each so you don’t get much. Especially when you consider that for 74 calories you can have 231g of strawberries, or 129g of fat free yoghurt, or 19g of sugar. What the bars should advertise is the calorie density, or calories per 100 gram. In which case its a 417 calorie per 100g bar. Admittedly on the back of the packet such information is provided, but united biscuits as well as many other companies use a loophole in the way they can provide nutrition information to the consumer to make it look like a healthy option when actually it isn’t. Especially when you consider that a Mars bar is 467 calories per 100g. But I don’t have a problem with Mars, they brand their products as confectionery sweets and as such everyone knows they are a treat not to be eaten too often. *

So here is my healthy alternative to go ahead!™ if you just take half the sugar and half the yoghurt you have the equivalent of one slice, and if you take all the strawberries, you have the equivalent of the two slices. So pictured right we have two measly go ahead!™ yoghurt breaks strawberry slices and next to them we have one bowl of strawberries, a huge dollop of yoghurt, and more than two teaspoons of sugar. In addition the go ahead!™ bar has all sorts of other crap in it including:

  • Strawberry paste 1.5%
  • Glycerine
  • Dextrose Monohydrate
  • Sodium Citrate
  • Calcium Citrate
  • Soya Lecithin
  • Sodium Bicarbonate
  • Disodium Diphosphate

I am not really sure what any of those things are but my healthy option contains:

  • Fresh strawberries 50%
  • Pasteurised Skimmed Cow’s Milk
  • Sugar

There is no mention of whether the go ahead!™ bar contains any Vitamin C, but being that my option has fresh strawberries in it its packed full of Vitamin C, as strawberries have the most amount of Vitamin C than any other fruit. The yoghurt means it is also packed full of protein and live active yoghurt cultures (L. Bulgaricus, S. Thermophilus, L. Acidophilus, Bifidus, L. Casei). I know which I would rather eat, so I did. It was delicious. The go ahead!™ bar went in the bin.

*Previously Mars had an questionable advertising campaign slogan “A Mars a day helps you work, rest and play”, but the current slogan is simply “Work rest play your part for England” which I think is a responsible way of promoting sport and exercise using the brand

Powers of 2

Breaking with tradition I have decided to do a release on the 16th this month instead of the 8th. Then the following release I plan to do on the 32nd, which of course doesn’t exist so it will actually be the 1st of month. The reason for this is just for fun, and because I would like to have my releases go out on the first day of the month ;)


  • Implemented amf export feature. – Thanks to Steve Kelly for his work on this
  • Allow range values to be treated as though they are vector values.
  • Implemented preferences for edge and vertex size.
  • Added simple about box dialog that displays the RapCAD version number.
  • Improved the tool tips in main window tool bar.
  • Improve memory management for values.
  • Improvements to array concatenation code and some tests.
  • Fixed some defeferenced null pointer exceptions in polygon.
  • Documentation Improvements.
  • Added some more examples
  • Licensing updated.

Version 0.8.0 is available this month. See the Download Page for details.

Things I want to tell the world


Get every new post delivered to your Inbox.