Eric Wong’s mostly pure-Ruby HTTP backend, Unicorn, is an inspiration. I’ve studied this file for a couple of days now and it’s undoubtedly one of the best, most densely packed examples of Unix programming in Ruby I’ve come across.
Unicorn is basically Mongrel (including the fast Ragel/C HTTP parser), minus the threads, and with teh Unix turned up to 11. That means processes. And all the tricks and idioms required to use them reliably.
We’re going to get into how Unicorn uses the OS kernel to balance
connections between backend processes using a shared socket,
fork(2), and accept(2) — the basic Unix prefork model in
100% pure Ruby.
But first …
This will be my first talk at a major conference.
The following screed was originally published at gist.github.com/54177 but has been copied here for posterity and because people keep asking me on IRC for the original link (it must be hard to find on gist for some reason).
Real HTTP caching for Ruby web apps.
Fast Markdown libraries for Ruby: two for the price of one.
So you’ve decided to start a weblog and have a really clever idea for titling it based on a snippet of code you find particularly novel. Rad!
What I’d like to do is run Firefox/Gecko on the server. It would load up the report, render it with the print stylesheet and then output the PDF. The concept is not unlike khtml2png or webkit2png but instead of outputting a raster image, it would output a PDF: gecko2pdf, if you will.
On Dreamhost freaking out because they can’t get Rails deployed reliably.
Cheap branches make for new uses.
It’s not Rails’s problem.
Charles Nutter on the possibility of a Rails support announcement in February 2007.
A prediction piece on the possibility of a Ruby backed coup d'état on the JVM and what that might mean to the pragmatic web developer.
Time Travel vs. ESP
Wherein we avoid a Python vs. Ruby flamewar by changing the subject to Object vs. RDMS persistence.
Just keep talking.
The web as currently imagined by the tech. industry is quite different from the web that actually exists.
What does Ruby on Rails have that we don’t and why?
Looks great. Really glad to see file tasks, too. Code is here. I’m dying for a real JavaScript project so I can start playing with all the great looking stuff these guys are putting out.
Mustache is my favorite template language by far. By far. This is a great example of why. It solves every problem simply and elegantly, or it doesn’t solve it all. Here’s the syntax in its entirety. In his post, Chris talks about how adding very simple lambda support solved the cache block problem. It’s just as suitable as solution for embedding Markdown in templates.
Yehuda lays out some of the history and rationale behind Rubygems’s multi-package-version design and also takes a look at how a few recent tools (Bundler, Rip, rvm, etc.) are using different approaches to develop concepts around multiple “environments”.
I’ve never been a fan of Rubygems multi-versioned, directory-per-package approach to organizing packages. There’s a few different reasons, but mostly it forces a lot of unnecessary complexity into runtime that could (I think) be handled more simply at install time. I do like the convenience of installing a bunch of packages into a single Rubygems environment without having to think about it, but those benefits are outweighed by the subtle differences in runtime behavior, some of which can be extremely annoying (e.g., “already activated” errors). I’d rather be aware of and be forced to deal with those issues at install time. It’s great to see so much experimentation on new tools and alternative approaches.
Perfect. This was a huge piece missing from Ron and I had no clue how to address it. Chris’s gem extension adds a gem man command that brings up the man page for any gem and works with any gem that includes normal roff man pages.
Big list of open source projects Twitter developers contribute to. I really like the way this page presents things. It would be really cool if every user on GitHub automatically had a page like this somewhere.
Looks like Aman and Joe knocked one out of the park with this presentation on Ruby’s GC:

I wish RailsLab or PeepCode or somebody would team up with those guys and do a series of screencasts. You can learn a ton just by watching over their shoulder while they work.
I’ve received a lot of positive feedback on this blog post length comment left on Rafe’s recent post about GitHub’s process, or lack thereof. In it, I try to address some of the common objections people have when they hear how things work inside GitHub.
Using Rack::Cache as an example. Nice!
Eric Florenzano asks why modern web frameworks insist on a synchronous programming model and gives some answers with possible alternatives. The article is dead on, IMO, but I’m not sold on his conclusion:
We need to look at these alternative implementations like coroutines and lightweight processes, so that we can make asynchronous programming as easy as synchronous programming.
For Ruby, this is all about making Fiber robust and widely available. There was a time when I too thought this would solve all problems by hiding the underlying async model but retaining its benefits. That’s the dream. I don’t believe in it anymore. Having experimented with such an approach on a small team, I’m fairly confident that everybody working on an event-based/async program needs to understand the underlying model or blocking code will inevitably be introduced and destroy everything. And once everyone’s comfy with async, you’ll find that the sync façade is annoying and unhelpful. Embrace it.
We pushed out a Sinatra 1.0 pre-release. The FAQ includes some info on what the 1.0 release means and how to prepare for it.
Nice list of Ruby one-liners when working at the shell. e.g., emulating nl(1):
# number each line of a file (left justified).
$ ruby -ne 'printf("%-6s%s", $., $_)' < file.txt
# number each line of a file (right justified).
$ ruby -ne 'printf("%6s%s", $., $_)' < file.txt
# number each line of a file, only print non-blank lines
$ ruby -e 'while gets; end; puts $.' < file.txt
Unlike some other things, the -p and -e switches are something I’ve always been glad ruby adopted from perl.
Rick documents his progress a week into node.js. Nice look at some of the basic concepts underlying the system, like async everywhere and promises.
Lots of needed fixes and some new features in this release, including new Config, ETag, Sendfile, and Logger middlewares, Carl and Yehuda’s rackup to Rack::Server conversion, multipart fixes, and a bunch of optimizations by Eric Wong.
Huge props to Josh Peek for putting his head down man'ing the patch queue on this one.
Tips for Ruby project maintainers on increasing the changes of getting your stuffs packaged for Debian. Most are just good sense. Use setup.rb, don’t explicitly require rubygems in your libraries and tests, use the most portable shebang (#!/usr/bin/env ruby), and provide a man page. Ron can help with that last one.
defunkt’s hub is a command line utility that adds GitHub knowledge to git. Sweet. It expands GitHub repository references so you can do stuff like: git clone defunkt/gist, git remote add bmizerany, etc.
Tobi’s log tail and grep app is precisely what I’ve wanted on every single syslog machine I’ve ever had to deal with. And the code has some great examples of using EventMachine features to do real async HTTP stuff.
I agree. I played with it for a couple days and now I can’t shut up about it. That’s basically all I talked about at RubyConf :)
I’ve released a bertrpc library for node.js. If you haven’t play with node yet, set aside a night and dig in. Hacking async server-side stuff in JavaScript is every bit as awesome as I’d hoped: easy to install, good docs, fast VM, clean and simple event idioms. I’m impressed.
Tim Pease’s unit test runner and reporter is sexy and has some really interesting features I’ve never considered when running unit tests. Here’s a piece of the README:
To use the solo runner.
turn --solo -Ilib test/
This will run all tests in the test/
directory in a separate process.
Likewise for the cross runner.
turn --cross -Ilib test/
This will run every pairing of tests
in a separate process.
Now that’s interesting. I’d love to have something like GNU Make’s -j option when running unit tests.
Jacob Kaplan-Moss:
It’s really tempting to use an auto-documentation tool like Javadoc or RDoc for reference material.
Don’t.
Auto-generated documentation is almost worthless. At best it’s a slightly improved version of simply browsing through the source, but most of the time it’s easier just to read the source than to navigate the bullshit that these autodoc tools produce. About the only thing auto-generated documentation is good for is filling printed pages when contracts dictate delivery of a certain number of pages of documentation. I feel a particularly deep form of rage every time I click on a “documentation” link and see auto-generated documentation.
Hate that shit.
You know what I want? Man pages. For everything. Wouldn’t it be cool if you didn’t have to write roff?
Really excited to see Chris release the shiny new Redis-based work queue that’s been running GitHub for the past couple of months:
It boils down to this: GitHub is a warzone. We are constantly overloaded and rely very, very heavily on our queue. If it’s backed up, we need to know why. We need to know if we can fix it. We need workers to not get stuck and we need to know when they are stuck. We need to see what the queue is doing. We need to see what jobs have failed. We need stats: how long are workers living, how many jobs are they processing, how many jobs have been processed total, how many errors have there been, are errors being repeated, did a deploy introduce a new one?
I’m still getting my feet wet with the jobs system but I can’t wait to get my hands dirty in the guts of this thing.
Need more rdebug?
I sometimes forget how useful a debugger is for coming up to speed on a new codebase. This bare-bones HOWTO on rdebug was everything I needed and nothing I didn’t.
Gemcutter will become rubygems.org and Rubyforge will eventually go away entirely:
So, what does this mean for RubyForge? The Ruby-specific functionality and data will be moved into RubyGems.org, and the parts that other hosting sites (GitHub, Google Code, SourceForge) can do better will be pruned away. Migration paths for those projects will be provided, we’re not throwing any switches without warning. RubyGems.org will not be gaining any “bloat” from rewritten RubyForge features.
Wow. Congrats to @qrush and the Rubyforge team for pulling this off so quickly. Also, it’s pretty cool to see Heroku hosting a major/official piece of Ruby community infrastructure.
Simon Willison on using Redis with the Python REPL to get complex shit done quick. Insightful piece, as always.
Redis’s SORT does a lot more than just sort stuff. Something clicked when I first saw this. I always wondered if/how more complex relational operations could be accomplished with key/value stores.
I usually don’t like these web based regular expression editors but this one’s just right. Best part is that you can create a permalink for regular expression + text combos.
Maintenance release that fixes a bunch of issues under Ruby 1.9, some multipart form problems, and various other minor bugs.
Nick Quaranto shows why you need to start thinking about bundler.
Brand new PeepCode screencast on Sinatra by Dan Benjamin. The production on this thing is really exceptional and they get into some meaty topics. Highly recommended.
Jeremy Zawodny takes a look at the * is Unix thing and throws in some additional goodness: more on fork(2), the benefits of copy-on-write, and atomic file operations.
GitHub documents the how and why behind their Unicorn setup. Also, for the record, the fork(2) + shared accept socket technique described in my Unicorn is Unix piece was first explained to me by Chris and Tom.
The CodeRack Rack middleware competition has begun. All entries get a $30 credit from Heroku and the top three pieces of middleware get special prizes (to be announced). You should submit something. I want to see it :)
Chuck presents the results of a few ab runs against Thin and Unicorn. Surprising, even if the benchmarks lack rigor. I’d like to see good autobench runs for all of the backends on same hardware/network.
This is how I am using Rack::Cache, Sinatra, and CouchDB … Sweet ascii diagram there. I’ve seen this ETag chaining technique twice just this week. The other one is gemcutter. They store gems in S3 and pass the S3 provided ETag along in their responses, so it’s like the web app is more of an intermediary sometimes. Weird and cool and interesting.
Dustin Sallings proofs out an implementation of the recently released Tornado web framework but builds on top of Twisted. The result is -1,297 fewer lines and all the benefits of having the Twisted framework underneath. I’ve been waiting for someone from the Ruby community to announce a port — we’re good at stealing. Using Dustin’s fork as a reference and basing a Ruby implementation on EventMachine might be the way to go.
Jacob Kaplan-Moss somehow pulls a bunch of interesting contemporary web development issues into a coherent essay. This bit on what happens when web apps begin to mature is especially well stated:
This is an impossible situation for framework developers: by optimizing for a quick start, by focusing on common needs, we’re essentially guaranteeing future failure. Remember the “Rails doesn’t scale” pseudo-controversy last year? I guarantee it’s only a matter of time until there’s an angry “Django FAIL” moment.
Frameworks ought to gracefully fade away as you replace them, bit by bit, with domain-specific code. (This is what I meant, above, that inter-op is also a scaling issue.) Right now, they don’t.
I wish more people would write about their experiences growing out of the general purpose web framework. It’s a totally natural thing but most people seem hesitant to talk about it because it’s interpreted as an attack on the framework or community.
Matt Todd and Mike Perham show off some nifty Ruby heredoc fu. It’s a gist, so fork it and add your own craziness.
Unicorn is a newish Rack-based HTTP server that’s kinda sorta like Mongrel but comes packed with some insane process management features. The main link is to the SIGNALS file, which documents the master/worker process model, supported signals, process replacement, failover, etc. See the README for a high level description of features.
This link brought to you by @defunkt, who explained Unicorn’s unique approach (repeatedly) over the course of a week.
Joe Damato and Aman Gupta show why and how Ruby (MRI)’s thread implementation sucks. Great presentation with lots of useful examples of using tools like strace and gdb to figure out where a process is spending time. Warning: you will be depressed and embarrassed after reading this if you currently target Ruby MRI.
John Barnette with a must read piece for anyone that’s ever written a Rakefile.
Kudos to everyone hacking on Rails 3. This is a great demonstration of how far they’ve come in making it possible to pull in only the bits you need, without gem hell and activesupport spewing all over everything. Also, if you have an opportunity to see Yehuda’s “shit that’s happening in Rails 3” presentation, take it.
Only requires that gdb be available on the box. No requiring libraries or listening on sockets to get the console. Rad.
Jonathan Dahl talks about minimalism and clarity in writing and how to use these principles in programming. Great talk. He uses a lot of analogy and audio/visual stuff at the beginning, which (in my experience) typically means that the presenter has no fucking idea what they’re talking about. Not here. Excellent, well-rounded talk.
I’ll admit, I’ve been holding out, hoping that _why’s disappearance was just a big misunderstanding. But at this point, I don’t think he could come back even if it were a big misunderstanding. Here’s a mirror (thanks mislav + GitHub Pages) of the Poignant Guide – the canonical reference for how to be. It’s our GOF; our SICP. I don’t think I’ve ever been so in awe of a piece of technical literature. Now it just makes me sad.
This seems to be a trend in Python and Ruby web circles. Frameworks present developers with a choice: accept these constraints, give up a little control, and I’ll make you more productive. Longer-lived apps start to evolve out of the framework at some point, though. You need more control over a piece here, or aren’t satisfied with the way something works there, and so you refactor and pull stuff out until the framework begins to slowly fade away. Maturity is a part of the web app development lifecycle we have precious little data on.
This comment nails it:
Maybe it worked out exactly like it should have. Django bootstrapped your app to a certain point. Got you further faster than you would have if you implemented everything from scratch. Then from there, you identified the things you considered inadequate and replaced them. If it all goes away who cares. You have learned something, shared it with us and moved on.
I think that’s just fine. Unexpected maybe, but fine.
Sequel has become my ORM of choice for Sinatra apps backed by a SQL database. This is a quick Sinatra extension I threw together to remove some of the boilerplate required to get a new app setup. It includes a simple single-file migrations framework and some other stuff. See the README for examples.
This is an interesting idea. Publishing gems on rubyforge is complicated but the gem source is everywhere and gems have sane file names. Publishing gems on github is dead simple but the filenames include a username prefix, which is just kind of weird. Publishing gems to gemcutter is simple enough and the gems have sane filenames. This could work.
Nice short list of PostgreSQL features everyone should be thinking about when choosing between MySQL and postgres (and each with a link to more detailed information). Then a wrap up that talks a bit about the licensing situation:
One of the major reasons for trying out PostgreSQL, regardless of it’s feature set, is it’s license and community. This can’t be more true these days, when MySQL AB was consumed by Sun Microsystems, which in turn recently got acquired by Oracle. While I doubt that the product itself may die off, the fact that the copyright to the code, and the direction of the database system itself may and will be dictated by a company like Oracle is a deal breaker for me.
I suppose it’s a bit on the FUD side but those are my feelings exactly.
Koz on Delayed::Job’s lesser-known send_later and handle_asynchronously methods. Sweeet.
Adam takes a look at how long requests and backlog interact. The sleep example runs concurrently under Mongrel but Thin and WEBrick will backlog.
“… learn how to use httperf load testing with sessions, how to automate our httperf testing using autobench, how to graph the results from autobench, and lastly we talk briefly about a few other load testing tools you might want to be aware of.”
This is the second time Gregg has beat me to a great screencast :)
There’s a nice combination of old and new concepts in here.
I want to believe!
Great talk from this year’s gogaruca conference. Anything that starts with a rail against the belief that tools can have mystical scaling powers is going to end up being a good talk :)
Amazing! I put Ben under the table that night. Tucked him into bed and gave him a kiss.
We’ve been getting a decent amount of PR-ish type coverage since the commercial launch but I still say blog posts like these are infinitely more interesting:
Remember when microwaves first hit the scene and people couldn’t believe how fast they could ‘deploy’ a meal? Yah me either, but the microwave changed the game big time.
And, unlike the microwave, Heroku doesn’t make your apps taste like cardboard :)
Here’s the slides from my RailsConf 2009 presentation on HTTP caching. I doubt the general info will make much sense without me talking over it but the diagrams should be fairly useful.
Coda on why Rack has had so much success within the Ruby community and modeling projects after it in the future. I couldn’t agree more.
Christian Neukirchen’s RailsConf 2009 wrap up. I had a pretty amazing time at the conference but sharing a Hookah with Chris was definitely a highlight.
Really interesting analogy between web architecture and a car crash. This is the piece that’s missing from almost every conversation about whether any given web framework or component “scales”. (via @jperkins)
“Almost all non-functional programmers are unaware that tail calls facilitate a programming paradigm that they have never seen. The ability to tail call to functions that are not statically known is the foundation that makes many combinators useful. This is a style of programming where functions are composed in order to create a pipeline for values to flow through. Without tail call elimination, every stage in the pipeline would leak stack space and the whole approach becomes unusably unreliable.”
Nice. Probably more appropriate than tmm1-amqp in threaded/synchronous environments or when you don’t want to deal with EM. Then again, I believe tmm1-amqp has a synchronous interface. If not, it wouldn’t be hard to put one together with fibers.
We made it.
I’ve been staring at this screen for two sleepless weeks now. Really glad to have it wrapped. James Lindenbaum (CEO/founder/bad-ass) did most of the conceptual design work. seaofclouds did the fucking amazing illustrations and took the design to completion. Pedro Belo did the HTML/JavaScript and server side stuff. Definitely one of the best teams I’ve worked on.
Remi’s kick ass screencast on deploying to Heroku.
I had a chance to hang out with Rabbit’s Tony Garnock-Jones last week. Awesome guy. Knows his shit. We use RabbitMQ prettyy all over the place at Heroku — big fans.
Matthias Georgi’s framework for building DAV servers in Ruby with Rack. Could make building apps that mount into a local filesystem quite simple.
Great ideas for tweaking Ruby’s GC after applying Stefan’s Kaes’s GC patch. By the way, that patch has been an option on the ruby port in FreeBSD for years. It works. Apply it.
This is why simple is better. Sinatra probably runs well on any compatible ruby with a Rack handler.
Get it while it’s hot.
Well said. It appears PHP’s culture of stupidity isn’t limited to technology. What a bunch of assholes.
It’s important to understand how fork(2), pipe(2), and exec(2) work. I don’t want to hear anymore of this “fork is a hack” shit from any of you :)
Nice. This is very similar to the Sinatra::Test module but with a few additional features (i.e., the session/cookiejar thingy). If this gets traction (and it will), we’ll deprecate Sinatra::Test and recommend people use Rack::Test instead.
I worked on this a bit. Jazzed to see it announced. Actually, they pretty much had everything working when I got there. I wrote some docs and tightened things up a bit is all.
Now go deploy something – it’s free!
Things are starting to get interesting around here. James pulled together some (fucking sexy) high level architectural diagrams and annotated them just so. We can start talking about what we’re up to a bit more now that this is out. I’m jazzed.
Harry Vangberg put together a Twitter relay bot in #sinatra (nick: nancie) so a bunch of the cool cats there are keeping the @sinatra twitter feed lit up with a stream links, tips, and announcements.
I haven’t actually had a chance to watch this yet but I’m sure it’s great if it builds on the talk Gregg gave at acts_as_conference 2009. Also, I love this slide: “Reverse Proxy Caches – WTF?” :)
The RailsEnvy guys presented on a bunch of recent innovations in the Ruby/Rails community in their acts_as_conference 2009 talk. Go to 24:00 where Gregg gives a really tremendous overview of using Rack::Cache, the benefits of HTTP caching in general, and how to use all of this stuff in Rails 2.3.
Huge thanks to christian for getting this up. I’ve been meaning to get something on the Rack::Cache site for some time now.
This has been sitting in the back of my brain for months now. I finally got a chance to throw something together last night:
Shotgun is an automatic reloading version of the rackup command that’s shipped with Rack. It can be used as an alternative to the complex reloading logic provided by web frameworks or in environments that don’t support application reloading.
The shotgun command starts one of Rack’s supported servers (e.g., mongrel, thin, webrick) and listens for requests but does not load any part of the actual application. Each time a request is received, it forks, loads the application in the child process, processes the request, and exits the child process. The result is clean, application-wide reloading of all source files and templates on each request.
Another interesting use of Rack middleware.
Geoffrey Grosenbach interviewed me yesterday for the Ruby on Rails podcast. We had a nice chat about Python/WSGI, Rack, Sinatra, Rack::Cache, Heroku, and other random stuff.
I started full time with Heroku last Wednesday. This is why.
Aman Gupta and Joe Damato have implemented Fibers for the 1.8.6 and 1.8.7 MRIs. They’re patches now but will hopefully go into a 1.8.8 release. I had a chance to see these guys give a quick talk on their work at a local Ruby meetup — it was a hit.
This is one the amazing benefits of having an insanely simple but well defined SPEC (Rack) around the edges of your library. It makes it trivial to hook things up in new and interesting ways.
“This module allows Ruby programs to access their OS’s native sendfile(2) system call from any IO object. Your kernel must export a recognized signature for the sendfile(2) system call to use this module. Currently, that includes Linux, Solaris and FreeBSD.”
“Not to mention ‘overrideable’ is not a real word.”
Pat Nakajima’s script to measure the amount bloat you’re adding by requiring libraries. Generates a report on the number of methods added, along with a list of names. Interesting metric.
Ruby 1.9.1 is out. Here’s the final rev of the NEWS file. Nice, condensed list of everything that’s new or changed.
Christian Neukirchen’s utility for managing multiple virtual ruby installations.
We gave the Sinatra website a major face lift. Check it out. Don’t leave without subscribing to the feed.
The Prag’s have published two screencasts in a new series on Sinatra.
Ruby based continuous integration server that rocks. Built on Sinatra and DataMapper. Painless setup, beautiful web UI, hooks up to GitHub. I wish I’d went and looked at this earlier.
Magnus Holm disects a couple of implementations for parsing nested form parameters (e.g., “person[name]=Joe&person[zip]=55555”) in Ruby. _why’s is the most interesting (as always). We just added this to Sinatra and I’m fairly confident we’ll see something like it land in Rack before 1.0.
Tanner Burson talks about one of the larger accomplishments of the Sinatra 0.9.0 release. We definitely need more docs on using Sinatra in this fashion.
I put a lot of work into this release. Really happy to see it out :)
Quick presentation on Rack by Dan Webb. Covers a lot in eight minutes.
Matt Todd did a nice presentation on Rack to the Atlanta Ruby Group (ATLRUG) and they were nice enough to put video of the slides + audio of Matt’s narration online.
Adam Wiggins: “gemweight.rb is a script to calculate the memory use and load time of a given gem.”
I’ve run numbers (very adhoc) on various gems before and I’m always surprised at the results. Libraries you’d think would be small are sometimes big and libraries you’d think would be big are almost always big :)
I’ve annotated RFC 2616 Section 13 with details on where Rack::Cache is and isn’t compliant. Anything not highlighted should work as described in the RFC. I think I’ll be using SharedCopy more in the future.
Markus Prinz with a nice review of important Ruby 1.9 changes.
Finally, a sane looking sanitization lib that doesn’t try to do too much.
Interesting looking HTTP client library for Ruby with support for HTTP caching (with pluggable backends), basic and digest auth, intelligent redirect handling. It’s been around for a while and looks like it could eventually become similar in feature set to Python’s httplib2.
A much more sober but constructive take on the plan to merge Rails and Merb.
Christian Neukirchen’s Ruby styleguide. The best I’ve seen.
Mailing list for Rack::Cache users and hackers. Come on in, the water’s warm.
“Built with Rack Middleware ONLY (Rails 4.0)”
Jon Crosby’s RESTful JSON-based data store with OpenID and OAuth support. It does versioning and produces HTTP cache friendly responses all in a Rack middleware component. Jon’s been working on this for some time and it shows in the code and docs. Awesome.
Peter Cooper: “Lots of awesome articles about Sinatra, Sinatra apps, and various links and resources have cropped up over the past few months. The remainder of this post links to the best we’ve found – most of which you should find useful as you start to explore Sinatra in detail.”
David Heinemeier Hansson: “Rails Edge adopted Rack a while back and we’ve been exploring ways to expose that better. The first thing we did was to make it really easy to hook up any piece of Rack middleware in front of a Rails request. In your config/environment.rb file, you can do: config.middlewares.use(Rack::Cache, :verbose => true)”
Oh hell yes.
Rails riding on Rack is going to be a big deal.
It’s really starting to come together, isn’t it?
Bad-ass ActiveRecord extension that does read-through and write-through caching to memcached in a way that’s fairly transparent. This is one of the strategies the Twitter folks put in place recently to improve their response time and availability.
Rafe Colburn: “On the other hand, I find programming in Ruby enjoyable and educational, so it’s not like I’m looking to give up. It’s just that even after a couple of years of doing it, I still feel like we’re dating rather than married.”
It seems like a lot of people are down on Ruby at the moment. Odd. I’m actually more excited about Ruby than I’ve ever been. Things seem to be moving along nicely, especially on the web tooling front.
Adam Wiggins and Blake Mizerany’s presentation on Sinatra and RestClient.
Nicely done. I have to take a serious look at iUI one of these days. It sounds like you can get really close to a native app experience.
Pratik continues his series on Rack with a deep dive into Rack::Builder.
Pratik’s first in a series of pieces on Rack: how it came to be, why you need to understand it, along with some simple examples. Future installments will cover Rack::Builder and Middleware.
Sebastien Auvray covers Rack::Cache at InfoQ. Thanks!
You’ve got to be kidding me.
Interesting approach to setting cache related headers using a Rack middleware component.
An interesting RubyGems mod by Fabien Franzen that seems to fix the memory hit a process takes on require 'rubygems'. Unfortunately, you have to code for it in your app and apply it to installed ruby commands explicitly. Fabien has submitted a ticket and patch to the RubyGems project, however. You should +1 it (after reviewing the code, of course).
Ryan King nails it.
Pretty good introduction to building pieces of Rack middleware and using Rack::Builder.
Much nicer, IMO. I’m interested to see if someone can get Rails + Rack::Cache working together so that you can maximize the benefits of generating these validators.
Interesting Rails plugin from Viget Labs that adds ActiveRecord attribute helpers for various humane markup languages. The markdown variation supports both rdiscount and rpegmarkdown. Cool. Not sure how I missed it when it was released in August.
So I’ve been skeptical about Merb but I really like the world-view Ezra puts forth here: core framework code should be simple (no/little meta-programming), fast is good, Rack is awesome, etc.
Tom Preston-Werner on how GitHub came into being and leaving Powerset after the Microsoft acquisition: “When I’m old and dying, I plan to look back on my life and say ‘wow, that was an adventure,’ not ‘wow, I sure felt safe.’”
Same here. I’m still looking for techniques that would make my Ruby libs and apps as simple to follow, debug, and maintain as equivalent Python versions are naturally. Ruby’s module system and cowboy shit (instance_eval, modifying Object, Class, Module, etc.) can go to hell. Python + blocks + class scope + large community and I’m sold.
Ola Bini: “Using instance_eval changes the rules for the language in a way that is not obvious when reading a block. You need to think an extra step to figure out exactly why a method call that you can lexically see around the block can actually not be called from inside of the block.”
Having abused instance_eval in the past, I can say with absolute clarity that it’s usually The Wrong Thing. It can make DSLish code look really cool in controlled and scoped demos but it greatly increases cognitive complexity, making things hard to read and maintain.
Bill Burcham applies the technique of making form controls inherit style from their container in the Air Budd Form Builder Rails plugin. Cool.
… is a Ruby library suitable for use as a drop-in Net::HTTP replacement or with event frameworks like EventMachine and Rev.
Aristotle Pagaltzis on eating PHP’s lunch: “It will have to be more than just a programming language, because PHP itself is really more than a programming language. It includes a crude web framework (an invocation model reminiscent of CGI, with extensions) plus a crude deployment solution (just make all the libraries part of the language and let the sysadmin worry about it – who in turn often defers to his operating system vendor). This is PHP’s way of taking the worse-is-better philosophy to dazzling new depths …”
I was having this conversation at work the other day and came away with the conclusion that even if something were to reach feature / ease of use parity with PHP today, it would be many years before it actually surpassed the language in real deployments. PHP is everywhere.
Dump the stack trace of all threads in a running ruby process by signaling with -QUIT. Requires patching the ruby interpreter, which sucks because I need it for a process running right now.
Yep. Rubygems’s system of security is really very lax compared to any Linux distro or other system-level package management system I’ve come across. I think the bigger problem, though, is that there’s a cultural acceptance to running gem as root. You don’t really think before installing a gem, you just “sudo gem install FOO”. There’s an attack waiting to happen any time you’re using sudo out of convention like that.
Chris Wanstrath: “Side projects are less masturbatory than reading RSS, often more useful than MobileMe, more educational than the comments on Reddit, and usually more fun than listening to keynotes.”
I just totally love this kid. Chris explains the future and past of, uh, everything that matters, and gives good, solid, practical reasons for why contributing to free and open source software projects is something worth dedicating a large chunk of your time to.
Adam Wiggins on Sinatra’s blasphemous approach to controllers and routing. AKA: the thing that makes Sinatra my web layer of choice (well, that and throw :halt).
Still too much work but it’s nice to see some support for conditional GET making its way into the framework.
Christian Neukirchen announces Bacon, a ground up reimplementation of test/spec + test/unit. (EDIT: this is not test/spec as I had previously reported. Sorry.)
Awesome idea. Nice syntax highlighting. (Via Simon Willison)
Not sure how I’ve never stumbled on this before. You can remove items from the list to cause require to reload a file.
“Jim Meyer, manager of LED says that Rails scales like any other web application: ‘That is to say you need to take into account all the components from the moment the request is received at the load balancer all the way down and all the way back again.’”
Agreed. I’ve been a lurker for going on a year now. Solid mailing list.
An initial version of RDiscount’s API docs just published on rubyforge…
Good idea. Solve the “concurrency problem” for dynamic/scripting languages and the “language syntax problem” for Erlang, without sacrificing the benefits of either. Someone needs to keep an eye on this.
There’s way more new stuff in here than I thought. 20%-30% of ActiveSupport’s core extensions, Enumerator support everywhere, Object#instance_exec, byte vs. char stuff, documentation, and more…
If you move the slides quickly, it feels a bit like playing Desktop Tower Defense.
“… the fact that [Twitter has] a nifty error page is a bonus really.”
cschneid has been helping me get the collection of hacks I’ve come to call a weblog into shape for some kind of release. He’s also been writing a lot of great Sinatra tips and tricks here. Check it out.
This is the template used to generate the HAML RDoc. It’s a massive improvement over the default template shipped with rdoc. I can almost stomach rdoc with this — almost.
Support for HTML4/HTML5 output, more control over whitespace, option for implicit HTML encoding, and now faster than ERB.
Ola Bini on def vs. define_method vs. eval for defining methods in Ruby. There really ought to be a simple way of getting stuff like this from blogs and into the standard Ruby doc.
“I still haven’t found anyone who knows how you implement Scaling in a language, so I guess that LRM will never have it… Anyone who care to enlighten me, please send me a detailed email with an implementation of Scaling.”
A gem for your project is automatically built each time the project_name.gemspec file is changed on your master branch.
I think I may finally be able to get rid of Colloquy.
Matt Chisholm evaluates Ruby against Python for an upcoming project and determines that it’s a big pile of doodoo. I can’t agree with the conclusion but he details a lot of Ruby’s warts really quite well.
This was a really great lesscode.org piece by Aristotle. The follow-up discussion in the comments was superb as well. Being in the middle of everything really warped my view of what was going on back then, I think.
David Heinemeier Hansson: “PHP scales down like no other package for the web and it deserves more credit for tackling that scope.”
Agreed!
Patch accepted!
Yukihiro (Matz) Matsumoto, David Flanagan, _why the lucky stiff, David A. Black, Charles Oliver Nutter, and Shyouhei Urabe: that’s what I call a writing team. Wow.
I repackaged mongrel_proctitle as a GemPlugin so that all mongrels on use it automatically. This is the first chance I’ve had to play with GitHub, too. Lovin' it.
Constantly updates the the process title ($0) with something like: “mongrel_rails [10010/2/358]: handling 127.0.0.1: HEAD /feed/calendar/global/91/6de4”. Let’s you monitor backends with ps and top.
Seriously interesting web based git browser and collaboration tool from the folks at Engine Yard. If anyone has a spare invite laying around, hook me up: rtomayko@gmail.com. I have a bunch of stuff sitting in bzr repos that I’d like to flip over to git.
A “Hello World” Rails webapp in fewer LOC than a Java console app that System.out.println(“Hello World”). The routes and controller DSLs look pretty interesting as well.
Nice Ruby assertion library that’s block based. Shows block contents when the assertion fails. Much cleaner than Test::Unit assertions and without the retarded RSpec non-sense. This really ought to be rolled into the stdlib Test::Unit, IMO.
“Cameltoe is a set of utility functions for making Ruby objects more like camel toes.” — You’ve piqued my interest :) It looks like this adds a String#cameltoeize method, amongst other things…
Evan Weaver: “These leaks tend to grow slowly. Your Rails app definitely has this kind of leak, especially if it uses the ActiveRecord session store.”
Peter Cooper scratches the deployment problem itch.
Dion Almaer sits down with Yegge to talk about his JavaScript/Rails port. Nice one-on-one video, candid, and thick in technical detail.
Ian takes a look at some of the attributes of PHP’s deployment model, why they work so well (for PHP), and why other environments have such a hard time duplicating them.
“The constraints, the instability, and the unpredictability of a shared hosting environment are a big part of the reason why the web hosting business is moving towards virtualization everywhere you look. Big kids need their own sandboxes to play in.”
Like khtml2png but using the gtkmozembed Ruby extension library (which I haven’t been able to build yet).
“Ousted ActionWebService from Rails 2.0 ” :)
something to dig into during a 1 hour conference call or whatever …
Checks pre-Rails 2.0 apps for compatibility.
Brings ActiveRecord’s transactions toward sanity and adds savepoints. The methods added to Object must go! — transaction, commit!, and rollback! will clash with existing libraries. e.g., PDF::Writer and Transaction::Simple.
“Every time some Rails fanboy starts peddling their hype, the approved thing to do is to respond with Erlang.” – Brilliant idea! That will bring some real substance to the argument.
“I’m getting more and more convinced that for the people that don’t need the things Java infrastructure can give you, Rubinius is the most important project around, in Ruby-land. More than that, Rubinius is MRI done right.”
“What matters a lot more than choice of programming language is the ability to get the project done, meaning tested and correct and launched. Apparently for Derek, PHP is the way to get that done, and Rails ain’t.” — it really is that simple. Period.
“But at every step, it seemed our needs clashed with Rails’ preferences. (Like trying to turn a train into a boat. It’s do-able with a lot of glue. But it’s damn hard. And certainly makes you ask why you’re really doing this.)”
“Maybe I’ll start to believe when they start promoting Ruby on Rails at JavaOne, as opposed to promoting JRuby on Rails at RailsConf.”
Comprehensive look at common Rails security concerns with links out to in-depth articles.
“I’m not really much into evangelizing Ruby and Rails much nowadays. You know, since we won, I have to admit that it became boring and besides the point.” :)
“‘Why are they doing all this?’, that’s a common concern with most Ruby folks … A Sun that’s heavily involved with Rails on the software side is a Sun that’s much better positioned to sell loads of hardware …”
Do not try to measure APIs vs site traffic… that’s impossible. Instead, only try to realize the truth… There is no APIs.
“We’re not trying to bend Ruby on Rails to fit the enterprise, we’re encouraging enterprises to bend to Ruby on Rails,” he said. “Come if you like it, stay away if you don’t.”
Bill Burke is an idiot. Wow. And then, after being an idiot, he actually calls someone “gay” in the comments when they dare suggest that Ruby is a strongly typed language. Huh? I thought Red Hat had better taste.
Java becomes 100% more viable. So simple — why didn’t someone do this in the very beginning?
I must say, I’m a bit bummed that we’re having this conversation at all.
Rock on.
Nice. This is going to save me some serious time.
“The general thrust of this argument is that having a full-fledge rich-windowing experience in the browser is going to put a stop to all that amateurish mucking around with JavaScript and the DOM. … that’s hogwash.”
“And yes, I’ve seen the Microsoft news … If Sun did something like this I’d resign.”
Rake ChangeLog
I no longer think applet support should be dropped from all major browsers. I’ve got links for anyone who produces a Jython version.
Pppkkkeeeewwwww.. The happy universe explodes. This is turning into one hell of a discussion.
The entire Twitter Scaling Problems conversation in one place.
jackpot.
Wow. Pretty solid anti dynamic language advocacy piece. It’s been a while since I’ve written anything longish so maybe I’ll try to put together something of response to this.
I’ve been using this technique for some time with great success. Oh, and this site’s design is bordering on perfection.
subscribed
“This document explains how to make extension libraries for Ruby.”
“Well if Ruby developers are so damn productive, why can’t they write a faster ruby?”
These people are still around? Amazing. Ooohhh, “tens of thousands of simultaneous users” — scary! scary!
Matz’s ruby-postgres library has finally been forked.
“… the results for YARV/Rite are still streets ahead in terms of raw performance, and where I’m placing my bets for the next de facto Ruby interpreter.”
Wow.I shudder to even observe the brilliance that is _why. There’s an actual Cut-out Adventure Beard here.
Interesting concept. I’ll have to check this out once it comes out of “pre-pre-pre alpha” (which doesn’t really make sense, btw. There’s nothing more alpha than alpha).
That’s sales growth not sales.
“All you have to do is change the internal processing, add 200 more methods to the HTTP parser, serve Bittorrent over Ethernet, and have it save Korean orphans while eating a Mango in the back seat of an El Camino driven by twenty midget clowns.”
“I would rather take an easily modifiable, open platform that I can make do what I need in a specific environment.”
We won on my birthday :)
Sam with a very simple, step by step tutorial on using your site as an OpenID identity provider.
This looks promising: handles all of Markdown proper plus various extensions.
Ranks programmers by who they consider themselves superior to. Comedy.
Danny Coward Q/A on invokedynamic and “hot swapping” (method replacement). Pretty good piece until the end where we enter into some scary Java-static-typing-is-good-because-it-let’s-you-publish-APIs non-sense.
Wherein the author lists 8 reasons (maybe 3 of which are approaching objective or even valid) and also spells Adrian’s name wrong: “Adrian Zolovaty”. Ruby/Python flame-bait is exactly what we need.
This guy gets around…
I take back everything bad I’ve ever said about Java Applets ;)
The best attempt I’ve seen at splicing multiple API references together. This uses the external documentation but provides indexing and browsing features.
the best shit ever
I’m starting to “get it” now… Makes a ton of sense.
why on rebinding blocks to specific objects.. I had to do the same thing a little while ago. Using instance_method seemed like a hack but if it’s good enough for why, it’s good enough for me.
I’m going to have to jump all over this.
Decent looking ruby library that implements a fair bit of an Atom Publishing Protocol client.
Perdy..
Holy crap this is the coolest language book I’ve ever seen. No seriously, you have to flip through the chapters – there’s regular comic strips and other crazy non-sense.
I’m going to see about moving my weblog to this..
That’s because they don’t have shithead analyst speculation driving feature development…
HARDYFUCKINGHARHAR! Laugh it up you dumb shits. This might have been funny were Ruby and PHP not eating your lunch.
Here they come…
The line forms to the left people..
Author of “Better, Faster, Lighter Java” compares building MVC webapps in Java to building them in Rails. I wish I could say I was surprised at the results but I’m not…
Sorry, I can’t stop linking to this guy…
Well written line-of-though writeup on the decision process leading up to a language selection when the sky is blue and you’re building a new app. Hint: Python :)
A complete comparison..
An honest and objective comparison of Ruby and Python.