Upgrade fail! Quick diagnosis…

It’s a lazy Sunday and I’m looking at the server logs thinking to myself: hm, no one is on the server, all is quiet, why not do an upgrade? I did some testing on my localhost to make sure I thought I knew what was happening and I then I logged onto our Production system. After doing a gem update I restarted the servers and got the very very unwelcome message:

Ruby on Rails application could not be started
These are the possible causes:
There may be a syntax error in the application's code. Please check for such errors and 
fix them.
A required library may not installed. Please install all libraries that this application
requires.
The application may not be properly configured. Please check whether all configuration
files are written correctly, fix any incorrect configurations, and restart this
application.
A service that the application relies on (such as the database server or the Ferret
search engine server) may not have been started. Please start that service.
Further information about the error may have been written to the application's log file.
Please check it in order to analyse the problem.
Error message:
can't activate activesupport (>= 2.3.2, runtime), already activated activesupport-2.2.2
Exception class:
Gem::Exception
Application root:
/xxx/xxx/xxx/xxxxxxxxxxx/xxx/xx/x
Backtrace:
#	File	Line	Location
0	/usr/lib64/ruby/site_ruby/1.8/rubygems.rb	149	in `activate'
1	/usr/lib64/ruby/site_ruby/1.8/rubygems.rb	165	in `activate'
2	/usr/lib64/ruby/site_ruby/1.8/rubygems.rb	164	in `each'
3	/usr/lib64/ruby/site_ruby/1.8/rubygems.rb	164	in `activate'
4	/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb	35	in `require'
...

Whoops.

Fortunately I had save the output of a gem list prior to the update so I could compare all the things that got touched. After futzing around with things for a while I started to try to back out the upgrades by gem uninstall GEM -v VER. This went on for a bit, and the situation wasn’t improving. Then after the activemerchant gem was uninstalled that’s when the apps came back to life. Aha!

I looked at my localhost setup and my environment.rb was actually different from production’s in one significant way:

gem ‘activemerchant’, ‘=1.4.1′

Oh. The clue was also that upon uninstalling activemerchant 1.4.2 there was a message about it depending on Rails 2.3. Well, after updating the production environment.rb everything went back to working order.

Several lessons:

  • Thorough testing on localhost doesn’t guarantee it works on production
  • Updating gems en masse can cause umpteen problems — always update specific gems
  • Use a maintenance window in the middle of the night

kernel_task … you’re killing me!

Oh, dreaded kernel_task. You consume all of my CPU!

This is crazy. I’ve had the occasional problem where kernel_task goes berserk and consumes all of my CPU but this is nuts. Post-install of Snow Leopard on my Macbook Air I have noticed that it goes completely haywire, taking up a very large VSIZE and high CPU %. As a result I no longer seem to be able to run Flash CS4 and Safari w/out problems together. The computer just runs too hot and that only compounds the problem it seems…

Subdomains mapping to users! (via DHH)

Just a quick note about one of the many things I did not know about Rails’ AbstractRequest object: you can use the subdomains() method to get the request’s domains! Woo!

So, if you had a domain “mycoolnewsite.com” and you want “jdoe.mycoolnewsite.com” to access that user’s profile, you just:

  • Set up your webserver config to direct everything for *.mycoolnewsite.com to your Rails server
  • In the ApplicationController add a before_filter to check for the presence of a record based on request.subdomains.first

So easy!

Full article: http://37signals.com/svn/posts/1512-how-to-do-basecamp-style-subdomains-in-rails

See also: http://robbyonrails.com/articles/2009/01/11/subdomain-accounts-with-ruby-on-rails-explained

A thought about iPod Touch positioning

I just read the blurb on Venture Hacks about Steve Jobs and customer development. I find it interesting that he/Apple justified not having a camera as a way to help bring costs down because the iPod Touch turns out to be the cheapest way into the App Store.

The App Store has such a great selection of games and very cheaply. When you start running the numbers, $199 for the Touch plus < $5/ea games looks fantastic compared to a DS at $129 + $30/ea. The App Store has effectively broken the game publishing model because 1) the games are very entertaining, 2) they are super cheap, 3) there are thousands of developers vs. a handful of game companies, 4) games are often quick to pick up and put down, 5) there is a really nice API for web and ad-hoc connectivity. Plus, there’s no extra cartridges or discs to shuttle around with you—the Touch slides so easily into your pocket/purse…

By saying that the Touch is a “pocket computer” it helps elevate the product to a status above the a kid-oriented gaming machine like a PSP or DS. Moms and execs don’t mind carrying the Touch (or iPhone). And by saying “there’s an app for that” what you’re really doing is focusing on the software aspect: a near-limitless way to expand the enjoyment of your product experience. You don’t have to say “it’s the cheapest way to get an awesome catalog of cheap software” because it’s intuited.

But I wonder if the additional $10 to add a camera wouldn’t be worth it? By not having a cam it does help to differentiate the Touch from the iPhone—if you want a pocket cam and the App Store experience you buy the phone. Psychologically, the fact the Touch is < $200 is probably a good price point. I would like to see it about $139 though, and to make up for the revenue difference maybe sell some sort of subscription service?

This Week In “How Did They Do That?!” … hanging punctuation?

OK. I love typography. I wouldn’t call myself a student of it, but nonetheless I can appreciate good typesetting and choice of font. One of the little rules which I learned a looooong time ago is called “hanging punctuation“, which refers to the correct way to place punctuation when using block text. For example, you might think this looks fine:

I was reading the article
“Investing in a Bear Market”
the other day.

But that would be wrong. The correct placement of the quotes is outside the text so that the edge of the text lines up. e.g.

 

 
I was reading the article
Investing in a Bear Market”
the other day.

There’s a bunch of tricks you can do in CSS to make the quotes take up negative margin. But I’m baffled as to the actual way. CSS3 actually does have support for this! But no browser has implemented it yet … or have they?

Supposedly iTunes doesn’t use WebKit, but how do you explain this in one of the descriptions for an album:

itunes_hanging_punct.jpg

So either 1) that’s OS X doing it, 2) WebKit has a new CSS3 extension, 3) that’s a presentation hack.

Also an interesting ticket submitted to webkit.org: Bug 18109 – Implement hanging punctuation https://bugs.webkit.org/show_bug.cgi?id=18109

Thank you Parallels support!

So after making the plunge to Snow Leopard I found that I had to upgrade my Parallels Desktop. However, upon running the 4.0 installer it told me to stop my current VMs. Which … was a problem. My old VMs were in a suspended state—because I never shut them down. And since Parallels 3 doesn’t run on Snow Leopard there was no way to shut down the VMs!

I poked around my computer and saw that there was the old Parallels Image Tool which helps you inspect an image but that’s just to peek into the contents of the image, not to actually do anything with it operationally. I gave up after a little bit more and ultimately wrote the Parallels’ support desk. This was a couple days ago, Sunday.

Yesterday, on Labor Day, I got back a message:

Subject: [Parallels #NNNNNNN] “Can’t install Parallels 4; can’t shut down old guest OS!”
Date: Tue, 08 Sep 2009 02:27:05 +0700

Hello Amy,

Thank you for contacting Parallels Technical Support.

Please accept my apologies for the inconvenience caused.

Please follow the steps mentioned below:

1) Please, open the Parallels folder: by default it is placed in one of the following directories.

/Users/<you user name>/Documents/
/Users/<you user name>/Library/

2) Find the correspondent virtual machine’s folder (Microsoft Windows XP in our example).

3) Delete the files with .mem and .sav extensions.

Please continue the upgrade process now, it will continue smoothly.

If you have any other issues, please let me know.

That’s awesome. It totally worked!

(Note: It’s likely that the support center is open even on US holidays, but still that’s cool I got a response while technically on vacation.)

Snow Leopard (10.6) installation on a MacBook Air? Remote Disc fails!

Having problems installing the new Snow Leopard (Mac OS X 10.6) on a MacBook Air? I did. I thought all I’d have to do was use the usual Remote Disc utility and insert the DVD into another computer. Not so. You might get and error about the disc being corrupted a few minutes into the install. I was about to give up and go to the Apple Store until I found this post on the Apple Support Discussions page which says NOT use the Remote Disc but instead to use the Remote Install Mac OS X app.

The instructions bundled on the install DVD plainly say “You don’t need to use Remote Install Mac OS X to upgrade Mac OS X on a Mac without an optical drive”, but I found this to fail. Just use the Remote Install Mac OS X instead.

… About two hours later Snow Leopard was up and running on the MBA! (Even installed over AirPort!)

remote_install_mac_os_x.png

But using this method was très frustrating because of the language in the utility. So here’s a different step-by-step explanation:

How to Install Snow Leopard on a MacBook Air via Remote Install

  1. You need two computers, let’s call them MacBook Air (MBA) and another Mac (Other)
  2. On the Other: make sure the computer will not sleep!
    • Make sure the Other is plugged in to power
    • Click the Apple icon in the top left of your screen
    • Click Show All
    • Click Energy Saver
    • Set the “Computer sleep” to “Never”
  3. On the Other: Insert the Snow Leopard DVD
  4. On the Other: Open the Remote Install Mac OS X app
    • Click on the Finder
    • Click on Applications
    • Click on Utilities
    • Double-click on Remote Install Mac OS X
  5. On the Other: Click Continue. You should see the Mac OS X Install DVD.
  6. On the Other: select your networking option
  7. On the Other: read the “Restart the computer” message, click Continue
  8. On the MBA: restart the computer and hold down the Option/Alt key until the choose Airport Network prompt comes up
  9. On the MBA: enter in your AirPort (wireless, WiFi) network password
  10. On the MBA: choose the Mac OS X install by clicking its icon then click the “up arrow” below it
  11. On the Other: read the “Choose your AirPort network” page, click Continue
  12. On the Other: read the “Select your startup disk” page, click Continue

Just follow the prompts now and in an hour or so you should have Snow Leopard…

if (time_now % 40mins == 0) { read_twitter() }

I’ve found that after a little over a week of using Twitter that I can’t deal with the constant stream of tweets. It is pretty much like I had felt before: really really spammy. Sifting for good nuggets of info is difficult amid the noise. But I have found a way to make it a little more usable:

  • Only check the Twitter API every 40 minutes.
  • Keep TweetDeck as a normal window so it naturally gets buried way down below all the other windows and you have to consciously click to bring it to the top.
  • Create custom searches.

twitter_rate.jpg

Always take the harder road

I used to be really complacent with just showing up for work then going home after. I’d hang out with friends, play video games, go to movies, and so on. The job would be OK, sometimes a little challenging. But more often than not things just became routine. And after a few years of this it became boring. Once in a while I could be creative and do something really cool, but I was stuck with aging technologies and spent a significant amount of time dealing more with politics than being productive. Oh, and being on 24/7 pager watch for a week. Yeah, I don’t miss the 2:30 AM emergency phone bridge meetings.

Then I left all of that and putzed around a while, finally landing myself at a startup on the Peninsula. Things got interesting right about then: rapid development, lots of new tech to digest, the wearing of a lot of hats, really close contact with management. When that job ended I floated to another startup in SF. More rapid development, LOTS of JavaScript, really smart people, very close to the core business. That job, too, ended and now I’m doing a startup with a really energetic guy. Here I’m wearing just about every single hat, although more often it’s a technical one. Now, I *am* the core business.

My trend has been away from big, stable companies to every-day-is-a-new-challenge startups. I’ve lost a LOT of sleep in the past 3 years, and it looks like it’s only going to get worse. But what keeps me going is not necessarily the promise of the big financial payoff, rather it’s the big intellectual payoff.

I want to be challenged. I crave finding creative solutions to, well, everything. This is why I want to be an entrepreneur and a bleeding-edge engineer. One of my core beliefs is that everything can always be improved. Sure, new technologies and websites can be invented, but also there’s so many people out there that just need help—the problems aren’t always technical in nature. Every day I’m pushing myself, and every day I learn something new. Maybe that knowledge or skill isn’t applicable right now, but one day it will be.

I think I’ve always been like this—driven, that is. I tried to do as many sports as I could in school, took up a new instrument every year or so, did as many clubs as time would allow, desktop-published my homework, or soak up news on the Internet—which really didn’t exist until I was in college. Then I entered the workforce for a big company and all of that challenge seemed to stall out. I wanted to run faster on some things but ran into walls of procedure and politics. When resources got tight I spent more and more time just doing routine maintenance. That was stifling to no end. The point is, I was happiest when I was pushing myself.

Pushing means things are difficult. It’s like I used to think when I was out running up a steep trail on the hot, dry hillsides of Los Altos: you overcome the challenges and you get better. Learning Ruby and Rails has been hard, but I know the next time I have to do these things it’ll be easier. Working hard means learning and innovating, not just spinning your wheel faster.

The current project requires me to pull on all of those skills and knowledge that I’ve accumulated thus far … how to set up and administer a web server, how to install the development environment, how to write reusable code, how to rapid prototype on paper or Fireworks and turn that into HTML, how to write webpages that support IE6 or not, how to create graphics and Flash in a layered fashion, how to write MIDI-sequenced music, SEO, how to administer databases, how to create Word help guides, how to design/print/cut business cards, how to get postcards printed at a printshop, how to be nice to spam filters, how to pitch the business plan, how to give a presentation, how to choose decent lighting for photos, how to help users, how to interpret what Management says and make a useful product … and there’s more things to be learned.

So always take the hard road.