June 2006 Archives

AddThis Social Bookmark Button

In May, John Lam (behind Ruby CLR) put me in touch with the Visual Studio team at Microsoft. They were very concerned that the Ruby interpreter was being built on an obsolescent version of the Visual C++ compiler and were wondering what might be able to be done toward getting Ruby built with Visual Studio 2005. On June 26th, I had a conference call with the team and pointed out issues that I had experienced in the past and where I had stumbled currently. I posted a message (
[ruby-talk:199211]) immediately after seeking specific issues to deal with. So here I am, seeking even more than I’ve gotten already.

They asked for as much information as I can gather on this matter. If you have had problems trying to get Ruby or an extension compiled or running on Windows for any reason, but especially because of Microsoft runtime DLL differences, please provide me as much information as possible so that I can pass it on to the VS team at Microsoft.

I’ve already heard complaints about compile-time compiler options and general annoyance at incompatible ABIs between runtimes, and suggestions on how to reduce the dependency of an extension on any given Windows runtime. It doesn’t solve the fundamental issue of memory management (and general resource management) between an extension, Ruby, and the library that the extension is written for possibly being tied to three different runtimes.

For what it’s worth, I have Ruby itself compiled with VS 2005, although some of the extensions are not being built automatically, from what I can tell. That may be a build script problem. However, based on earlier reports of runtime version incompatibilities, it was looking like I was going to have to recompile a *lot* of code. The discussion today suggested that as long as function accesses are used and not variable accesses, things will be okay (e.g., GetError() in Windows, not errno). The problem, as I pointed out to them, is that *most* Unix developers only ever have to worry about a single C runtime being on their system and therefore don’t need to worry about errno being in a different runtime DLL. Ideally, they would be able to give us an external way of getting at the errno from a specific
runtime that may not be “our” runtime (e.g., the runtime with which we were linked).

So, I ask you: What other problems have people had and what can you provide me as evidence? Also, can I give them your name and email for direct contact? I will be headed to Europe soon and won’t be able to respond quickly.

[Update 2006.09.11: I am closing this entry’s comments as several spam attempts have been made. If you have issues to report, please report them on comp.lang.ruby and I’ll see them on ruby-talk.]

Curt Hibbs

AddThis Social Bookmark Button

I just finished reading through a thread on the ruby-talk mailing list that was titled Is a block converted to a Proc object before yield? and it reminded me of one of the non-technical reasons that I love the Ruby programming language: the community!

First of all, in how many language communities will you find the creator of the language personally answering questions like this? Its not unheard of, but its not common either. Sam, the poster of the question, responded with heartfelt appreciation:

    Yukihiro Matsumoto wrote:

    > |Is a block still converted to a Proc object implicitly?
    >
    > Not under the current implementation.
    >
    >                                                       matz.

    I'm pretty sure that this is a very official answer...:-)

    Matz, I want to take this opportunity to thank you for making me a happy
    programmer with Ruby.

    Sam

Secondly, the Ruby community has always been a friendly place, relatively free of rude behavior. It is pretty much populated by real people with a sense of cooperation and helpfulness. Sam’s thank you prompted another thank you followed by another reply by Matz that earned my odd looks from my coworkers when I started laughing out loud:

	DEBAUN, STEVE  Thu, Jun 29, 2006 at 1:28 PM  

	Can I second that motion?!?!?

	I was a programming burn-out.  I was broken by a lifetime of shitty projects
	and shitty languages.  One too many for-loops had left me a hollow shell of
	a man.  I was ready to quit 'the biz' entirely.  I yearned for a job that
	involved things that did not require debugging.  Like... tiles.  Aren't
	tiles nice?  Wouldn't it be fun to run a tile business?

	Then I discovered ruby.  Clouds parted, rays of light streaming down, the
	host of heaven singing their angelic choirs.

	Now, once again, I love what I do.

	Thanks Matz!!!11!!!111oneone!11one1  That is one man I will definitely buy a
	beer for.

	Sd

	Yukihiro Matsumoto  Fri, Jun 30, 2006 at 7:21 AM  

	Tiles are nice.  My father used to sell tiles before his retirement.
	I am not sure if it's fun though.

	                                         matz.

Over the years we’ve had a few challenges to the keep-it-civil meme that permeates the Ruby culture. But the community’s response has usually been to just ignore the flame-monger, who eventually gets bored from the lack of response and simply goes away.

We all know that technical excellence alone does not make for success, but when you combine that with our killer community, it almost seems inevitable!

AddThis Social Bookmark Button

If you’ve ever used a Ruby extension built in C, most likely you’ve been exposed to mkmf. You may not have realized it, but those nitfy extconf.rb files floating around in directories that magically create Makefiles use it.

The Pickaxe briefly discusses mkmf and the online documentation on how to use it is, well, pretty much non-existant.

So I’m pleased to announce that the gluttonous Kevin Clark has released his first draft of mkrf, the mkmf replacement. Now we have a documented, clean and pretty, Rakefile generator for Ruby extensions.

Thanks to Google for sponsoring this as a SOC project. If you have ever played with Ruby extensions, you should definitely check it out.

Curt Hibbs

AddThis Social Bookmark Button

I’ve been reading the post RailsConf chatter. Its uniformaly enthusiastic.

_why provided a link to some Rails-themed t-shirts that are hilarious that you just have to check it out.

A lot of people took pictures at RailsConf and posted them to Flickr here. But, if you want to see the best ones (professional quality), look at the ones that Dave Thomas took. If you saw his camera you’d know why they came out so good.

Curt Hibbs

AddThis Social Bookmark Button

There was a power failure in the middle of the night that reset my alarm clock. Consequently, I missed the first two sessions of the day.

I finally made it downstairs just in time to catch Stuart Halloway’s talk titled MetaRails, which was about the metaprogramming features of Ruby and how they are used in Rails. Metaprogramming is a special interest of mine, so I was particularly interested to see how Stuart would present this topic.

I wasn’t disappointed. This was one of the clearest introductions to Ruby’s metaprogramming features that I have seen. The best part was seeing the practical application of these techniques in the section he titled “How’d they do that?” Here he showed how Rails does things like automatically create object attributes from database columns, and how variables created in the controller magically become available in the view templates.

Ruby makes all of this possible because the Ruby runtime system is completely introspectable and modifiable. This ability is lacking in almost every other programming language, save Smalltalk. This fact led Stuart to say one of my favorite quotes from the conference: “The notion that you’d never want production systems to be introspectable has to be one of the worst premature optimizations of all time!”

Next up, James Duncan Davidson talked about Deploying Ruby Applications. He explicitly called out one of Rails’ dirty little secrets: while Rails will get you started and help keep you going at lightning speed, production deployment can be a bitch.

Duncan went through a number of deployment tricks and deployment debugging techniques, and then he covered a number of things to watch out for. Of most interest to me was that he advocated abandoning the current deployment protocols (primarily FastCGI) in favor for proxying directly through HTTP.

Until recently this wasn’t feasible since the only HTTP server capable of serving a Rails app, WEBrick, is way to slow for production use. But Duncan highlighted the fact that Ruby’s new Mongrel web server changes all that. Mongrel is a wicked fast, native Ruby web server that can directly serve a Rails app (kudos to Zed Shaw for creating Mongrel).

Finally, I have to mention one little off-hand comment that Duncan made. He said that Ant was a hack that he wrote one day on an airplane, and that he still gets emailed questions about it daily, even though he hasn’t used Ant himself for three years.

The last thing on the conference schedule was a Q&A session with the core Rails team. I have to admit that I barely have any notes on this part, mostly because there wasn’t much asked or said that was new.

There were two things that I noted. First, the part of Rails that they are the most unhappy with are fixtures (about half of the core Rails team said they don’t even use them). And second, DHH reiterated what JDD said about Mongrel, saying that we have ignored the deployment problem for too long and that he is very excited about Mongrel.

All during this Q&A, I had been sitting in the very back (I usually sit up front) talking with Zed Shaw and Daniel Berger about the One-Click Ruby Installer, Mongrel, and Dan’s Win32 extensions (plotting our collaboration strategy). When it was over I wanted to say hi to Sam Stephenson (author of Prototype and Rails core team member), so as the conference ended I fought my way up to the front against the flowing tide of exiting attendees, but by the time I made it up front he was gone. So, if you’re reading this Sam… “hi”!

Curt Hibbs

AddThis Social Bookmark Button

As if I wasn’t already jazzed enough, Day 2 finished with a surprising keynote address from David Heinemeier Hansson. But I’m just teasing you, you’ll have to read down to the end to find out what it was.

Rick Bradley and Charles Johnson talked about their large “enterprise” healthcare application that began its life in Java that was abandoned midstream and rewritten in Rails. The Java version the app (Struts, JSP, Hibernate, and EJB3) was never completed, but at the time its development was abandoned, it totaled about 250k likes of code. The Rails version reduced that code size by 25x (around 11k lines of code). Rick has blogged about it here.

I’ve used this photo in my own presentations, but I didn’t realize it cam from Rick’s project:

Glenn Vanderburg gave a very interesting talk about Testing Migrations. Testing changes to your database schema is hard, and usually not done at all. Glenn showed the beginnings of a testing framework, but there are still lots of unresolved issues. Besides the practical value, this turns out to be in interesting intellectual problem in its own right. How do you use a running system to test changes to itself?

In Mike Clark’s talk, Testing Rails Applications, he asks the question, “Testing: what’s in it for me?” Mike says that the traditional “guilt” reasons, like higher quality code, don’t cut it for him. No, his reasons are more selfish. He feels that programming should be fun and that tests are, in part, his insurance that working on the app will stay fun.

Mike said he was originally drawn to Rails because it strongly encourages and supports testing (”Rails makes it easy to do the right thing”). He demonstrated the testing support built in to Rails, and said that while he does do TDD (Test Driven Development) he doesn’t do TFD (Test First Development). But, he thinks that Rails’ new integration tests may be the thing that changes his mind about TFD.

Nathaniel Talbot gave what he described as a continuation of his RubyConf 2005 talk on the long tail of software development. He used the metaphor of Homesteading to talk about taking risks to do the things that were are passionate about, scary things like starting your own business.

But, of course, the highlight of the day was the keynote address by David Heinemeier Hansson. He started off by reiterating the fact that Rails is opinionated software, a that a large part of its success stems from saying “no” to adding superfluous features and keeping the core of Rails true to its original vision. He sees no reason to change and start bending Rails to the desires of the outside world when we are having so much success bending the world to Rails!

But the bulk of his talk revolved around a simple, but profound theme–the idea that CRUD (Create, Read, Update, and Delete) should be the basic building block for models, actions, and APIs, and that when you find yourself needing to go beyond CRUD, that should be a red flag that something is wrong with the design. He slowly built up examples that promoted the message that sticking with the simplicity and consistency of CRUD yields some surprising and unexpected benefits.

This culminated in David’s presentation a new Rails feature that is a direct result of this new focus on CRUD, one that promises to supplant and surpass Action Web Services: Active Resource. David said he’d only been working on it for two days, but it will let us create, share, and consume resources over the web in a transparent manner that requires almost no extra work. Instances of an Active Resource object (once they have been connected to their remote resource) will look and behave just like an Active Record object.

I know I’ve done a terrible job of describing Active Resource, but keep your eyes open for this one… I predict that it will have a huge and profound impact.

Curt Hibbs

AddThis Social Bookmark Button

There is just so much going on at RailsConf 2006 that I can’t wait until the end of the day. I need to do a brain-dump now to make room the afternoon stuff!

First off, let me apologize for being a little too brief with yesterday’s post. I was running on one hour of sleep and I needed to get that post finished so I could get to bed. On the other hand, I really can’t do much more that whet your appetite without writing something way too long and figuring out how to be in three places at one time.

This is why you really should buy the audio recordings (synchronized with the slides) of the presentations. No one knows yet precisely what you need to do to order this, but Chad Fowler promised to post the information on the front page of the RailsConf website when its available. Also, for those of you who missed RailsConf 2006 because it was full, there is still RailsConf Europe which will be September 14-15 in London.

Before I start on today, I’d like to say a little bit about Martin Fowler and Paul Graham’s keynote talks last night. They were completely different from each other, but excellent and well worth listening to.

Martin Fowler talked about what he sees as important issues in software design and how Rails has become a catalyst and driver for moving the industry forward and out of the complacent doldrums that had been all to common in the Java world. As you may know, Martin Fowler was the originator of the Active Record pattern which is one of the core simplifications on which Rails is built. But in a stunning admission, Martin said that he had all but dismissed the Active Record pattern as not being interesting enough to be useful, and that no one was happier than he to be proven wrong by its use in Rails.

Paul Graham’s highly entertaining talk ostensibly had nothing to do with Rails… except that it did. It was titled “The Power of the Marginal” and explored the concept of insiders vs. outsiders and the advantages being outside on the margins. My notes for this talk are completely blank because it was so engrossing that I forgot to write anything down! Please do listen to the audio when it’s available.

The first timeslot for this morning had two talks that I really, really wanted to attend. Obie Fernandez’s talk was an experience report on ThoughtWork’s use of Rails for its client’s projects. I missed this one (thank goodness for the audio recordings), and Justin Gehtland’s talk was Ajax on Rails (hmmm… that title sounds familiar!).

I went to see Justin’s talk, and I’m glad I did because there was a hidden gem (no pun intended) at the very end of his excellent presentation on using Ajax in Rails applications. Justin and his partner, Stuart Halloway, have developed a Rails add-on that puts scaffolding on steroids. Unlike the built-in Rails scaffolding, it handles relationships between tables, makes full use of Ajax, and looks professional!

It’s called Streamlined, and the views that it generates are fully customizable. Instead of throw-away scaffolding that merely serves as a placeholder while you build out your application, Streamlined creates a fully functional application that you just need to tweak. They are going to open source this under the MIT license sometime in the next month.

I’m really blown away here, this is big–real big! You have to check this out:

http://streamlined.relevancellc.com/

Damn, I’m already running out of time. I need to hightail it to the next session.

Curt Hibbs

AddThis Social Bookmark Button

This has been an incredible day! It has also been a very long day, non-stop from 8am to 10pm. I’m really tired, but I want to post today’s happenings while they are still fresh in my mind.

The conference presentations are being recorded (audio only), and it will be possible to purchase the audio synchronized with the slides for $50. I think audio for the keynote addresses will be available for free. They keynotes have been excellent, so don’t miss out on listening to them.

Rich Kilmer kicked off the conference by welcoming everyone and noting that this was the “largest gathering of Ruby people in the history of the universe.” And it was incredible to see 550 Ruby/Rails enthusiasts gathered in one place. Dave Thomas simply said “Wow” and stated that he was “stunned” by the attendance.

Dave Thomas gave the morning keynote address, and started by showing how far Ruby and Rails have come it the last year by doing a Google search for “Ruby on Rails” and noted that this resulting in 21 million hits. Even more significant were the paid ads that appear on the right for Rails consulting, Rails hosting, etc. Dave also mentions that the of the No Fluff Just Stuff speakers (all Java experts), 65% of them now make their living using Ruby on Rails.

But the main thrust of Dave keynote was about taking Rails to the next level of adoption by removing the barriers prevent corporate developers from being able to use Rails. He specifically discussed three critical areas, in detail: data integration, real-world CRUD, and deployment. There was way too much information for me to post here, but please listen to the audio of Dave’s keynote.

After the keynote I told Dave that I thought the “real-world CRUD” part sounded an awful lot like Naked Objects on Rails. Dave said if I though that, I should be sure not to miss Justin Gehtland’s presentation tomorrow. Tomorrow I’ll let you know what that was all about.

After the keynote, there were three talks going on at the same time (for the rest of the day), and I can only attend one (even though I wish I could attend them all). I went to see Geoffry Grosenbach’s talk on deploying Rails applications in a shared host environment. He talked about some of the issues that you face in a shared host environment and showed off some Capistrano deployment scripts.

Next up, I attended my own talk on Instant Rails. I tried to skip out and go see someone else’s talk, but that didn’t work! :-)

I enjoyed the RadRails team (Marc Baumbach, Matt Kent, and Kyle Shank) as they explained why an IDE is important (answer: supporting integrated workflow components), and talked about where RadRails was and where it is going. There was a lot of audience interest.

Just before and after dinner, there were two more keynote addresses: one by Martin Fowler and another by Paul Graham. Both were excellent and well worth listening to.

Finally, _why the lucky stiff, Ruby’s resident madman (and his thirsty cups band) finished off the evening with performances that went past 10pm.

Curt Hibbs

AddThis Social Bookmark Button

It’s the day before the RailsConf 2006 (the first official International Rails Conference) begins, and things got off to a rocky start for me. From St. Louis, I can drive to Chicago in five hours, but with the high price of gas I decided to fly. Unfortunately, the weather caused flight delays which caused my total trip time by plane to be six hours!

Then, even though Amy Hoy had alerted us that the hotel’s wireless Internet access sucked, I discovered that was an understatement — it sucks, big time. I attempted to run an Internet bandwidth test, but it timed out after 15 minutes. The same bandwidth test using my cell phone as a modem completed in 2 minutes and showed an average of 13 kilobytes per second. Needless to say, I’m posting this through my cell phone.

From there, things could only get better… and they did!

This was the time to socialize. The seating area next to the hotel lobby had already filled up with RailsConf attendees, easily spotted because you look out over a veritable sea of laptops. There I met many people that I know in the Ruby/Rails world, including two people from my local St. Louis Ruby Users Group and John Long, who has single handedly written the Rails based software that will run the new ruby-lang.org site when it is launched. Chad Fowler (of “Rails Recipes” and Ruby Central fame) was nearly unrecognizable (we’re going to start calling him “mountain man”, now).

Finally, I headed down to the ThoughtWorks VIP Reception for RailsConf speakers. Wow… what a crowd! It was a veritable who’s who of the Ruby/Rails world. I embarrassed myself by sitting down and talking with Duncan for about 10 minutes before I realized it was James Duncan Davidson (Tomcat, Ant, Servlet API), the guy whose quote about Rails is highlighted prominently in all my presentations (along with his picture, no less)!

I also got to meet Shugo Medea who flew all the way here from Japan. Shugo is the webmaster for the ruby-lang.org site and has been the main person we’ve been working with to get the new ruby-lang.org site operational.

From Rich Kilmer I learned about an potentially killer VM for Ruby (not YARV) that could happen sometime this year. Stuart Halloway gave me a big compliment for Instant Rails, David Heinemeier Hansson told me he’s turned down over 30 requests to speak at conferences (that could be a fulltime job!), Justin Gehtland was his usual grinning self, Dave Thomas said something to me but it was so noisy I have no idea what it was, and Obie Fernandez (from ThoughtWorks) gave me some interesting stats on Rails in an enterprise setting. There were so many others I can’t even remember anymore.

I’m so jazzed now I can’t wait for the conference to start tomorrow. I’ll make a post at the end of each day to summarize what happened.

Geoffrey Grosenbach

AddThis Social Bookmark Button

I try to expand my knowledge of Ruby by reading code from other developers I admire. In the past few weeks, that has meant reading the meager source of Camping, Why the Lucky Stiff’s tiny website framework.

It also helped to learn by writing a test framework for Camping. It works pretty well so far and has taught me a lot about Ruby, testing, and Camping. I hope to package it as a gem in the next few weeks.

Last night at the Seattle.rb, Evan Webb answered a few questions about the finer points of Ruby and metaprogramming. (Note: This is not a Camping tutorial.)

pat eyler

AddThis Social Bookmark Button

I’ve admired James Gray for quite a while now and finally sat down to interview him by email. Most of us know him from the weekly RubyQuiz and the Pragmatic Programmers ‘Best of RubyQuiz’ book, but he’s made a lot more contributions to the Ruby community than just those. James always seems to have an answer to questions on ruby-talk (even the simplest), and his blog is a great read if you want to learn more about Ruby. Read on to learn a bit more about James and his place in the Ruby world.

Gregory Brown

AddThis Social Bookmark Button

So, I recently added Agile Web Development with Rails, Second Edition to my wish list. I have to admit though, I almost pulled it right off when I saw the new cover art. I mean, I suppose the rock-star coder marketing has been instrumental in fueling the hype wild success of Rails, but now, I think the line has been crossed.

Of course, I say this partly in jest but I really do think that the framework has always been able to stand on it’s own merits without having to typecast itself as being the ‘cool’ choice for ‘hip’ programmers.

On a tangental note, I met a guy last night at a friends house who thought Ruby consisted entirely of Rails views. He said, “I don’t really like tag based languages”. Sigh.

Note: If you are about to leave a comment saying. But it’s a grind rail! Don’t. Many people already have and I was aware of this when I first posted this.

Gregory Brown

AddThis Social Bookmark Button

So, I’ve been training a new employee who has some academic programming experience but no Ruby experience. I decided to revitalize my NubyGems series because now instead of trying to remember what I tripped over almost two years ago, I have active conversations with someone new to the language to work from.

I am going to try to post them unabridged, but try to keep them short and really simple. Whenever my friend asks an interesting question, you’ll see my explanations along with some IRB examples.

People with less than 3 months of Ruby experience, please give me feedback on these as to whether they are helpful. I promise to clarify things in articles or expound a bit more if things are hard to understand.

But for now, the NubyGems experiment continues!


(01:58:52) Dinko: I keep seeing the %w what's that do
(01:59:18) Me: have you installed irb yet?
(01:59:31) Me: >> %w[a b c]
=> ["a", "b", "c"]
(01:59:36) Me: it's just a shortcut
(02:00:33) Me: says, what follows is an array of strings seperated by spaces
(02:01:17) Me: for clarity, note that any symbolic delimiter can be used
(02:01:20) Me: >> %w(a b c)
=> ["a", "b", "c"]
>> %w$a b c$
=> ["a", "b", "c"]
>> %w~a b c~
=> ["a", "b", "c"]
(02:01:35) Me: [] is most common because it's semantically meaningful
(02:01:39) Me: reminds you of arrays
(02:01:50) Me: but () is common because some other languages do it that way
(02:02:28) Me: note also the flexibility that affords
(02:02:30) Me: >> %w~a [ c~
=> ["a", "[", "c"]

Hopefully this little discussion helps shed light on what %w is useful for

Now, you see these all over the place, but one thing I find myself using them over and over for is dynamic requires. I get sick of typing stuff like:

require "foo"
require "bar"
require "baz"

So a lot of times, you’ll see me write stuff like:

%w[ foo bar baz ].each { |lib| require lib }

Now that might make me just a tad bit lazy, but I think that looks pretty! :)

Gregory Brown

AddThis Social Bookmark Button

Well, I just started using a very cool (albiet non ruby) wiki/blogging service called Infogami. The not so cool thing about it is that as far as I could tell, it only had Atom feeds. Since some of the syndication stuff I use is only compatible with RSS, this was almost a show stopper. Until I found out about FeedTools, of course.

The script below is now tied to a cronjob which runs every 20 minutes converting my atom feeds into rss feeds and mirroring them on my own host.

#!/usr/bin/env ruby
%w[rubygems feed_tools fileutils date].each { |l| require l }
URL = 'http://ruport.infogami.com/blog/atom.xml'
File.open("index.rss","w") do |f|
  f.puts FeedTools::Feed.open(URL).build_xml("rss")
end
`scp ~/index.rss deleted@stonecode.org:~/reporting.stonecode.org/blog/`
FileUtils.rm('index.rss')
puts "feed synced at #{Time.now}"

Just another example about how Ruby makes life easier all over the place :)

AddThis Social Bookmark Button

Over the last month and a half I have been hearing a number of things regarding the treatment given to one speaker in particular of the Canada on Rails conference, and would really like to offer the community some truth to what you may have or have not yet heard. I had originally hoped those who heard the rumors would be able to see through them, or at least query me to shed some light before making any assumptions, or even wiser, dismiss them as just that, a rumor.

In any event, I am going to attempt to bring some clarity, and filter through some of the confusion one man has generated.