CakePHP Paginator URLs and POST forms

There’s a quote that you often see in the #cakephp channel on irc.freenode.net and it goes something like, “If something is hard in CakePHP, then you’re doing it wrong”. This is proven to me over and over the more comfortable I get with CakePHP. One of the most annoying problems I had as a Cake newbie was a pretty common scenario:

I’m using Cake’s Paginator component and helper to paginate results from my profiles table. Here, sweet Jesus, is a perfect example of why I love Cake! Pagination used to be such a pain in the ass! Now that I’ve got that working I need to set up some forms so that the results can be filtered. So I write up my filter criteria form using the Form helper (*squeal* *gush*). Say I want a filter on the ‘city’ and ‘name’ fields. Also, because I want to be able to bookmark these customized results, I’m going to use the get method for my form. I set my controller action to parse the form input as usual ($this->data).

Everything looks good to me at this point so I submit the form. Ok, it works. But the URL looks like /profiles/search?name=joe&city=toronto, which looks kinda ugly. Oh, and crap, now my pagination is broken. At this point I come up with various hacks that sorta work, but they’re all terrible. Maybe I’ll rewrite some portions of the Paginator helper, or create my own version because holy shit how did these Cake guys make such a glaring mistake! The stupid Paginator helper uses named parameters but I need to submit my form via get so that I can bookmark the results! Come to think of it, what the hell are these named parameters good for in the first place? Much frustration ensues.

Continue reading

Posted in Development | Tagged , , , , , | 6 Comments

How To Enable Half-Star Ratings in iTunes

I have such a large collection of music that 5 stars doesn’t really give me the kind of granularity that I need to rate my music, so I started looking to see if there was a way to tweak that number. I came across this Lifehacker article which explained how to do it on a Mac, but that didn’t help me because my desktop runs Windows Vista (groan). After some more poking around I came across this helpful post and it worked perfectly.

Continue reading

Posted in Music, Tutorials | Tagged , , | 3 Comments

How To Make an iPhone Ringtone Using iTunes

Want to make your own iPhone ringtones and avoid paying up for content that you already have? This is a quick and easy tutorial on how to do so using iTunes. I’m using Windows here, but the process is essentially the same if you’re on a Mac. Before you start, you’ll need to set iTunes up to import music using the AAC format. Personally, I rip all my music to MP3 so whenever I do this, I switch to AAC and then back to MP3 when I’m done.

Continue reading

Posted in Music, Technology, Tutorials | Tagged , , , | 66 Comments

Free Open Source Encryption with TrueCrypt

It wasn’t so long ago that most people didn’t really think about encryption. It was something you’d see in the movies, seen as unnecessary to all but the most paranoid or “the government” or military. Even though you might not know it, many of us now rely on encryption every single day. If you’ve ever bought something on a website or done online banking, then you’ve used encryption. Without it, these things would be too risky to be practical.

Continue reading

Posted in Technology | Tagged , , , | Leave a comment

SSH authentication via public keys

After my last article dealing with ssh I thought I’d write about another feature that comes in handy. Most people who use ssh probably authenticate by using a password. This is not so bad – unlike with FTP for example, where the password is transmitted plaintext, any password that you send while logging in via ssh will be encrypted. But passwords aren’t the only way to login, and they’re arguably not the most secure either.

Continue reading

Posted in Technology | Tagged , , | 2 Comments