Ruby Banter #011
In this episode, Manfred answers some questions from our viewers about last week’s episode where Eloy defined a method called ‘Object’.
John Resig: Processing.js. Cool. ¶
Fortune: 2.0 iPhone map of the world. Why are we still not on there? ¶
RubyEnRails 2008: De Nederlandse Ruby En Rails Conferentie. Ruby and Rails conference in Amsterdam. No idea why they still haven’t switched to English. ¶
Veerle’s blog: Does Flash irks me? “This makes me think about the WYSIWYG applications and the promises that you can create a site without even touching a single line of code. This approach is broken in my humble opinion because if you want to call yourself a true web designer you got to have an understanding about what is beneath the graphical layer. A machine, how good it made be, will never have the capability to think like a human. It already starts with separating content from presentation. When I start the web development process I always start with thinking about structure first and the implications it may have.” ¶
Official Google Blog: Moving to Unicode 5.1. “Just last December there was an interesting milestone on the web. For the first time, we found that Unicode [UTF-8] was the most frequent encoding found on web pages” Makes me happy. ¶
Daring Fireball Linked List: I Box in Yellow Gox Box Socks. “In print, you’ve got two boxes at a minimum: the page, and the text itself; on the web, you’ve got the browser window and the text. That’s enough boxiness for anyone. The key is to remember that a column of text, by itself, forms its own box.” Couldn’t agree more.
¶
Hackety Org: Sneaking Ruby Through Google App Engine. “Neither of us stands a chance against Javascript. Why persist with this pitiful feud?” ¶
Ongoing: Ruby 1.9 I18n and Mashup Testing. “TDD [...] It took less than an hour. And if I’d done it the right way the first time, it would have taken less time. Yes, I know all the good programmers out there already know that; I’m just publishing this to punish myself.” ¶
Manfred: Canon Selphy CP740 and Mac OS X Leopard. Don’t buy a Canon product unless you plan to never upgrade your OS. ¶
In this episode, Manfred answers some questions from our viewers about last week’s episode where Eloy defined a method called ‘Object’.
Ola Bini: Just add scaling! “I still haven’t found anyone who knows how you implement Scaling in a language [...] Anyone who care to enlighten me, please send me a detailed email with an implementation of Scaling. I really feel the need to know how this thing works.” Very funny. ¶
Jamis Buck: Capistrano 2.3.0. Nice update. We manage a little over 25 web apps (from multiple sites on a single server to a Rails app running on a 10-node cluster) and we would be spending a lot more time on deployment and maintenance if we didn’t have Capistrano. ¶
Ongoing: Look Sideways. That’s what I’m doing. ¶
Jeffrey Zeldman Presents: Stick out your tongue. Sad. But true. ¶
Textism: Embedded video is broken. “I find myself at Youtube or Vimeo or Brightcove or wherever, begin watching something interesting, and immediately start looking for a way to put that in a corner of my screen so I can continue working or doing, um, research and cast my eyes back to it whenever it requires I do so. This evidently can’t be done using any of the popular embedded video gear, so I end up resizing the browser window, which inevitably results in some sort of layout chaos, and opening up a fresh window to resume what I was doing before.” Happens several times a day to me too. I’m hoping to convince a client to give you the option to launch video in an external player if you prefer that above watching the video embedded. Stay tuned. ¶
High Performance Web Sites: Cuzillion I’m going to be needing this soon. ¶
Andy Lo-A-Foe: De TV Flat (KRO). Impressive side project. ¶
Subtraction: Great Numbers, Not So Great Design. “Design doesn’t scale well, in my opinion, or at least it doesn’t do so easily.” ¶
Veerle’s blog: Starting with CSS and bug fixing tips. Nice overview. ¶
In this episode, Eloy shows how to set up a class with default attributes in a single line of code.
Prada SS08 prototypes auction. Still running on the Rails backend we built last year. ¶
Have you ever wanted to test multiple writes to $stderr? Mocking frameworks aren’t good at that, instead you can write a simple class to record method calls.
class Receptor
require 'singleton'
include Singleton
attr_accessor :messages
def initialize
@messages = []
end
def method_missing(*attrs)
self.messages << attrs
end
end
$stderr = Receptor.instance
And in your tests:
messages = Receptor.instance.messages
assert messages.include?(['puts', "[!] Error!"])
assert messages.include?(['puts', "[?] Couldn't find preferences file."])赖洪礼的 blog: The hidden corners of Passenger. “Passenger strives for a concept that we call ‘zero maintenance’.” A worthy goal. ¶
All manner of distractions: Visualizing Radiohead. Simply outstanding. Make sure to download the full version. ¶
Opera Developer Community: Stop using Ajax! “[...] the emergence of Ajax techniques has inspired a whole new wave of applications, but in many (if not most) cases, these applications don’t actually need Ajax to work [...] we can cherry-pick the best ideas – we can build Web 2.0 applications without using Ajax.” True. ¶
37signals: Hire family people. We’re hiring family people too. Email me at thijs@fngtps.com if you’re interested. ¶
Flashing Lights: a climate analysis. Smart video commentary by Brighter Planet, one of our clients. ¶
Be a hero and help us! Your chance to say ‘thank you’ to Julian ‘Julik’ Tarkhanov, the original architect of the Proxy based Unicode support that made it into Rails as ActiveSupport::Multibyte. ¶
In Smalltalk code and data are always kept together. In Ruby this isn’t the case. In this episode, Manfred looks at a poor man’s version of keeping your data with your code.
After some searching we found out that Passenger doesn’t run on Mac OS X because it segfaults on 64-bit BSD systems. All Core 2 Duo and Xeon systems are 64-bit, so that includes newer Mac Mini, Macbook, Macbook Pro, Macbook Air and Mac Pro.
A workaround for now is running Apache in 32-bit. Because Apache is compiled as a Universal binary, that is really easy to do.
The quick but short term solution is to start httpd by hand:
$ sudo arch -i386 /usr/sbin/httpd
The lasting solution is to change the Apache plist:
First we create a backup of the current plist.
$ sudo cp /System/Library/LaunchDaemons/org.apache.httpd.plist \
/System/Library/LaunchDaemons/org.apache.httpd.plist.bak
After that we open the plist in our favorite text editor.
$ mate /System/Library/LaunchDaemons/org.apache.httpd.plist
And change:
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/httpd</string>
<string>-D</string>
<string>FOREGROUND</string>
</array>
Into:
<key>ProgramArguments</key>
<array>
<string>arch</string>
<string>-i386</string>
<string>/usr/sbin/httpd</string>
<string>-D</string>
<string>FOREGROUND</string>
</array>
And restart Apache:
$ sudo launchctl stop org.apache.httpd
Launchd will automatically start Apache for you after the stop command. Now Apache is running in 32-bit and should run Passenger just fine.
Update: Fixed in 1.0.2. Please update your gem and assenger-install-apache2-module if you’re having this problem.
Lately a few things have been bugging me about Rails development using script/server. First, I can’t test through SSL and for applications who switch between SSL and non-SSL you really want your development environment too look as much like production as possible. And secondly, I have to manually manage my app server with script/server. This is a bit of a pain because some of our applications use ActiveResource to communicate so I need to start several app processes.
Proxying trough Apache solved the SSL problem, but now I had to remember on which ports I had to start my app server.
The solution turned out to be Passenger. First we install the passenger gem and compile mod_passenger.so.
$ gem install passenger
$ passenger-install-apache2-module
After that we turn on Apache at System Preferences ➔ Sharing ➔ Web Sharing and edit the webserver configuration. I added everything to /etc/apache2/users/manfred.conf but Apache doesn’t really care where you put it, just remember to load mod_passenger.so before using Passenger specific configuration options.
Set up the Passenger configuration as explained at the end of the install script.
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-1.0.1/ext/apache2/mod_passenger.so
RailsSpawnServer /Library/Ruby/Gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-server
RailsRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Make sure our apps run in development mode.
RailsEnv development
Allow Apache serve files from our development directories.
<Directory "/Users/manfred/Code">
Order allow,deny
Allow from all
</Directory>
Finally, configure virtual hosts for our various projects.
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/Users/manfred/Code/project1/public"
ServerName project1.local
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/manfred/Code/project2/public"
ServerName project2.local
</VirtualHost>43 Folders: Whining, Blue Smoke & the Mechanics of Getting Unstuck “whining should be telling you something. [...] It means you’re unconsciously devoting cycles to something that you can’t, won’t, or shouldn’t be spending time thinking about. Otherwise, why would it be bothering you, right? You’d be either extricated or done with it.” ¶
It’s time for another ‘Morning coffee’ meeting. You’re invited to come chat with your fellow web developers over a nice cup of coffee.
When: Tuesday, May 6th, 2008, 9:30 AM
Where: The Coffee Company on the corner of the Nieuwe Doelenstraat and the Kloveniersburgwal in Amsterdam.
Please leave a comment if you’re coming, any questions you might have are welcome too.
37signals: Urgency is poisonous. Can’t agree more. We don’t have a four-day week, but we almost never do overtime. It’s the only way to consistently deliver high quality work. Be sure to read this comment by Jason Fried too. ¶
We’ve been working with Eloy ever since he impressed us with his RubyCocoa demo at the 2007 RubyEnRails conference, and we are very happy that he recently decided to join the Fingertips team. He is not only a great developer but also a very nice guy. It is a joy to have him on board.
Eloy has been a Ruby developer for over four years. He is an active member of the RubyCocoa community where he started the Rucola project, a project that allows you to write RubyCocoa apps without XCode. He lives in Amsterdam on a boat together with his wife Dionne and their two cats.
Geoff Buesing: Rails 2.1 Time Zone Support. Great overview. ¶
Today Ninh Bui and Hongli Lai from Phusion visited the Fingertips office to introduce us to their Passenger Apache module for Rails. We’re very impressed with their work; installation and deployment is fast and easy and everything just works out of the box.
These guys did a really important job by completely removing the deployment hassle that has always been associated with Rails. They’ve made Rails deployment boring.

We’ll be testing Passenger on a server that’s running 15 small to medium Rails apps. You can expect an in-depth article about our experiences when Passenger will be released ‘any day now, honestly’.
If you’re interested in using Passenger in a bigger environment (for example, if you’re a shared hosting provider who wants to offer Rails support), you should get in touch with these guys to talk about the professional services they provide. Not only because they’re smart, but also because they’re a lot of fun to chat with. We really enjoyed their company.
Flickr: Eloy Knows Ruby. You can get your Fingertips Ruby Certification too for just $150! ¶
The Royal Mint: New Designs Revealed. Very clever and very beautiful. ¶
Seed Conference. Lovely piece of web typography. ¶
Surfin’ Safari: Scenes from an Acid Test. “Web standards can often seem boring compared to super fast performance, whizzy new features, and even the basic Web compatibility work of making sites work properly. Interoperability is critical to the Web as an open platform, but it can be difficult to explain to regular users why it’s so important. The Acid tests make web standards fun, for browser developers, for Web designers, and for regular users. Whatever the intrinsic value of the tests may be, I think we should all thank Ian Hickson and all the test contributors.” ¶
Eloy Duran and I are attending this year’s Euruko in Prague. If you’re also at the conference, don’t be shy and say hi!
...continue reading in the archive for March 2008