RVM for Python (setting up virtualenv & virtualenvwrapper on Lion)

If you’re a regular reader of my blog, you know that I use RVM (Ruby Version Manager) to manage gemsets on my computer. This way, I can have an app running on Rails 3.0 and another on Rails 3.1 and don’t have to worry about gem incompatibilities. Without RVM, you are stuck with just one set of gems for your entire system, which makes working on more than one app a hassle or worse. Naturally, this problem is not Ruby-specific, but affects every language that utilizes packages.

Python is one of them, and it’s one you’re likely to need to use at some point. The Python community (specifically these fine people) has developed a tool to manage your environments in Python in a very similar manner to how RVM makes our lives easier in Ruby. It’s called virtualenv.

Migrating Wordpress Data to Octopress/Jekyll

In keeping with an apparent tradition, I will discuss the process of moving my data from Wordpress.com to Octopress. It was not an entirely trouble-free process. All of the following advice applies to Jekyll, not just Octopress.

First of all, the default migration script failed to run. I couldn’t find any advice on the subject online, so I decided to try exitwp instead.

I’m Moving My Blog to Octopress

After writing my first 19 posts on Wordpress.com I realized that it really doesn’t fit the requirements of a technical blog. You can pony up $99/year for a professional account that includes a few more plugins and the ability to edit your site’s CSS, and I planned to do that eventually. But there is currently no way to include gists from Github, which is something I really wanted to do, because of the obvious concerns Wordpress has with embedding JavaScript in posts.

I was also dissatisfied with the results of the pre and code tags. So I started researching web hosts for a custom installation. Given that this blog doesn’t have a huge number of readers thus far, I didn’t really want to part with the cash, and choosing a hosting provider is surprisingly difficult! They all have really smarmy, off-putting homepages with low introductory rates. If you Google any variation of “best hosting providers” they have clevery filled the first several pages of results with puppet blogs where unattributed mystery men have praised their product in the guise of unbiased reviews. And many of the companies have multiple brand names and sites. It’s a really icky corner of the internet.

It occurred to me that the development level of Heroku would easily contain the little bit of traffic I get. I love Heroku and have been using it since its initial public beta. If I could host my blog on Heroku, I thought, then if ever I struck gold and the hits started pouring in by the millions, I could just add more Dynos. It seemed like a great idea.

Funny Microsoft Visual Studio Review from Ars Technica

http://arstechnica.com/microsoft/news/2012/01/microsoft-pimps-it-old-school-with-a-pricey-text-adventure-game.ars

Ars technica just posted a hilarious review of Microsoft’s attempt to gamify software development. The achievements offered by Microsoft Visual Studio are actually pretty fun. It seems like an offshoot of code inspections, or maybe code quality tools like JSLint or FlexPMD. I just hope that developers don’t get wrapped up in trying to get all of the Running with Scissors/Don’t Try This At Home achievements when they are working on an actual project! That would be horrifying.

I think it gets at the idea that software development is a lot of fun, and is much less repetitive than most other jobs involving a computer, although I disagree with Ars’ comparison to a keyboard-based text adventure game. I think that writing a program is more like completing a very complicated puzzle. Of course that doesn’t make for very exciting copy.

Logout Facebook Users without using an SDK or JavaScript

Facebook’s documentation does not explain how you can log users out of their service without using their PHP or JavaScript SDKs. Funny thing is that when I googled for an answer I found a lot of negativity and people claiming it wasn’t possible. Well, clearly it’s possible; how would the PHP or JavaScript SDK’s accomplish it without an endpoint?

As it turns out, it’s really easy. Just add a link to the following url:

https://www.facebook.com/logout.php?access_token=ACCESS_TOKEN&confirm=1&next=REDIRECT

replace ACCESS_TOKEN with your temporary access token (that you got from OAuth) and REDIRECT with the full url of wherever you want to redirect to after logout, for example:

https://www.facebook.com/logout.php?access_token=1234567890&confirm=1&next=http://jstarrdewar.com

You just need to watch out because Facebook apparently changes their logout technique from time to time, hence the confusion. You need to be wary of breaking changes. To get the latest version, you could clone the PHP SDK and see what format is returned by this method: getLogoutUrl

RubyMine 4 EAP fails to install gems needed for debugging in Ruby 1.9.3p0

The latest build of RubyMine 4 (112.291) can’t debug with an rvm gemset using ruby 1.9.3 on my iMac. It complains that it is missing the necessary gems, offers to install them, downloads them and attempts to install them, and then hangs while ‘building native extensions’.

I’m sure this will all be worked out in time for release, but meanwhile here is a really easy fix: just install the ruby-debug19 gem via the command line. This, or one of its dependencies, is hanging while building native extensions when RubyMine attempts the auto-install.

rvmsudo gem install ruby-debug19

Wait for that to finish. Now when RubyMine offers to install the missing gems, it will do so without a hitch (or at least it did for me).

iMessage Stops Working

I had a weird thing happen this weekend. My iPhone stopped sending and receiving iMessages, even though they were still turned on in settings. The following sequence rectified the issue:

  1. Turn off iMessages
  2. Restart the Phone
  3. Turn iMessages back on

Just toggling iMessages didn’t do the trick.

The episode made me think about how insidious the whole iMessage thing is.

EaselJS, TweenJS, SoundJS

Grant Skinner has been busy lately, and he has apparently been focusing his efforts on HTML5!

The fruits of his labor are some interesting libraries:

EaselJS, a port of the Flash API to the Canvas Element; TweenJS, a tweening library that is meant to work more like the TweenLite/GTween libraries from Flash than the more rudimentary system we get from jQuery; and SoundJS, a sound manager for HTML5’s sound API.

TextMate 2 alpha

After a loooong wait, the TextMate 2 alpha was posted today.

http://macromates.com/changes

There is nothing too exciting to look at if you download and play with it. Most of the changes are focused on making bundles more powerful, so we’ll have to wait for updated bundles to really get some benefit from it.

Another (Ruby Specific) PostgreSQL Fix

If you should get the following error messages:

could not connect to server: Permission denied (PGError) Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

and/or

FATAL: lock file "postmaster.pid" already exists HINT: Is another postmaster (PID 592) running in data directory "/usr/local/var/postgres"?

Try simply uninstalling gem uninstall pg and reinstalling gem install pg the pg gem. Doing so set things right for me.

This is on OS X Lion with the homebrew postgres package. I believe I got the error because when I updated my pg gem it somehow didn’t pick up the path to my homebrew postgres and tried to connect to the system one instead, but I haven’t done enough testing to know for sure. At any rate, the problem is solved now, so my curiosity about the cause of it has waned.