Making Thinking Sphinx Fast in Development Mode

I use Sphinx and the Thinking Sphinx Rails plugin for a few clients. I originally started using Sphinx itself because one client has hundreds of thousands of fairly large articles, and Sphinx could index them the fastest (in something like 10 minutes on the hardware we use).

The major downside is Thinking Sphinx, which appeared to make Rails incredibly slow in development mode. It was unusably slow, even on fast multicore machines. I thought the problem was mine for a long time (I’ve been using this for nearly 2 years), but I studiously kept Sphinx up to date and occasionally peered at the internals. I added a flag to allow me to turn off Sphinx when I didn’t need it to speed up development mode, after I tried running the project without Sphinx (not loading the gem and stubbing define_index).

After looking through the source, I found the load_models which appeared to reload every single model. This happens on every request in development mode. The reason it does this is to find models that need Sphinx, then handle them appropriately.

Read More →

An Inkling

Learning a new platform or language obviously takes a lot of work. I used to do it like this:

  1. Assume I’m awesome
  2. Rush in and make something
  3. Waste a lot of time getting basics wrong
  4. Eventually learn how to do things properly the hard way

This isn’t a particularly productive way of working. After learning a few languages we assume we can pick up new ones pretty quickly, but overconfidence can lead to big problems.

Shortly after this era I entered The Age of the Unwieldy Tome:

Read More →

Future of Web Design Notes

This year Future of Web Design got a lot of things right. The venue was excellent, and the provided food was too — no more hunting for lunch! Overall, the event was more focused and enjoyable.

It seemed like there were too many people covering CSS3 and HTML5. They were really the hot technical topics of this event, which is fine but I’d like to have seem more JavaScript and mobile talks. It might have been confusing for non–technical designers as well — Molly Holzschlag said not to use CSS3 in production sites yet, whereas everyone else didn’t seem to care.


Ryan Carson announced Think Vitamin Memberships, which is a programme similar to PeepCode. I liked the fact the video uses Justice Phantom pt.2, and they had Kid Robot giveaways for early registrations, so I caved.

Read More →

My Desktop is Boring

I revealed desktop earlier and was surprised to find a utilitarian utopia:

  • There are no icons on the desktop
  • The background image is simply grey
  • There’s no Dock

Concerned that obsessive–compulsive minimalism had kicked in, I tried to figure out why my office computer had ended up like this.

Read More →

JsChat and Ico Updates

I’ve updated both JsChat and Ico with major changes recently, as a result of some healthy Easter weekend open source hacking.

JsChat: Mongo, Twitter Auth

JsChat can now be configured to work with Mongo and Twitter authentication:

  • The web interface now has tabs
  • The server now has a config file in /etc/jschat/config.json
  • The config file can be used to set up Twitter auth and Mongo
  • Logging in with Twitter will save the user’s session (including tabs) until Quit is pressed or /quit is entered

Read more on Twitter Auth, Mongo Logging and Tabs

Read More →

The Secret of Popular Blogs

I’ve discovered the secret of making a blog popular. You’re not going to like the answer. Mainly because the answer is a few hundred words of me ranting: but herein lies wisdom I have recently accrued through my adventures in blogging.

The story begins when I started writing on DailyJS. With no bullshitting around it has almost 1400 feed subscribers. Granted, that’s not massively popular by any means, but it’s more popular than any other blog I’ve started. It’s actually pretty stellar given how many readers most blogs get.

However, it’s 2010 and blogs are old news, so if you’re thinking about starting a blog and reaching Copyblogger numbers and sitting on a beach living off Google Ads money, I can’t help you. If you want to start a blog on a topic you’re passionate about, I have some advice.

Read More →

Your Boss/Client's Guide to iPhone Interfaces

Apple’s iPhone SDK provides a set of building blocks for creating interfaces. There are broadly two groups: controllers and low-level widgets like buttons. When designing your app's interface, even at the speculative stage, you should be aware of what's possible in terms of controllers.

By using controllers as they’re intended, and in the right combination, you can create an app that’s consistent with other well–designed apps, and is therefore easy to use.

What are Controllers?

Controllers group low–level interface items. They are used for navigation or presenting data. Even though the term sounds technical, anyone can understand when to use them.

Read More →

Massive Attack

Like many teenagers in the 90s Massive Attack held a deep fascination for me. I was just old enough to appreciate their second studio album, Protection, but it was Mezzanine that made me go out and buy their CDs. Mezzanine struck that rare balance between memorable ballads and deep, dark atmospheres. After several years besotted with grunge, this was one of the albums that encouraged me to explore new genres. I can still listen to Mezzanine on a pair of big studio headphones and become totally immersed in it.


A friend at school told me Massive Attack was formed by members of The Wild Bunch. I didn’t even know that was a western, and I certainly didn’t know what a “sound system” was. I’ve Googled it and tried to listen to tracks online, but it doesn’t mean much to me. If you’re interested, knock yourself out.

Read More →


Back in November I started a new JavaScript programming blog called DailyJS, with help from Ric Roberts and Justin Knowlden. I post almost every day about interesting developments in JavaScript — techniques, tips and library/tool reviews.

I recently toiled over a lengthy review of JavaScript Performance Rocks! by Amy Hoy and Thomas Fuchs — a book that has taught me a lot despite my years of JavaScript experience.

DailyJS has quickly gained popularity (unlike every other blog I’ve ever started), so if you’re serious about JavaScript check it out!

Read More →

Smartphone Security Flaws / Nexus One Review

I’ve been playing with an Android phone recently (the Nexus One. Android has a screen lock feature where you can draw a shape on the screen instead of entering a code. Lazily tracing the unlock code with a finger is a novel (and very fast) way to unlock the phone.

I noticed that every time I do this my code is visible in finger grease on the screen. As disgusting as this sounds it’s an amusing security flaw. Even though it only shows you the overall shape (not the direction the shape is drawn) you can bet native English speakers are more likely to draw the shape left–to–right due to the writing system working that way.

Nexus One

I haven’t used Android much before, and I feel like I’ve started using it at a good time. Just about everything I’m interested in is on the Android Market. I’m not actually switching from iPhone to Android, because I’m a serious Mac/iPhone developer and I enjoy using Objective–C and Cocoa. However, I’d like to supplement my incredibly busy schedule with Android development as well.

Read More →