Creating a presentation with LaTeX and powerdot
A few days ago, I gave a talk at PHP London about using OAuth with PHP. I started out building it in OpenOffice, but quickly found the process annoying, especially considering that I wanted to export to PDF with progressive disclosure on some slides. After putting the skeleton of the talk together, I decided to move to something else instead.
I've had some experience with the LaTeX document typesetting system before, having used it quite a lot during university for my final project's reports and presentation. I used the beamer package before, but this time I found its styles too restrictive. The three major presentation packages that I'm aware of are prosper (which I believe is quite old now), beamer, and powerdot. After some investigation (looking primarily at features and visual styles), I settled for powerdot. I will explain the basics of putting a presentation together in the rest of this post, but be warned: it assumes some basic familiarity with LaTeX, and I don't explain everything!
Useful git configuration fragments
Time for a quick micro-post, I think. I feel like sharing two useful fragments of my git configuration.
First up, aliases. I have a few useful shortcuts defined, as well as some nice ways of displaying a repository's history. I've aliased many of the common commands to two-letter versions which evoke the similar Subversion command aliases:
[alias]
st = status
di = diff
co = checkout
ci = commit
br = branch
sta = stash
graph = log --decorate --oneline --graph --branches --date-order
lg = log --graph --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %C(green)(%cr)%Creset %Cred<%an>%Creset' --abbrev-commit --date=relative --date-order
today = !git log --author=$(git config user.email) --since=yesterday
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.
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
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.
A content-based file manager
I've been thinking recently about Insight again, and I've been considering part of the problem with naming and uniqueness.
Names in a traditional file system are made unique based on a full path to the file, but most people think of a file name as just the final component. This would then cause a problem with the move to Insight, as a file could appear in multiple directories, and its only distinguishing feature would be the final component of its path. This is counter-intuitive and can cause all sorts of problems.
Consider makefiles, for example. They rely on a standard named file (Makefile) appearing at various levels in the hierarchy in order to work. Obviously, you would want different makefiles at different levels and in different projects, but Insight as it stands has no way to handle this.
I then started thinking about what makes a file unique. In the end, I came up with two things: name and content. This covers the makefile case (same name, different content) as well as the backup case (same content, different name). It then occurred to me that, in the general case, all you need to distinguish a file is its content, and then actually finding it can all be left up to metadata.
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...
Insight: An update
Just a very brief update for the last few days:
- Files can now be opened and read - writing and deletion coming soon!
- File import does tend to confuse ln, as it expects the new destination to be a symlink rather than a file. Nothing I can really do about this for now though!
- I've manually assigned some tags to files, and queries now work beautifully (apart from subcategory union, which I hope to tackle later tonight).
- Having said that, only simple conjunctive queries work, as there's no support for negation or disjunction. Yet.
- Inode set functions are now in place and working.
One more update before I get back to coding... Insight now has an official logo!

Insight: Where am I now, and where next?
So I've been in Deep Coding Mode™ for quite a while. What have I got to show for it?
Well, the short answer is that Insight is now a functioning file system... for a given definition of "functioning".
Insight: The current plan
As it comes time to work on my project again, it's time to take stock and work out what my plan of action should be.
Looking at the code I have already, I think it's clear that there is no way I will be able to write a kernel-level file system driver within the 2-3 weeks I have left. Fortunately, I had more or less expected this (as writing kernel code would be likely to take quite a while and be quite complex!) so I'm retreating to my fallback position: a FUSE-wrapped program that will interface with the metadata store.
Also on the cards is the use of Check as a C unit testing framework for my tree code - if I have time. At the moment, getting something to work is far more important than proving it is correct or works in all cases.
Finally, I need to come up with and write the demo programs, and I will shortly be posting about this and then asking the Twitterverse for ideas
Time to enter Deep Coding Mode.
No more exams!
So my exams have finally finished... it's a very surreal feeling. Still got the project to go, but my time at university is even closer to being over. I don't think it's really sunk in yet.
Once the exam was over, a group of us headed to get some drinks, and came away with four bottles of cheap champagne sparkling white wine ("We've just finished our exams and want quantity over quality. What have you got?") and headed to the Union to consume it. Sadly things got slightly out of hand there, but I eventually headed back home after completely failing to work out how I could get to Camden (because I managed to completely forget the Tube existed).
Came back after the post-exam celebrations to find these stashed in the kitchen:
My cider has arrived!
So, next stop: project. The due date now seems incredibly close!
