Spotify YQL Table

I’ve updated my fork of the yql-tables repository to include a data table to wrap the Spotify meta-data API.  I’ve issued a pull-request to the yql-tables maintainers so hopefully soon it should be included in the YQL environment.  However, I  notice the last pull request from another user was made in November last year and still hasn’t been answered; not sure if this suggests the project has stalled in some way.

Until it’s included in the environment and therefore available via the console and the web service end-point, you can use the table via this site.

-- Artist Search
USE 'http://maxmanders.co.uk/lab/spotify/spotify.search.artist.xml';
SELECT * FROM spotify.search.artist where artist = 'The New Pornographers';
-- Album Search
USE 'http://maxmanders.co.uk/lab/spotify/spotify.search.album.xml';
SELECT * FROM spotify.search.album where album = 'Together';
-- Track Search
USE 'http://maxmanders.co.uk/lab/spotify/spotify.search.track.xml';
SELECT * FROM spotify.search.track where track = 'Crash Years';

On Becoming a Non-Smoker

Another year begins and so too does a time of introspection and self-analysis.  It’s traditional to make lists of resolutions, and while I plan on resolving to change a number of bad habits and adopting new and better ones, smoking has proved year-on-year to be the one resolution that doesn’t stick.  This year that stops.

I’ve smoked for about ten years, averaging 20 cigarettes per-day.  Now it’s time for me to take control of my life and stop smoking once and for all.  There will always be stressful situations, anxious moments that would previously have necessitated the lighting of a cigarette.  Past attempts to quit generally failed due to lack of resolve, always finding an excuse to have ‘just one more cigarette’.  On the recommendation of numerous ex-smokers I downloaded “Allen Carr’s Easy Way to Stop Smoking” on my Kindle.

I noticed a number of repeated phrases and ideas throughout the book: perhaps this repetition was meant to be perceived on a subconscious level, but I was very much aware of what felt like insidious suggestion being snuck in under the radar.  Having said that, the main themes and ideas in the book didn’t focus on the more traditional ‘will-power required’ approach, nor did the book rely on health or monetary scare tactics.  Instead it felt like having a long discussion with an ex-smoker who simply validated and confirmed various feelings and thoughts that were already playing on my mind.  Having someone who has been in a similar situation acknowledge these things is perhaps the nudge that I needed, to confirm what I already knew to be true and stop smoking for the right reasons.

It’s early days but I’m confident I’ve had my last cigarette.  There is no guarantee that this book will work for everyone, but I’d suggest that if you want to stop smoking you’ve got nothing to lose.  If it doesn’t work you’re in no worse a position than you are in now!

Manage Your Home Directory With Subversion

Revision control systems serve their purpose well for managing codebases, but they can also be used to good effect for configuration management.  I’ll discuss how I’ve used Subversion to manage the configuration of my home directory.  The same goal could probably be achieved just as easily with Git.  While I use Git and Github for personal projects, I have employed this solution at work where we use Subversion.

Continue reading

Subversion And The Entropy Pool

I ran into an interesting little subversion problem earlier.  I was trying to commit a change, and the commit just seemed to hang indefinitely.  I couldn’t sent an interrupt, and eventually resorted to killing the process.  I tried all sorts of command line options in case there was an authentication problem – with no luck.  I then thought I had made a mistake when switching my working copy to a different branch.  I checked the logs on the server to find nothing pertinent; it seemed as though svn didn’t get as far as taking to the server.  At a loss, I thought there was nothing for it but to run the command with strace.  Bingo!

Strace showed that subversion reads from /dev/random as part of the commit, and that’s where the problem seemed to be happening.  After doing some research, I discovered that /dev/random generates random numbers using the so-called entropy pool.  This entropy pool is just random bits of noise generated from things such as mouse movements, time between keystrokes and so on.  For whatever reason, on the client server, this entropy pool was empty!  Using /dev/random is cryptographically more random than using /dev/urandom; and /dev/random blocks when the entropy pool is empty, whereas /dev/urandom is non-blocking.  Moving /dev/random to /dev/random.old and linking /dev/urandom to /dev/random solved the problem.  There may be a better solution to this, and depending on your cryptographic requirements it might be better to find an alternative, but this did the trick for me.  One svn commit later and all was well.

Fixing MySQL Multi-Master Replication

I’ve had some exposure to database replication through PostgreSQL/Slony. I’m reasonably familiar with master/slave replication but in the last few days I’ve had to get my hands dirty and grok multi-master replication with MySQL, specifically with two MySQL servers in master<->master mode. Although conceptually it’s not a significant leap from simple master/slave replication the added layer of replication in both directions made my brain melt a little bit at first. Now that I’ve got my head around as much as I need to, I’m writing this as a gentle reminder should replication screw up again!

Continue reading