Next stop San Francisco

In just a few days I’m moving to San Francisco! I’m insanely excited, both about moving to the city and that next month I’ll officially become an employee of Rapportive, Inc.

If you’ve never heard of Rapportive, you should check it out – it enhances Gmail with photos of the people who email you as well as adding features to help you follow, friend or connect with your contacts on Twitter, Facebook, LinkedIn and more. And you can do all that without even leaving Gmail; it’s seriously awesome.

Looking back, I’ve lived in Cambridge for just over 10 years now, almost to the month. I’m going to miss the place plenty, but mostly I’m going to miss all the amazing friends I’ve made. Hopefully Facebook & Twitter will help make everyone feel a little less far away.

If you’ve never been to San Francisco, I hope you’ll come visit–it’s a gorgeous city.

See you at christmas!

Posted in General | 3 Comments

Leveling up in San Francisco

During the last few weeks I’ve been ‘levelling up’ in San Francisco and getting to know the city better. With Bex I’ve been eating, drinking and touristing all across the city with serious emphasis on the eating.

Here are a few highlights…

Wine country

After a brief bit of uber tourist fun around union square, we headed to Napa Valley for fun with wine. I’d highly recommend driving there and staying a few nights: as well as being totally gorgeous (even outside of the summer/harvest seasons), there is so much valley to see and visit. The whole valley is full of natural beauty. The benefit of driving is that you can be totally flexible over which wineries you visit. (Without a car you’d also be at the mercy of the wine train which is over $100 per person per day). My favourite napa pics:

My favourite part of the whole Napa experience was how easy it was to get a delicious picnic and enjoy it in the grounds of a beautiful vineyard. While vineyards of sufficient scale were reasonably rare, when you found (ie. spent ages researching online) a place that did offer a picnic area, they were always exceptionally beautiful. (And their wines weren’t half bad either).

Extra treats

If you drive all the way to the north end of Napa valley, you’ll find a reliable water jet named Old Faithful. We’d already seen several geysers when we went to Iceland a few years ago, but I couldn’t resist this blatant tourist trap even if it was $10 each for two already-exhausted visitors. To the right of this photo, you can see our final take-home stash: not large, but not too shabby for a 3-day trip.

Back to the city

Once we were suitably chilled from Napa, we hit the pavement and began some serious downtown touristing. Cable cars were first up, which helped us navigate towards Coit Tower (and stunning views of the city).

The climb down telegraph hill (just below Coit Tower) was almost more beautiful than the views from the top: people live in treehouse-like streets that are sign-posted just as officially as any main street elsewhere in the city!

Jail time

Later that afternoon, it was time to go to jail. Alcatraz was a wonderful audio tour and a very intriguing place. It’s bizarre to think how relatively few people it held, (especially compared to how many could gaze upon it from the city). The island and prison have a very surreal quality as you look around it. Some of the views back towards San Francisco are as striking as the prison buildings are stark.

Bike the Bridge!

The following day we set out to “bike the bridge”. I’m not sure quite why this is a such an attraction, but Bex loves biking and the weather appeared to be great, so it seemed worth a try.

The weather quickly changed, but despite gale force winds and slightly overcast skies, we managed to keep our smiles and get some fun shots:

Chinawoods in Sausalito

We rounded off our touristathon with some old fashioned wandering around Chinatown, a trip to Lori’s diner (which had reasonable food and an insanely cute bunch of retro-chic furniture), an ankle-busting walk through Muir Woods, and a gorgeous lunch in Sausalito.

I’ve only skirted the surface of the amount of places I’ve eat and drank at in the last few weeks. If you’re in the area, shout up and let’s yelp it up. If you’re not planning a trip here, MAKE PLANS!

Posted in General | 1 Comment

Fixing a Sequel Pro compilation error

I tried to download and build the source code for Sequel Pro today and ran into a hitch. After following the instructions for grabbing the source code and trying to compile it, X-Code refused to succesfully build the app, instead opting for this error:

If you click the icon on the far right to expand the problem, at the bottom is the relevant error message:

Failure Reason: Could not determine the location of the plug-in with the identifier net.wafflesoftware.ShortcutRecorder.IB.Leopard

Thankfully this is more specific than the previous ‘Unable to resolve plug-in dependency for “BundleEditor.xib”‘ error. To fix it we need to download, build and install an Interface Builder plugin called shortcutrecorder. Get the source code with this command:

svn checkout http://shortcutrecorder.googlecode.com/svn/trunk/ shortcutrecorder-read-only

Once you have the code, open its project file in X-Code, and before you click ‘Build’, make sure you set the active target to “ShortcutRecorder.ibplugin – standalone” as per the screenshot below:

Then build the project. Once successful, navigate to the shortcutrecorder’s project directory in Finder, open the build/Debug folder, and double-click ShortcutRecorder.ibplugin. It will open silently in Interface Builder.

Now go back into X-Code, close the shortcutrecorder project, and Clean All Targets in the Sequel Pro project. Once done, click ‘Build and Run’ and you should see a fresh copy of Sequel Pro running in your dock.

Happy hacking!

Posted in Uncategorized | 1 Comment

Happy New Year!

Phew, it’s been a while. More soon.

Posted in Uncategorized | Leave a comment

Using facebook connect (only) to authorize users with authlogic

I’ve been working on our semi-stealthy new webapp for the last couple of months and I’ve been putting off fixing a bug for ages because it was so damned weird.

We want users to be able to sign-up with facebook connect, and not have to mess about creating a new account and setting Yet Another Password. So I grabbed authlogic and got the facebook connect plugin for it and got to work.

Everything was fine and dandy using facebook connect to authorize a bunch of existing users I had in my database, but as soon as it came to signing up new users, ruby would suddenly hit an infinite loop that would bring rails and my laptop to its knees.

I could see from the logs that it was some kind of validation failure:

SELECT * FROM `users` WHERE (`users`.`id` = '498') LIMIT 1
CACHE (0.0ms) SELECT * FROM `users` WHERE (`users`.`facebook_uid` = 1469530132) LIMIT 1
CACHE (0.0ms) SELECT `users`.id FROM `users` WHERE (`users`.`persistence_token` = BINARY '42baaa5f7ae2a550147ac0d88ffa72928ebc75d5ce23d5d65b3c87e972e9d848cf7ad5afb1bf532e2c2780a52f8a9c2bbeee43fce89d8cbbab69eddee10a0d4b' AND `users`.id <> 498) LIMIT 1
CACHE (0.0ms) SELECT * FROM `users` WHERE (`users`.`id` = '498') LIMIT 1
CACHE (0.0ms) SELECT * FROM `users` WHERE (`users`.`facebook_uid` = 1469530132) LIMIT 1
CACHE (0.0ms) SELECT `users`.id FROM `users` WHERE (`users`.`persistence_token` = BINARY '42baaa5f7ae2a550147ac0d88ffa72928ebc75d5ce23d5d65b3c87e972e9d848cf7ad5afb1bf532e2c2780a52f8a9c2bbeee43fce89d8cbbab69eddee10a0d4b' AND `users`.id <> 498) LIMIT 1
... etc ...

After lots of research and hair-pulling I managed to find a jewel of hint; ticket 68 in authlogic’s bug tracker. In your User model, add a before_connect method, (a hook provided by the authlogic/facebook plugin). It needs to tell authlogic that you need a new persistence token.

    def before_connect(facebook_session)
        logger.info("HEY FACEBOOK, HOW'S IT GOING? SO LOVELY TO SEE: #{facebook_session.user.name}")

        # Authlogic isn't as magic as we thought: tell it we need a persistence token, based on advice
        # in http://github.com/binarylogic/authlogic/issuesearch?state=closed&q=persistence#issue/68
        self.persistence_token = reset_persistence_token
    end

With the above in place, new users can register as quickly and easily as clicking facebook’s “Connect” button. Without the above, authlogic is left infinitely searching for a persistence token that hasn’t been, well, persisted.

Note: there’s nothing that says you must have a persistence token when using authlogic, and an alternative workaround is probably to configure your authlogic subsystem to use a different token scheme. However, the persistence token is a common web-based session model and we didn’t want to dump it.

Posted in Rails | Leave a comment

Why Spotify Premium is too expensive, and how to fix it

I recently became a Spotify Premium customer, for two main reasons:

  1. I’d spent an afternoon listening to spotify at my desk and wanted to carry on listening to the same playlists on my iPhone while I was walking somewhere.
  2. As a technology guy I was curious if it was any good

So I forked out my £9.99 to give it a go for a month. Aside from the fact I had to use their website (rather than just tap an in-app “buy now” button on the iPhone), the sign-up experience was simple and easy.

The iPhone app is really good; it suffers from the same problem that all non-Apple music apps have on the iPhone, (namely that the music terminates if you leave the app to reply to an SMS or check your email). It’s not perfect, but it’s a really solid 1.0 release. Playing music over 3G appears to Just Work.

However, I won’t be renewing my subscription for a 2nd month because it’s just too expensive.

Don’t get me wrong, I expect Spotify Premium to be expensive: it offers up a huge proportion of the world’s commercial music for your listening pleasure on a ton of desktop and mobile platforms, ad-free with features like playlist management, integrated art work, artist and album browsing and search and plenty more.

But the kiss of death is that if I pay for Spotify every month for several years and then stop, I leave with NOTHING.

That’s just not a sensible investment in anybody’s book. £9.99 can buy me 2 or 3 albums per month if I’m a real bargain-hunter. By quitting Spotify after 2 years, (£240) I’ll be down by 80 albums.

Crazy.

How to help consumers justify Spotify Premium

If I pay for Premium for more than a month or two, that should tell Spotify that I’m basically a music lover, and every such user should be rewarded as such.

Why not create a system that allows me to accrue album credits for every continuous month I’m a paying customer? This both encourages loyalty to the subscription system as well as reinforcing a strong sense of value for money.

As a bare minimum, I should earn the ability to keep 1 or 2 albums per month at the end of my subscription.

If Spotify really want to be disruptive then I’ll get to accrue at least 5 albums worth of credits for every month I’m a subscriber (after some initial intro period of about 3 months).

For spotify, the infrastructure costs are practically identical – users get to download a tiny percentage of the tracks that they listen to, (which is already a premium feature to enable ‘offline listening’). The biggest issue is that of licensing – would the record labels be willing to allow a purchase-model of music to be integrated into the subscription streaming-model they’re currently charging for.

For consumers, it would mean Spotify Premium was no longer a frivolous throwaway cost, and could be looked at as a long term music investment that would likely involve even bigger spending on music because of Spotify’s enormous streamable catalogue.

That would at least start to give Mr iTunes and his music monopoly something to worry about.

Reblog this post [with Zemanta]
Posted in Miscellaneous | Tagged , | 7 Comments

mig_constraints is not compatible with rails 2.3

Although it’s old, mig_constraints has sat in my rails plugin directory for a while now because it adds much needed foreign key support to ActiveRecord.

I’m on of those crazy guys that thinks a relational database should maintain relational integrity, so it’s been a staple of my rails projects for some time. Unfortunately when I recently upgraded to rails 2.3.4, it created a bizarre obscure error that seems to indicate it’s not compatible with rails 2.3 at all.

As far as I can tell, the best candidate for a replacement is this github project but I’ve not yet had the time to try it. For now I simply removed the plugin from my project and db:migrate reverted to a nice working state.

Continue reading

Posted in Rails | Tagged , , | 3 Comments

Setting up a kick-ass rails server on Ubuntu 9.04 (Jaunty)

I recently created a new slicehost and thought I’d try the latest Ubuntu release with it. Unlike brightbox hosting, you only get a plain boring ubuntu installation out of the box on slicehost (and various other VPS-based hosting services).

A bit of aptitude

Ubuntu/Debian make it really nice and easy to install packages, but this time it still took me a couple of hours to install everything.

For my (and your) future reference, here’s all you need to create a full rails/mysql/apache platform on Ubuntu 9.04:

apt-get install rubygems ruby1.8-dev mysql-server-5.1 libmysqlclient15-dev apache2 libopenssl-ruby libxslt1-dev libcurl4-gnutls-dev build-essential apache2-prefork-dev libapr1-dev libaprutil1-dev libmagickwand-dev git-core subversion

gem install rails --version=2.2.2
gem install rake mysql passenger

cd /to/your/app
rake gems:install

Be sure to follow the instructions that appear after installing passenger, and then that’s it! Make sure you set the version number of rails that you need, or remove the –version parameter if you just want the latest stable release.

(Note: the last line assumes you’ve added all the gems your application requires to config/environment.rb. You could make the above list of packages even more minimal, but they cover plenty of common gem dependencies).

Going the extra mile

If you need to setup an environment to create screenshots programmatically, you’ll need a virtual X server, firefox and selenium (which is Java-based). That’s also fairly easy:

apt-get install xvfb firefox latex-xft-fonts sun-java6-jdk gsfonts-x11 sun-java6-fonts
gem install selenium-client

Do you have any must install packages when creating a new server? Please add them in the comments below.

Posted in Rails | 1 Comment

Wisdom from a different (Internet) age

It doesn’t happen very often, but I was pointed to an online article recently that dates back almost a decade. The Pitchman is a story by Malcolm Gladwell about ”Ron Popeil, who invented a better rotisserie in his kitchen and went out and pitched it himself.”

“Like most great innovations, it was disruptive. And how do you persuade people to disrupt their lives? Not merely by ingratiation or sincerity, and not by being famous or beautiful. You have to explain the invention to customers– not once or twice but three or four times, with a different twist each time. You have to show them exactly how it works and why it works, and make them follow your hands as you chop liver with it, and then tell them precisely how it fits into their routine, and, finally, sell them on the paradoxical fact that, revolutionary as the gadget is, it’s not at all hard to use.”

“in every respect the design of the product must support the transparency and effectiveness of its performance during a demonstration – the better it looks onstage, the easier it is for the pitchman to … ask for the money.”

While Ron and the article are focused on gadgets and devices, the above holds true for any kind of innovation that you’re trying to convince people to buy, or in the case of a free service, just to use.

Posted in Starting up | Leave a comment

Nokogiri fails to work on Solaris (11), but fix it like this!

I’ll have a better fix up in the near future, but for now, the ruby gem “Nokogiri” crashed out on me on Joyent’s Solaris platform. Its error was a little cryptic unless you’re familiar with libc. I can’t reproduce it here because unfortunately it’s lost in the sands of scrollback buffer.

The crux of the problem was the reference to a missing vasprintf function. Nokogiri has an extension implemented in C that speeds it up with native functions. The extension is compiled when you do ‘gem install nokogiri’ and will compile even though the vasprintf function is missing in your environment.

vasprintf is available in Linux, but not in Windows or Solaris. Nokogiri already have a workaround in place for Windows, but they don’t yet detect the issue in Solaris so the error still occurs. I plan to submit a patch to detect this automatically. If for any reason you need to get nokogiri working immediately on your Solaris 11-based Joyent accelerator, I did the following after installing the nokogiri gem:

cd /opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.2.3/ext/nokogiri/
vi native.c
[remove the #if XP_WIN line and its corresponding #endif]
vi native.h
[remove the #if XP_WIN line and its corresponding #endif]
make
make install

FWIW, on Linux and Mac OS X nokogiri just works.

Posted in Rails | Leave a comment