So we had the hard drive in an iMac replaced for free out of warrantee thanks to a recall from Apple due to a fault with that model of hard drive. Well done Apple!

But just before we took it in for service we noticed that the backup drive had failed, an old IDE Lacie external drive. Caught just in time because when you get a drive replaced by Apple, it comes back empty, aside from a fresh operating system installation.

We bought a new external drive, made a new back up using Time Machine and then sent the computer in for repair. It came back with a fresh installation of 10.6.3 on it (it had 10.6.8 when we sent it in – no free upgrade I’m afraid!) so I dutifully applied all the latest updates for 10.6 and restored the back up from Time Machine.

Now, the internal drive in the iMac was originally partitioned into 4 separate “drives” each for different uses. This has never been a problem for Time Machine before, by default it backs up all internal drives.

However now after restoring the backups from Time Machine, every time Time Machine ran to perform a new incremental backup, it kept deciding that it needed to back up everything on 2 out of the 4 partitions on the internal drive – 261GB every time!

This is despite nothing changing on the drives. Nothing at all.

I have spent the last 2 weeks trying to fix this problem, and I believe that I have a solution.

I followed everything to fault find Time Machine problems as described in the troubleshooting section at pondini.org. This website is a good resource but none of the suggestions fixed my problem – none of these helped:

  • a full rest of Time Machine
  • fixing permissions
  • reinstalling 10.6.8 updates
  • checking for rouge applications
  • rebuilding the file services database
  • etc.

I downloaded BackupLoupe as suggested and started to look at what was being backed up.

Strangely, I discovered that two of the internal partitions were undergoing a full back up every time (261GB) but the other two partitions were not, they were being properly incrementally backed up as they should (only a small amount of data). Weird. What could be different between the partitions? They all only hold data, not system files…

To the Terminal!

Looking at the contents of root directory of each partition (ie under /Volumes ) I noticed something strange. The drives that were not backing up properly had extended attributes flag set and the drives that were being backed up properly didn’t have any extended attributes flags set:

This is indicated by the ‘@’ at the end of the attributes for each file e.g.:

Sparkley:~ tom$ ls -la /Volumes
drwxr-xr-x@ 39 tom wheel 1326 21 Mar 01:04 Documents

Incidentally, a ‘+’ at the end of the attributes means there is extended security information applied to eh file, such as an access control list:

Sparkley:~ tom$ ls -la /Volumes
drwxr-xr-x+ 39 tom wheel 1326 21 Mar 01:04 Documents

Strange.

So I had a look what they were, using the xattr program:

Sparkley:~ tom$ xattr /Volumes/Documents
com.apple.backupd.SnapshotVolumeLastFSEventID
com.apple.backupd.SnapshotVolumeUUID
com.apple.backupd.VolumeBytesUsed
com.apple.backupd.VolumeIsCaseSensitive
com.apple.metadata:_kTimeMachineNewestSnapshot
com.apple.metadata:_kTimeMachineOldestSnapshot

Well it seemed that at least Time Machine had something different going on for this partition compared to the others, the extended attributes probably aren’t needed because the other partitions don’t have them. Lets delete them all!

Sparkley:~ tom$ sudo xattr -d com.apple.backupd.SnapshotVolumeLastFSEventID /Volumes/Documents/
Sparkley:~ tom$ sudo xattr -d com.apple.backupd.SnapshotVolumeUUID /Volumes/Documents/
Sparkley:~ tom$ sudo xattr -d com.apple.backupd.VolumeBytesUsed Documents
Sparkley:~ tom$ sudo xattr -d com.apple.backupd.VolumeIsCaseSensitive /Volumes/Documents/
Sparkley:~ tom$ sudo xattr -d com.apple.metadata:_kTimeMachineNewestSnapshot /Volumes/Documents/
Sparkley:~ tom$ sudo xattr -d com.apple.metadata:_kTimeMachineOldestSnapshot /Volumes/Documents/

I noticed that the partitions still had extended security information (ie the ‘+’ attribute) set. For good measure, I also removed this since the partitions that worked did not have them:

Sparkley:~ tom$ sudo chmod -RN /Volumes/Documents

Then I ran another backup – this was another big full back up, but not surprising since I modified the attributes of lots of files in the previous step.

The real test came after this back up was complete. I ran another Time Machine backup and this time only 180kB was backed up! I ran it again immediately, this time only 2kB was backed up!

I fixed it!

 

Raspberry Pi Audio Delay

On November 30, 2012, in Raspberry Pi, Tech, by tom

So it’s cricket season here and that means lots of sitting in front of the TV watching cricket and listening to the commentary by the clowns on Channel 9 when I would much rather be watching cricket and listening to the commentary by the clowns on ABC Grandstand.

The only problem is the audio delay. The digital TV broadcast lags behind the radio so that you hear the action before you see it, something like 10 seconds before. The delay is less with a digital radio but still in the order of 7 seconds or so. To make matters worse, the delay is dependent on the make of TV and digital radio you’re using.

But we are in luck! Because the radio precedes the video it should be possible to buffer up the audio from the radio, delay it by however long is needed and replay it back in sync with the video from the TV! Then all you need to do is mute the TV and you’re all set: watching cricket and listening to the commentary from the radio all in sync.

I bought a Raspberry Pi a few months back and decided this is something worth doing with the Pi. It is basically an embedded linux computer that runs at 700MHz+ with an ethernet port, 2 USB ports, a HDMI output and a stereo audio output.

The only problem is that the Raspberry Pi doesn’t have an an audio input. That’s where a USB audio interface comes into play! I happened to have an old Giffin iMic laying around, this has a line in and a line out and is perfect for the job.

Note that there are currently a few bugs in the Raspberry Pi kernel drivers for the USB interface that I found made it impractical to simultaneously run the audio input and output through the iMic over the USB interface. This resulted in lots of audio pops and breakups, so I resorted to using the audio input from the iMic over USB and the audio output from the built-in output on the Raspberry Pi.

The code should work with any USB input that is supported by the latest Raspbian “wheezy” image, but may need some fine tuning if you change the configuration of your Raspberry Pi.

I found that there was very little I needed to set up to get this to work, it uses perl, aplay and arecord from alsa utilities group which are all part of the standard Raspbian “wheezy” image. In fact it should work on any linux system fast enough to handle simultaneous input and output audio streams.

Download the code here:

audiodelay

The code is released under GPL V3 and comes with no warranty!

The code is sort of based on the idea I found here a perl script called “Sports Radio Delay”, but my code is different in that it uses separate threads for the input and output audio streams and a thread safe queue as a FIFO to pass the audio data between the input and output threads and also to implement the delay.

Usage and Troubleshooting
Having the latest version of the Raspberry Pi software helps:

$ sudo apt-get update && sudo apt-get upgrade

Having the latest firmware also helps with the USB performance, follow the instructions here.

Make the script executable:

$ chomd +x audiodelay

Run it, eg delay the audio input for 6.4 seconds

$ ./audiodelay 6.4

Now you’re all set, just hook your radio analogue output to the input on your audio source, hook the audio output from the Raspberry Pi to the audio input on your stereo and you’re all set.

Raspberry Pi Audio Delay Setup

The header of the script contains a few trouble shooting pointers on to how to modify the code to suit your audio interfaces and adjust the input and output levels.

Oh yeah, I am running my Raspberry Pi over clocked to 950MHz, with a headless command line only interface and as user “pi”, so your milage and permissions may vary.

I keep my Pi in an Adafruit Pi Box enclosure for safe keeping, and I’ve put some DRAM heat spreaders on the CPU and ethernet chip to try and keep them cooler.

 

2012 AFL Ladder Widget

On February 29, 2012, in AFL Ladder, by tom

LATEST NEWS:
The AFL Ladder Widget has been updated for the 2012 season!

Head over to the AFL Ladder Widget page to download it.

Note: I have found that Dashboard seems to cache some of the previous widget’s attributes and initially the new widget might not render properly. What a pain!

The way to fix it is either by restarting your Mac (boo!) or use Activity Monitor to close all “DashboardClient” processes using the “Quit Process” button. After that I’ve found that things should be ok.


I am working on a new AFL Ladder Widget for the 2012 AFL season to accommodate the new 18 team competition. As per the past 7 years, the new widget is currently 99% complete but I don’t expect that I will be able to release it until at least part way through the first round, maybe not until after the end of round 1.

The problem is that the websites that the Widget uses to get the ladder data from change their format each year and use different names for teams (eg “Sydney” vs “Sydney Swans”, “North Melbourne” v “Kangaroos” etc) and are not usually up and running correctly until the end of the first round. It is not until the information is all there that I can work out exactly what is required by the Widget to fetch the ladder data and format it correctly.

In past years (I’ve had to release at least 1 new version each year since 2005) it has not been possible to work this all out until after the first round and I can’t see this changing this year.

So stay tuned!

 

I finally got around to playing with the free LPCXpresso boards I was sent by NXP. A nifty little ARM Cortex M0 board with an USB programming and console link, gcc based compiler and Eclipse based IDE. The CPU is a LPC1114 and features:

  • 32-bit ARM Cortex M0 core
  • 32kB FLASH
  • 8kB SRAM
  • 1x UART
  • 1x I2C interface
  • 2x SPI interface
  • 8x ADC channels
  • SWD debugging interface
  • Multiple counters

The full specifications and the board are available from Embedded Artists.

The only downside to the development environment is that it does not support OS X – only Windows and Linux. Typical. However I’ve played around today and after a bit of messing around I got it working under VirtualBox 4.0.6 and Ubuntu under OS X 10.6.7.

It’s pretty straight forward, however there’s a small trick you need to do to VirtualBox to make the debugging run properly. The USB debugger interface to the LPCXpresso board is initialised/programmed by the IDE the first time it run. So when you plug it into your Mac, VirtualBox reports it as “Unknown device” under the “Devices -> USB Devices” menu. After the device is configured for debugging VirtualBox reports it as “Code Red Technologies LPC-Link Probe v1.1″.

VirtualBox needs to be configured to automatically connect both devices, especially after it has change from one to the other otherwise the debugger software in the IDE will time out since it won’t be able to find the “Code Red” device once it changes because it won’t be connected through to Ubuntu client. Luckily it is fairly simple to configure VirtualBox to fix the problem, the steps I took follow.

Continue reading »

Tagged with:  

2011 AFL Ladder Widget

On March 20, 2011, in AFL Ladder, by tom

LATEST NEWS:
The AFL Ladder Widget has been updated for the 2011 season!

Head over to the AFL Ladder Widget page to download it.


I am working on a new AFL Ladder Widget for the 2011 AFL season to accommodate the expanded 17 team competition. The new widget is 99% complete but as in past years, I don’t expect that I will be able to release it until at least part way through the first round, if not until after the end of round 1.

The problem is that the websites that the Widget uses to get the ladder data from change their lay out each year and are not usually up and running correctly until the end of the first round. It is not until the information is all there that I can work out what is required by the Widget to get the data.

In past years (I’ve had to release at least 1 new version each year since 2005) it has not been possible to work this all out until after the first round and I can’t see this changing this year.

So stay tuned!