Titanic in IMAX 3D

The Titanic sank 100 years ago today. I have always been obsessed with it, ever since I was a little kid. I had a picture book about the discovery of the wreck, and I watched a National Geographic channel documentary about it over and over. So when Titanic came out I was thrilled and I went to see it three times in the theater. I’ve watched it a couple of times on home video since then, and enjoyed it every time. Now James Cameron has gone back and redone the whole thing in 3D. I was pretty skeptical that it could be done, because there is so much water in this film, and anything transparent or reflective causes major problems for the 3D conversion process. But I went to see it anyway.

As it turns out, Titanic in IMAX 3D was absolutely amazing and worthwhile. They have it filling the entire IMAX screen, and for the most part it looks like it was filmed in IMAX. There are very few resolution problems (except for the end credits, but who cares). The 3D conversion is excellent, although there were probably about two dozen shots with distracting conversion artifacts.

In particular, the exterior shots were problematic throughout the film with flattened reflections and optical flow artifacts around the deck railings. Since most of those shots were CG, I was a little surprised they didn’t try to re-render them. I can think of a lot of reasons why not; perhaps it was too expensive, or ILM didn’t have the assets in good condition, or they thought it would be disrespectful to the artists who worked on the original film.

The worst problems were in the scenes with the classic motorcars. The cars had really distracting problems with refraction and reflection. Other problem areas were any of the eating scenes, because the crystal is very problematic. I think the problems with the car would be easier to solve; just overlay a fully rendered CG car over the top of the filmed vehicle. But the crystal is tougher since it’s partially transparent. I wonder if it would be possible to paint out the glasses in the film and then render new glasses and try to fake the environment. It would be pretty hard to make it work.

There were several long shots of the ship sinking that had major problems with the reflection. I thought this was a missed opportunity because it seems to me it would be pretty easy to replace the water. If you wrapped geometry around the ship and added a water plane you could calculate a new reflection. Since the water around the lifeboats and splashes was disturbed, you’d be able to to roto those out and place them over the newly rendered water layer.

I know I’m one of the few people who would notice these things but I’m a little disappointed that they didn’t go for perfection. In a movie with thousands of shots really well done, it’s a shame that there are a couple dozen left with problems. Given the advances in CG since 1997 I think a lot of the problems could be fixed with sufficient budget, and maybe they will be for the 200th anniversary re-release.

At any rate, I think it qualifies as the best 3D theatergoing experience since Avatar. It was certainly a more immersive experience than Transformers 3, and it’s much better movie than Tron: Legacy. It’s a must see.

Gotcha When Testing Jsonify Views with RSpec

I’m kicking myself because it took me a long time to figure out something so obvious. However, this snuck up on me because I refactored a controller to use the Jsonify gem instead of render json: {object}.

When you are testing the response body in RSpec controller specs, it will work with render json no matter what. So, as an example, render json: {hello:"world"} returns '{"hello":"world"}' inside response.body. But after you switch it to a view with Jsonify like this: json.hello "world", you get '{}'. What gives?

Well the answer is right in the readme for rspec-rails-2:

RSpec’s preferred approach to spec’ing controller behaviour is to isolate the controller from its collaborators. By default, therefore, controller example groups do not render the views in your app. Due to the way Rails searches for view templates, the template still needs to exist, but it won’t actually be loaded.

Therefore, if you want to render your views you must include the render_views directive in your describe block:

1
2
describe WidgetsController do
  render_views

That probably would have jumped out at me a lot sooner if I was trying to test a standard .erb view, but of course it applies to any templating solution, and it’s best not to forget it!

The Most Valuable Checkbox in DVD Studio Pro

This has happened to me over and over again: it’s the last minute of a busy day. We’re rushing to burn a DVD to send to a client. All the footage has been compressed. Everything is perfect. The DVD looks good in the simulator. Let’s burn this thing! Hit burn. DVD Studio Pro thinks for a while and then fails. “Muxing Error” it says. Sadness and despair prevails.

Fortunately, there is one checkbox hidden in the preferences that usually fixes this error and sends us on our merry way home.

RVM and IntelliJ/RubyMine Integration Tip

This is just a quick tip: I mentioned in passing in a previous article that in RVM, we have the ability to cause a specific gemset to load when opening a directory in terminal by saving a plaintext file named .rvmrc in the project root directory, with the gemset specified on a single line inside like this: rvm use ruby-1.9.3-p0@my_gemset

Now this is particularly worthwhile if you are using an IDE like RubyMine or IntelliJ that features RVM integration. If you don’t have an .rvmrc file the IDE doesn’t know which gemset to use. To change it you have to go to Preferences > Ruby SDK & Gems in RubyMine or Preferences > Project Structure > SDKs in IntelliJ. Particularly in the latter case it’s a lot less convenient than switching gemsets on the command line. If you do add an .rvmrc file, the IDE is able to read it and will choose the appropriate gemset automatically, saving you lots of time.

The last issue is whether or not you should check the .rvmrc file into version control. I lean towards ‘yes’ on this one but it’s up to the preferences of your team. Some people might not appreciate you dictating the name of their gemsets. On the other hand if you’re a team lead, it will help you keep junior team members from running the app in a polluted gemset because they never bother to create new ones.

It’s definitely a bad idea to check in your .rvmrc to a project hosted on GitHub or other open source repository because you have no knowledge of how people in the wild have set up their gemsets, and you don’t want to cause conflicts. For example, you might have a gemset called 1.9.3@blog and they might have one under the same name for a completely different project with different gem requirements. If they open the project and they aren’t paying attention they might bundle install and screw up the existing project, and then they’ll have to rebuild their gemsets which will probably annoy them greatly.

Input Box Tips, Part 2: Select All on Focus

In Part 1, I showed how to limit the number of characters in a text input (easy) or a text area (somewhat more difficult.) In this part, I’ll address a common behavior in forms, which is for an input to select all of its contents automatically when you click or trigger a focus event on said input.

Here is the first Google result: Select text in input box on user select or focus. To summarize: all you have to do is $(input).select() in your click handler.

Unfortunately, it’s not quite that simple because calling select() doesn’t work in every browser when the focus event is triggered by a mouse event. The trouble is that the events are not fired in the same order on every browser. Webkit happens to fire its mouseup event after the focus event, and that causes the text to highlight and instantly de-highlight again. Result? No selection.

Input Box Tips, Part 1: Limiting the Number of Characters

There are a couple of top ranked Google results regarding input boxes that I think are a little out of date. Here’s one of them, from 2009:

Limit the Number of Characters in a Textarea or Text Field. This tutorial shows you how to build a textfield with a character limit and a counter, similar to what you see on Twitter.

It shows two techniques for limiting character count. Unfortunately, it glosses over the simpler of the two, which works for inputs: the maxlength attribute.

So if all you want to do is make a text input that only accepts, say, four characters (for example if someone was entering a year), this is what you would do:

1
<input type="text" placeholder="YYYY" maxlength="4"/>

Text areas are a tougher challenge because the <textarea> element doesn’t have a maxlength attribute. I don’t like the solution in the article linked above because when you reach the limit, you see the last character you entered be deleted automatically. It’s not how most sites work, and I think having the text input simply not accept any more characters is more elegant and consistent with the behavior of maxlength.

Thunderbolt Has Made the Mac Pro Obsolete

I’m going to make a prediction: the Mac Pro is dead. Here’s why. Instead, I think we may see an Apple-branded Thunderbolt extension case aimed at users of iMacs and high-end MacBook Pros with the same basic layout: quiet fans and easy access to internals but without the processors and maybe even without the hard drives.

It would be much more portable, which would make it a lot easier to bring on set for doing test comps and other production tasks. Anyone who has tried to carry a Mac Pro in a shock-proof crush-proof case up a flight of stairs will breathe a sigh of relief.

There were rumors of a rack-mountable 3U version of the Mac Pro but I think it’s unlikely. OS X server is not a very attractive product, and I doubt that they are making much money from it. It’s hard to believe that someone who has done their research wouldn’t favor a cheaper solution over a Mac Pro unless it was a small business with just one or two servers looking for ease-of-administration (and even then they might be disappointed). I find it doubtful that sort of customer would invest in a rack. They’d probably just set the computer on the floor in a closet.

Should Apple Spin Off Its Pro Apps Division?

Today, Apple released Final Cut Pro X 10.0.3 with a lengthy list of long-overdue features. If they were being honest, the version number would be 10.1. For some reason they’re insisting on pretending this is a maintenance release. Perhaps remarkably, this release has a five star rating on the App Store so far (with the average for the previous three versions around two-and-a-half stars). I can’t fairly judge myself since I generally don’t need multicam editing and I haven’t got a broadcast monitor handy, nor am I particularly familiar with FCPX. I have done one small project and I found myself getting rather frustrated with it.

It may be intuitive from the perspective of a user unfamiliar with existing editing software (except perhaps iMovie), but as someone who has edited professionally with Final Cut Pro since version 3, it’s a truly brain-twisting experience at first. Still, a lot of the interface issues that FCPX attempts to address have also been frustrating me to no end since version 3, so I haven’t written it off yet. I just have been too busy programming to really sit down and figure it out.

All that aside, Final Cut Pro has never been an ideal product for professional use. Not because of the quality of the software - I think it was truly superior to the obsolete crap Avid was trying to sell us until recently - but because Apple treats its professional customers the same way it does its consumer-level customers.

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.