Monthly Archives: December 2009

Clone VirtualBox images (.vdi)

Just copying a VirtualBox .vdi file and the opening it results in the error:

Cannot register the hard disk ‘myhd.vdi’ with UUID {ABCD} because a hard disk ‘myhd2.vdi’ with UUID {ABCD} already exists in the media registry (‘path/VirtualBox.xml’).

The solution is to generate a new UUID for the copy. This is done using:

VBoxManage internalcommands setvdiuuid myhd2.vdi

Get selected value of radio button using YUI 3

Getting the value of a the currently selected radio button may be done in a couple of ways. This is one approach using YUI 3.

Here is the HTML:

<input type="radio" name="myoptions" value="one"> First
<input type="radio" name="myoptions" value="two"> Second
<input type="radio" name="myoptions" value="three"> Third

Get the currently selected value using only one line of code:

var value ='[name=myoptions]:checked').get('value');

Unfortunately, this does not work in Internet Explorer, so another (not as tight) approach is:

function getRadioSelectedValue(selector) {
    var tmpValue= false;
    Y.all(selector).each(function(node) {
        if (node.get('checked') tmpValue = node.get('value');
    return tmpValue;
var value = getRadioSelectedValue('.myRadioGroupClass'); // this assumes you've set appropriate class to radio elements