richard's blog

Play a Stems file in Ableton

For reference, here is the method I've found to play a Stems format stem.mp4 file as a set of clips in Ableton Live (8.4.2).

(I don't think I'm going to actually play out with Live. Traktor seems to do nearly everything I want without the below rigmarole, albeit at the expense of a new controller. But just in case, and mostly for me in case I forget).

I got a Beagleboard!

My Beagleboard Xm rev C arrived in the mail the other day. (After I made the required promise not to use it to make nucular rockets or other weapons of mass destruction - seriously).

I haven't got a monitor right now (my last one blew a CCFL and the new one isn't here yet). I tried it first on the telly (HDMI in) but no joy -possibly due to the issue below.

I then dragged a no-brand USB/Serial adapter out and uploaded MacOSX drivers from Prolific as described here. I also got ZTerm - a retrocomputing terminal emulator (PC users can just use Putty here).

To power the Beagleboard, I plugged it into the PCs USB (out of ports on the Mac), which made the lights come on. With the serial port connected, I got serial noise. Selecting the correct 115,200 baud rate produced startup messages from u-Boot (the bootloader on the supplied demo MicroSD card). It then went into the Angstrom OS and crashed with a "Kernel panic - not syncing : Fatal exception in

A quick google reveals that this is due to the host (my PC) trying USB On The Go (OTG) handshaking - on account of it's newish, and can. This was fixed by the simple expedient of shutting the lid and thus making my HP into a $2000 power supply (I do have a USB supply, but it has a fixed Micro-B plug - the BB is Mini-AB).

That got Angstrom booted to a login in serial, and connecting a network cable resulted in it getting an address and being accessible with SSH. The only downside is that it picks a new Mac address each boot (there is no manufacturer Mac address on the fairly basic Ethernet interface on the Beagleboard). This means that my hub sees it as a new device and allocates a new IP address every time, so one doesn't know where to SSH to.

That's also quite easy to fix as documented here - making an entry in /etc/network/interfaces gave the device a locally assigned IP out of the DHCP space. An entry in /etc/hosts finished it off.

Migrating a physical Windows machine to a VirtualBox VM

Requirement: Given a physical box running Windows (Vista), migrate to a VirtualBox VM on a MacBook Pro.

Comments: I've got a new MacBook arriving next week. It'll have Snow Leopard installed, but will get the Lion upgrade in a short while. Up until now, I've done most of my work on an HP tx2100 tablet running Vista, which has acquired the best part of a hundred applications, some of which are Windows-only. I need to migrate this machine (with 300G of storage in use) into a VM on the new Mac.

Solution: I'm going to migrate the drive with Windows to a virtual drive on the Mac. The drive on the HP is a 320G SATA 2.5". I need to copy this to an image on the Mac. Unfortunately, there isn't an easy way to just move the drive (the MCE optibay would maybe do a job, but it's more dollars and would need to be imported to NZ. So I'm going to use my desktop box running Ubuntu 10 as a staging server, make the virtual drive on that and copy it to the Mac over the network.

1. Prepare Windows to migrate
Following the VirtualBox migration doco, I confirmed that I'm running Halacpi.dll and don't have agp440.sys or intelppm.sys in my device drivers. So I shouldn't need any special actions there.

The doco suggests that, for XP at least, the OS will only have drivers for the disk controller in use and may fail to boot on another (virtual) machine. (This may have been fixed in Vista/7?) I tried the referenced German MergeIDE utility, but it couldn't find a file. So I went to the MS tech note and followed their instructions:

- make a file MergeIDE.reg on a USB key with the text shown in the note.
- validate that Atapi.sys, Intelide.sys, Pciide.sys, and Pciidex.sys were in System32\drivers. They were - if not, I guess you have to find them from someplace.

NOTE: what I didn't do here, but would suggest, is to uninstall all your machine-specific video and platform drivers here and run as much of a "bare" Windows install as you can. See (8) as to why.

2. Move the disk
The disk on the HP is easily accessible (after powering off) under a cover. On removing it, it didn't look like it had a SATA connector.
That 'connector' is actually an adaptor from SATA to the caddy. Pull it off, and you've got conventional SATA power and data. (This took me some minutes of poring over connector diagrams!)

So I disconnected the optical drive on my desktop, plugged in the laptop drive, powered up and hit F12 to get into BIOS setup. That showed the drive type configured on the 3rd IDE slave. Booting into Ubuntu showed the drive as /dev/sdc with partitions on /dev/sdc1 and /dev/sdc2.

3. Install VirtualBox on Ubuntu
This was a simple matter of downloading the .DEB installer from the VirtualBox site using wget and running it with:

sudo dpkg --install virtualbox___.deb

(There is an Ubuntu packaged option also - it didn't work).

4. Make a disk image (vdi) file
(This is a more interactive method than in VirtualBox's instructions).
VirtualBox can access 'real' disks that have been defined to it using a .VMDK file. To make this (from drive /dev/sdc as discussed above), enter e.g:

sudo VBoxManage internalcommands createrawvmdk -filename laptop.vmdk -rawdisk /dev/sdc

Note that I'm using /dev/sdc *not* /dev/sdc1. The former is what Windows wants to see in order to boot properly. YMMV if you have an unusual setup like dual boot Windows/Linux.

At this stage you can configure and run a Windows VM off the physical disk. I'd be wary of doing this, as the disk is writable and you might break something so it stops working back in the laptop.

Now we can open VirtualBox media manager (start VirtualBox. I used sudo for this as it needs root to access the physical drive, I think. Then use File / Virtual media manager).

Select the laptop.vmdk file. Select Copy and copy this file to a new VDI file lapall.vdi. This took (300G on a moderately hefty machine) a couple of hours. You obviously need at least 300G of free space on the drive you are copying to.

5. Boot the image
In VirtualBox, do the following:
- use New to add a VM
- enable IO APIC, select a reasonable amount of RAM (1G), single processor, etc.
- in Storage, attach the lapall.vdi file to this machine. Make it the first device to boot off.
- start the VM. Windows should appear, much as on your old computer, only slower. (Unless either your desktop is hugely fast, or your laptop was very slow).

6. copy the image to the target computer
I did this using sftp (Filezilla) - it took about 8 hours (300M disk, 100Mbit connection). I tried briefly running a 1G connection (cable between the two machines) but only got a 2x speedup.

7. Install VirtualBox on the target and boot the image
I did this using the OSX VirtualBox installer (4.1). The image just needs to be dropped in its permanent home and set as a disk.
The basic image then booted fine, albeit with none of the VirtualBox extras such as mouse capture, shared folders, etc.

8. Get VBoxGuestAdditions
This is the set of utilities and device drivers that let VirtualBox coexist with the platform. I had more issues here than at any other stage. Installing the additions resulted in a resource clash with the existing device drivers. I'd suggest removing these at step 1. What I had to do in the end was to delete the drivers (ATI, etc) and revert to base drivers. Then it finally (after much trial and error) would install Guest Additions.

Spring3: adding bean properties to an annotated controller

Requirement: given a Spring3 annotated controller, set bean properties on it

Comments: I have a Spring 3 controller defined with an annotation:

public class MyController {
public String getFred() {...}
public void setFred(String x) {...}

I want to set the value of 'fred' from the XML config file.

Normally, the only place MyController is defined is in the class. An component scan of the form:
<context:component-scan base-package="my.package"/>

(in webBeans.xml or similar) finds this class and associates it with requests.

To configure this bean with properties, we need to define it in webBeans.xml:

<bean id="myController" class="my.package.MyController" >
<property name="fred" value="fredsValue" />

Note that we need to set the id *and* the class. The id also needs, I think, to match the id that gets autogenerated for the class. This isn't well documented, and if it isn't right, it'll fail with either a duplicate bean or a missing bean.

Also, if you need to autowire, you can set autowire="byType" or whatever on the bean.

Syndicate content