Jun 192008
 

Kent Spillner and I were trying to set up an Ubuntu Live CD with a full rails stack running our current project. We were seeing weird issues with nginx, such as connections being unexpectedly terminated and file uploads not working.

We asked around and Chris Read pointed out that Live CDs use the UnionFS filesystem which does not support sendfile.

From the Versatility and Unix Semantics in Namespace Unification paper:

”…the sendfile system call requires a matching file structure and address space structure. As Unionfs presently has no address space structure, we cannot properly implement sendfile, which is required for loop device mounts and improves performance for Web and NFS servers.”

Once we turned off sendfile (http://wiki.codemongers.com/NginxHttpCoreModule#sendfile), everything worked perfectly.

Jun 112008
 

The last few projects I’ve been on have had a “rake commit” task for checking in. This is documented at Jay’s blog: Ruby: rake commit

Each project has improved upon these tasks. As a result, I thought it would be handy to create a plugin that projects can start with and contribute to. Though the tasks are about subversion, I started a project on github for better collaboration: http://github.com/pgr0ss/rake_commit_tasks

I started with the code at Jay’s blog and added some stuff from my last few projects:

  • Use readline instead of gets so you can use the arrow keys and backspace
  • Break if there are conflicts in svn up
  • Don’t add result of conflicts to subversion (.mine, etc)
  • Check cc.rb and prompt if build is failing

Comments and patches are welcome.

Jun 102008
 

I just released a new version of pulse. Pulse adds an action to your rails project that can be used for external health checking. The most common use is by a http proxy such as haproxy.

This version returns a response with html and body tags, which fixes an issue with selenium on Internet Explorer. Thanks to Ali Aghareza and Brandon Byars for discovering the problem and sending me a patch.

Jun 012008
 

I’m currently working on a project which has a Flex front-end talking to a ruby on rails back-end. Someone recently asked me what I thought of Flex, and my response is below. I’ve only been working with Flex for a couple of months, so it’s very possible that there are solutions to the problems listed below. If anyone knows a better way of doing it, please let me know.

Overall, I find the Flex (and ActionScript 3) world annoying and less productive than either ruby or java.

Testing

Testing is weak in AS3. FlexUnit doesn’t provide dynamic test suites (see my post on Dynamically generating FlexUnit test suite). Flex cannot create dynamic classes, so we cannot create dynamic mocks. We would like to mock out flash classes (such as DisplayObject), but instead, we are stuck with stubs and other work arounds. There is no way to run a single test, so we have to compile the whole thing and run the entire suite in the browser.

Language

ActionScript 3 feels like a weird hybrid between java and javascript. It allows you to specify the types in variable declarations and methods. If you don’t specify a type, you get a warning, so the code winds up being completely statically typed. They removed much of the flexibility of ActionScript 2 (for example, no more eval), which is part of the reason that mocking is hard. It feels like I’m back in java but without the tool support (for example, cglib).

Tools

The main IDE is Adobe Flex Builder, which is based on eclipse. Flex Builder provides some nice features like syntax highlighting, autocomplete, and debugging. However, its compiler is slow and we constantly have to wait to run our code. Refactoring is limited to rename. There is no code formatter built in.

Builds

I prefer rake over ant, but FlexUnit provides a bunch of ant tasks instead of command line tools. We will probably move towards a rake/ant hybrid at some point. We were also seeing weird issues where test failures would fail the build on macs, but not on linux. The tools all seem immature.

Conclusion

Flex is new and sexy, and it is fun to see the output of what we make. However, whenever I switch from ruby/textmate to flex/flex builder, I groan a little. If you want to develop Flex without using an IDE, at least make sure you install the debug version of flash in your browser. That way, when things blow up, you will see stack traces. The regular version of flash will swallow all errors without any indication of what went wrong.