A mind less ordinary

29Jun/100

Cloning a git-svn checkout

The scenario is that you have used git-svn to import an SVN repository, and you want to make use of the already-imported commits elsewhere. Unfortunately, git clone does not (currently) clone the git-svn information. It looks like we have to fully rebuild the git-svn repository, which would then mean pulling every commit from the Subversion server once again. What we'd really like to do is to make use of history we already have from git.

7Jan/105

Recovering from pvmove failure

Note: This is a fairly rambling explanation of recent events. I assume that you have at least a passing knowledge of LVM and its terminology. This was written to prove that it is possible to recover from pvmove failing (in certain cases) due to the way it performs its operations and backs up metadata.

16Nov/091

Hearing aid direct audio input

Many hearing aids can handle direct audio input (DAI), often via a "shoe" that attaches to contacts on the aid itself. This shoe then provides a DAI jack (sometimes called a europlug or eurojack) that cables can be plugged into.

There seems to be a complete lack of cables designed for people with a single hearing aid, so one of my upcoming projects will be to convert a Y-cable that can serve two hearing aids into a joint DAI/earphone cable instead.

DAI connector pinout

DAI connector pinout

The DAI connector has the following pinout:

  • short/thick pin: ground
  • long/thin pin: VDD (apparently -- doesn't seem to actually be connected to anything on a 3.5mm cable)
  • short/thin pin: signal

Remember that a standard 3.5mm audio plug has the following pinout:

  • tip: left signal
  • inner sheath: right signal
  • outer sheath: ground

Next stage: connecting an earphone to the plug on one side of the cable, to see if there are any impedance issues, although the cable I am using (an fmGenie one) is a very low-impedance cable because I have an Oticon hearing aid. Measured with a multimeter, it seems to be around 0Ω, so I think that's good enough for me. I believe attenuated cables have a 330kΩ resistor in series with each signal line (according to Neil Ferguson's bluetooth hearing aid hack page).

My ultimate goal is to get hold of a DAI jack that I can solder directly to an old earphone, so that I can just plug the spare DAI cable into the earphone directly, almost as if it were a hearing aid itself. Unfortunately, it seems that it is impossible to get hold of such things. According to Connevans, DAI jacks are only custom-made for hearing aid shoes. After some discussion, it seems like I should be able to make one myself though (with some help!) so we shall have to see how that turns out.

22Feb/094

Restoring from LVM and VMWare disks

I recently had to restore a server that failed to boot after a power cut. This machine was a Linux VMWare host, and it had three Linux guest virtual machines that were running at the time. While we had full backups available, I decided to set myself the challenge of recovering the entire images, to save the pain of a complete rebuild.

The host server partitions were LVM-formatted volumes on top of hardware RAID-1, and each of the virtual hosts were partitioned with LVM too, internally. This means that the restore process will not be at all trivial. With just a complete image of the host system, I would need to restore (deep breath) files on a partition on an LVM logical volume (inside a volume group, on a physical volume) in a VMWare hard disk stored on LVM (logical volume inside volume group of physical volumes) inside a disk image that is itself a file on a disk. How very convoluted.

I used a Gentoo system to restore the data, although any Linux system with the appropriate packages should be able to do it. No searches turned up information on doing all of this, and I had to come up with some of it myself, so I thought I would document the process.

10Jul/081

In-place array uniq in C

I've been developing Insight even though the uni project has come to an end, because it's fun! I also want to make it more stable and eventually release it under an open-source licence of some kind. There will be an update coming soon, I promise! I now have Internet, so I can write up some things... Anyway, one of the interesting things I wanted to do for Insight was an in-place form of uniq for an array, ideally without any additional memory allocation. It seems that this is something nobody else has done yet! So I set about doing it myself... For those of you who are unfamiliar with the Linux/UNIX command uniq, it takes a sorted list and removes any duplicates. This is almost exactly what I'm trying to do, with one caveat: I need to keep the "discarded" duplicates. What happens is that I have an array containing a number of strings, and these have all been dynamically allocated via malloc() or calloc(). If I just remove or overwrite their pointers, they'll vanish and cause a memory leak. While I've now fixed a large number of leaks thanks to Valgrind, I'm trying to actively avoid any possibility of adding them. Read on for the details...

10May/080

4 on Demand: Improved

For all that use 4 on Demand, the video-on-demand service for Channel 4 in the UK, I have a useful tip for you. Although it has a large number of programmes available for free, its interface is (to say the least) highly annoying. But there is a fix!

Disclaimer: This is non-standard usage of 4od, and while they may not be able to detect you doing this, there is a chance that this may violate their terms of service. I'm providing this method only for reference purposes, and for convenience in navigating their system, in a similar way to the BBC's iPlayer.

It's essentially simple: instead of bringing the 4od system up in its own little window, use a browser. I've only tested this with IE7 (as that's what runs within the dedicated 4od application window) but I see no reason it won't work with Firefox too, as the BBC site does.

"But wait," I hear you cry. "I don't know the URL!"

Well panic not, for a little network sniffing later gave me this: http://vodapp.grid.channel4.com/c4site-web

Now you can open program downloads in multiple tabs so that you can just click "confirm" on each of them and let the downloads begin. This makes queueing an entire series for download at once much easier!

Enjoy...