Model Specific Formatted Search Results Using Thinking Sphinx

Having recently implemented Thinking Sphinx on one of my web sites, I thought it would be cool to be able to search every indexed model. With Thinking Sphinx, it’s easy to have a bunch of different classes returned in the results. The tougher part is displaying them in a way that is organized (although admittedly not very DRY).
Read the rest of this entry »

SEO and Cross-Domain Content Syndication

When dealing with content syndication, one is occasionally in the situation where you are not the higher ranking site in search engines. You might rank #4 for an article and in that same search, your syndicated content may be ranked #1. What’s the best way to deal with this?

After much reading and discussion, I believe that you have a few options.
Read the rest of this entry »

Being Smart is all about Being Resourceful

The internet us the ability to not while keeping up the appearance that we do. Now that’s not to say that you should be a know it all, but you should definitely know how and where to get information if you need it. If you use a specific open source technology at work, then you need to know how to support (because odds are, it was written by a few interested people and doesn’t have a company behind it). So you should know where the forums are, where the documentation is, where the mailing lists and the mailing list archives are, etc. Do they have an IRC channel where you can talk to live users who might be able to help on a more immediate basis? Maybe there was an even a book written that you can get your hands on, a PDF, or even a screencast. If you lucky, you might write a Tweet about your frustration and one of the products creators will answer (which happened to me recently).
Read the rest of this entry »

When To Use MySQL Cursor Classes In Python

I have been writing a lot of code that has been interacting with MySQL lately. Sometimes I find it easier to work the result set in a dictionary form and other times it is easier with an array. But in order to not break all your code, it is necessary to set a default cursor class that keeps your code consistent. More often than not, I find using using a arrays is easier since I just want quick access to all the retrieved data. I also end up making my SELECT calls while specifying the columns and order of the columns I want returned.

The reason that using cursor classes is handy is because Python doesn’t come with a mysql_fetch_assoc like PHP or selectrow_hashref like Perl’s DBI interface. Python uses cursor dictionaries to bridge this gap. Ultimately your result is the same. But as with Perl and PHP, defaulting to cursor dictionaries isn’t a good idea for larger datasets because of the extra processing time and memory required to convert the data.
Read the rest of this entry »