Friday, 29 January 2016

AutoStart randomness

John Cook's article on random generator mistakes reminds me of a fun story from school: We had Acorn Archimedes machines, which booted from the network - or at least loaded applications from the network, RiscOS was built into ROM. These machines would often be idle after boot (the entire computer room switched on from a mains breaker), so to ensure they were most useful when someone came onto the machine later, we started various applications to run in the background. This was fine if the machine wasn't going to be used immediately but very annoying if someone did want to use the machine, so I wrote !AutoStart, which started the applications after a delay, and could be cancelled with a click. However a room full of machines all hitting the network at the same time for an application would be very slow, so I added randomisation, so different machines would start up applications at different times. Unfortunately we hit the problem John highlighted - all the machines gave the same random numbers as they were all started at the same time (I think it may have been time since machine power up as well). So in the end machines initialised their random number generator with their network ID instead - predictable, but different from each other.

Monday, 10 September 2012

NFSv4 on Virtual Box VMs

Setting up NFSv4 mounts from the host (server) to the VirtualBox VM (client): You can't use the normal NAT network - you'll get "Operation not permitted". Setup a host-only network, and configure those devices on the host and vms. That allows the connection to proceed to the next point.

Thursday, 3 May 2012

Locations in Ubuntu datetime indicator

Ubuntu datetime indicator is a right pain to add extra timezones to.
The Locations... seems to be very poor when you try to add a new location at determining locations' full entry.
As an alternative you can add them to the configuration directly.
  • First install dconf-editor.
  • Open dconf-editor.
  • Navigate to con/canonical/indicator/datetime and edit the locations item with the locations you want.
Valid locations:
  • America/Vancouver Vancouver
  • Australia/Sydney Sydney
  • Pacific/Auckland Auckland
  • Asia/Tokyo Tokyo
  • America/Toronto Ottawa

Wednesday, 7 March 2012

Programmatically find out if a file is sparse

You can work out if a file is sparse using stat (or fstat etc).

    struct stat statbuf;
    int ret = ::stat(tmp, &tatbuf);
    ASSERT_NE(ret, -1);

    // statbuf.st_size - virtual size in bytes
    // statbuf.st_blocks - physical size in 512-byte blocks
So if st_blocks * 512 < st.size then you definitely have a sparse file.

Sunday, 10 July 2011

ISO format for clock applet in Ubuntu 11.04

To configure Ubuntu Unity clock indicator applet to ISO format %Y-%M-%D


gsettings set com.canonical.indicator.datetime custom-time-format "'%F %H:%M'"
gsettings set com.canonical.indicator.datetime time-format "'custom'"

Sunday, 24 April 2011

Compiling MosaicCK on Ubuntu 10.10

While I was trying to build /Mosaic-CK I had to add various libraries for Ubuntu 10.10 that might be non-obvious:

sudo aptitude install libx11-dev libmotif-dev libpng-dev \
libjpeg-dev libxt-dev x11proto-print-dev libxprintutil-dev \
libxprintapputil-dev libxcb-xprint0-dev libprinterconf-dev \

For Ubuntu 11.04 add:


Wednesday, 15 December 2010

Open Source Digital Forensics

Looks like it would be a good resource for anyone needing to rescue a machine or investigate one.