Coming soon from Room 34: Rubbish Bin Salvage

Room 34: Rubbish Bin SalvageAs I’m looking forward to some exciting new music projects (including some multimedia and live performance possibilities), I’m also looking backwards — to a growing pile of abandoned musical ideas, some of which are nearly complete, some of which are just the roughest of rough sketches, but all of which I put some time into at one point or another, but never finished… and probably never will.

I’ve decided to bare my soul and put these unvarnished (well, mostly) musical efforts out into the world, to see what comes of it. I’ve identified 22 tracks, 65 minutes of music, or at least music-like sounds, and am in the process of assembling them, warts and all (or sometimes just warts), to be released as a free download here. That’s free as in beer and as in speech. I’ll be releasing these tracks with a Creative Commons license to encourage anyone who might find even the slightest shred of a worthwhile musical idea in these tracks to take them and run with them.

I’m calling the album, such as it is, Rubbish Bin Salvage: Rough Mixes, Outtakes & Other Detritus. I even spent nearly five minutes designing cover art for it using a nifty and appropriate stock photo I found.

All that’s left to do is zip up the MP3s and post the file for your downloading pleasure. But since I am also inclined to write copious liner notes no one will ever read, that part will have to wait until at least tomorrow. So for now, enjoy the cover art.

CakePHP paginator sorting problem solved!

I’ll keep this brief, because I need to get back to writing code, but I wanted to share the solution I found to a CakePHP problem that has been nagging me for a while and for which I had never found a simple resolution.

I’m using the $paginator->sort() method to create links in the column headers for tables of paginated search results in my CMS. The method works great, except for one small problem: I could never get it to reverse the order. Intuitively, with links like these, you should be able to click them once to sort in ascending order, and then click again to reverse into descending order. But the reverse was never working for me.

Some research showed that you can pass in all sorts of options to the method, but I wanted to avoid having to make a change like that to about a dozen views; plus, it just didn’t seem right — the method is supposed to do the reverse by default.

At last I have discovered the source of my trouble: you need to explicitly name the model in the parameter that defines the sort field. I’ve been getting more diligent about always naming my models explicitly, but back when I set up these paginated tables (which was about the first thing I did in writing the application), I wasn’t doing it yet. Adding in the model, the reverse order on a second click works perfectly. Here’s a before-and-after example to illustrate the problem and its resolution.

Before:

<?php echo $paginator->sort('Title', 'title'); ?>

After:

<?php echo $paginator->sort('Title', 'Article.title'); ?>