Using permanent_records Gem with ActiveRecord Session Store

I spent a couple hours pulling out hair when, after switching my Rails app from using the Cookie session store to the ActiveRecord session store, I could no longer log in without an arcane exception RecordNotSaved.

Searches on the web revealed no correlation between using the ActiveRecord session store with the permanent_records gem but stepping through the libraries with pry strongly suggested that calls to loaded? in a couple of Session callbacks should have returned true but didn’t because the record had been deleted thanks to permanent_record.

In the end the following quick monkey patch was all that was needed. Place this in config/initializers/session.rb and enjoy.

Microsoft Development Tax


I used to be a Microsoft-only developer until I started working with my latest client. I used to buy my annual $3000 MSDN subscription so I could stay on top of their technology. And to a diminished extent, I still have to keep on top of this because I have several clients that are Microsoft shops. But at my current client, they use almost all open-source tools and technologies. This I initially found quite disturbing. Where would support come from? How can we run our business using these amateurish products that anyone can contribute to. Where’s the QA?!

It didn’t take long for my fears to subside. What I had initially thought to be concerns turned out to be benefits. I won’t get into the whole open/closed source debate here as it’s been done to death, but it became apparent that quality of these products, especially the more mature ones, is in fact probably better than that of the corresponding Microsoft offerings. Now, everyone makes mistakes and bugs get into products all the time. In the open source world, when a bug does get introduced, many many eyes quickly see it, and enthusiasts (as opposed to paid staff) race to fix the problem. As a result, quality really becomes almost a given because poorly-written applications are largely destined to never make it out of the gate due to a lack of adoption. Don’t get me wrong: there is plenty of junk out there. But by and large, software like Ubuntu, Ruby on Rails, and Eclipse just to name a few are very robust and proven technologies. One needs to be diligent in selecting the tools that will run their business just as much in the open source world as in the closed source world.

When asked to build a solution for one of my clients, I would normally create a .NET web app  in Visual Studio that would eventually run on Windows Server. Visual Studio is not cheap. Windows Server and its various client access licenses is not cheap. Now I write Ruby on Rails apps that run on Ubuntu Server. These are proven technologies, and Rails is one of the nicest environments to work with, which makes my work more fun and more productive. A great benefit is that all of this is free. So tell me how I am supposed to tell my clients that they should pay for Microsoft infrastructure when I can give them the same thing built faster that uses free software? I can’t.

You Expect Us to PAY for This?

But to me, there is a more fundamental problem with Microsoft. And this one is really starting to bother me.

A constant theme in the open source world is that there are minimal financial barriers to adoption of these technologies. You want to run Ubuntu or some other flavour of Linux? Download the installer disc and install it. No CALs or other license fees to worry about. You want to learn Ruby on Rails? Go to the Rails site, install the executables, and away you go. There are some free IDEs if that’s what floats your boat, but by and large people use simple text editors. And there are lots and lots of tutorials, examples, blogs, screencasts, etc. All free. Not so with Microsoft.

Now it’s technically true that you can write .NET apps with Notepad or one of the free versions of Visual Studio. But no serious developer is going to that, especially in a corporate setting. Microsoft keeps most of the really useful features out of these free versions so you are really forced to pay to write code for their platforms. It’s no secret that more people are shunning Microsoft solutions as time goes on, so you’d think Microsoft would want to reverse this trend by making their platform more attractive to developers. Instead, Microsoft seems intent on taxing developers, the very grassroots community that they built their business on, by charging them for things like Visual Studio, MSDN, TechNet, and development copies of Windows and Windows Server. This seems self-defeating in an age where there are so many free alternatives.

Instead, Microsoft should drive development by making things like VS2010 available freely. This would really help turn things around for them. It is hard for a lot of SMBs to justify spending thousands on a copy of VS2010 PLUS Windows servers, CALs, etc when they can spend nothing on Linux server apps built on free Java/Eclipse or Ruby on Rails. Once today’s open-source enthusiasts, which is predominantly a younger demographic, gets promoted within enterprises to the point that they make infrastructure decisions, Windows will be in serious trouble.

Microsoft TechDays (BlechDays?) 2010

What  brought me to write this is the upcoming Microsoft TechDays 2010. While it’s true that there is value in the sessions presented at this event, a big attraction is the “free” stuff you walk away from the event with. Last year, the only significant take-away was a one-year subscription to TechNet Plus. This product (which arguably should be made freely available to developers, see above) has a sticker price greater than that of TechDays itself, and was a major consideration in my deciding to attend. No doubt a lot of others felt the same way.

It was recently announced (note the distinct lack of comments) that a TechNet subscription would NOT be included for 2010 attendees. This was enough to make me instantly decide not to attend. Fast forward a couple of weeks however and I get an email link to a post saying that TechNet WOULD be included in 2010 because of the efforts of the event coordinators who convinced MS Canada to supply attendees with subscriptions. Here is an excerpt:

I am happy to announce that the hard work has paid off and we have been able to work with Microsoft corporate and each TechDays 2010 attendee will get a TechNet subscription!

This benefit is added to the over 50 Sessions of technical content, networking opportunities, great offers from our Partners, like Telerik, Pluralsight, Xceed, and access to 50 virtual labs to get hands-on without requiring you to provide the necessary hardware and software to support adoption. 

Now, to be clear, I did announce just a couple of weeks ago that we would notbe providing TechDays 2010 attendees with TechNet subscriptions, but understanding that now, more than ever, you need all the tools in your arsenal to help you deploy Windows 7 and Office 2010, implement Windows Server 2008 R2, Hyper-V, SharePoint 2010, and other technologies, we were able to work with our colleagues at Microsoft Corporate to make a one-time exception.

Fantastic! But several inconsistencies and flaws in their reasoning were apparent.

First, the email stated how significant it was that they managed to secure subscriptions for attendees. I agree. But they went on to seemingly minimize the significance of this by stating that it will NOT be included in 2011 or later, and that it’s really no big deal because it’s the sessions that provide value blah blah bullshit. So which is it? Are you just trumpeting yourselves for getting us TechNet subscriptions, or telling us that they aren’t really all that important because you aren’t going to try and get them in 2011, or they are important but you aren’t going to bother trying again? A lesson in expectation management seems in order. But I really started to boil when I read some of the comments to that post which were somewhat smugly answered, seemingly in an attempt to minimize the value of TechNet compared to the sessions. While I can’t disagree with that statement to some extent, it seems they fail to acknowledge that there are a lot of people that go to this event primarily for TechNet and the value that IT brings. Worse, in typical Microsoft style, they try to tell people how to think rather than listen to their concerns. After all, they are Microsoft, so they must know best. To wit:

The sessoins [sic] are the main “gift” you get and I think people must see the value of that.

Thanks for that blinding insight, clearly we aren’t capable of thinking for ourselves. But what really got to me was that they censored my comments to that post. I twice asked why Microsoft doesn’t make development tools more freely available, once rather pointedly, a second time in a much less aggressive fashion, but both comments were never listed. I guess they don’t want others thinking that people might not agree with their authoritative views. Well f*ck you Microsoft Canada, I will not pay even the early bird fee of $350 for the privilege of attending your TechDays now or in the future. And while I will provide Microsoft solutions to my clients if they so desire, that will not be my first recommendation.

How to Quickly Configure an Unbuntu/Rails Development Virtual Machine

I’m starting a new Rails project, and as usual I want a new dedicated virtual machine to keep it isolated from my other development environments. Since it will be based on Ruby on Rails, Ubuntu is my choice for operating systems. Though it’s not terribly onerous, I didn’t feel much like installing from scratch, so I found a great resource here:

After starting the VM and installing VMware Tools as per the site’s instructions ( and excellent script (I recommend upgrading the kernel before this to avoid having to run “sudo –d” again, like I had to) I used the Synaptic Package Manager to install Ruby, Rails, MySQL Server & client + tools, Git, the full version of vim, and several other packages.

Since my project will use SQL Server as the back-end database, I needed to install a suitable database adapter. Instructions for one such adapter are at As documented, specific versions of support gems are required.

The number one annoyance for me to running Ubuntu in a VM is that horrific speaker beep when doing filename completion or trying to scroll past the end of file in vim.

After some research, I found two complementary solutions. First, edit /etc/modprobe.d/blacklist.conf and add the following lines:

# turn off the PC speaker
blacklist pcspkr

This kills the beep once and for all. However it would be nice to get a visual beep, so add the following to ~/.inputrc:

set bell-style visible

There were also keyboard issues as the VM image is set to an international keyboard by default. I changed the keyboard to a Generic 104-key model and set the layout to English Canadian. No more irritating accent characters.

Here’s a nice article on configuring remote access in Ubuntu: This way the VM can be running on a host in the server room and I can connect to it using my main workstation. I particularly like the bit about allowing multiple users to access different virtual screens.

At the end of the day, I have a pretty current VM image that’s ready for Rails development action.

Being Windows Live

Just watched Being John Malkovich the other day, one of my personal faves. Definitely one of the stranger flicks out there. Another big fave is Shadow of the Vampire, also starring JM.

But we digress. I have seen much about Windows Live but read an article today about how its Windows Live Writer is a great blog editor, so I decided to give it a go. So far it seems good. I think I’ll try Windows Live Mail and see how well it works with my Google Apps account.

Yes, there are definitely a lot of italics in this post!

My Microsoft Action Pack Subscription was activated late last week. I created a VMware VM containing Windows Server 2008 R2 64-bit and Office SharePoint Server 2007 for a project I am working on. I’ve been out of the Windows world for a while now, and while using FOSS tools like Ubuntu, Apache, Ruby on Rails, etc is a lot of fun and often a technical challenge, I forgot how nice it is to double-click an installer and be walked through a series of options. For the most part, it just works, easy peasy.