February 2006 Archives

Steve Mallett

AddThis Social Bookmark Button

I prefer to focus on Ruby here vs. Rails as I think Rails is but the first of super applications to spring from Ruby’s womb, but here’s some cool Rails stuff that caught my eye just this morning:

- What will be new in Rails 1.1 by Scott Raymond

- Juan Lupión’s Spanish translation of our Rails tutorials: Rolling with Ruby on Rails - Rolling with Ruby on Rails Part 2

- Apple has published a tutorial about Rails on OS X & builds a sample application

AddThis Social Bookmark Button

James Edward Gray II recently announced the release of FasterCSV, which is a replacement library to Ruby’s CSV (that’s “comma separated values”).

The project aims to be faster and smaller than the original, with a better interface.

So far, it’s looks great. It is noticeably faster. The interface is a little different, though arguably a little more thought out.

If you do any parsing of CSV data, I highly recommend you give it a look.

pat eyler

AddThis Social Bookmark Button

There have been several threads on comp.lang.ruby about Ruby’s suitability as a teaching language (most recently here), with people lining up on both sides of the discussion. I think I may have found a significant point in favor of using Ruby in a school setting.

While I was off looking at Computer Science materials different schools have put up on the web, I discovered that Ruby is being used in courses at Harvard. Their CS50 (introduction to computer Science) says:

To address [our] goals, we will attack interesting problems with the C programming language and the Ruby scripting language. These problems include algorithms for searching, sorting, and other useful, everyday tasks. To better understand these solutions, we cover techniques for the analysis of such algorithms and devices for structuring data and other interesting content, as well as the organization and security of computer systems and networks.

Sure, I’d like to see them lose the ’scripting language’ monicker, but they are using the language. Anyone else know of a school using Ruby in their curriculum?

pat eyler

AddThis Social Bookmark Button

Justin Clarke writes about Oedipus a web server security analysis tool written in Ruby.

Oedipus takes a multi-phased approach. First, it does a logfile analysis looking for potential vulnerabilities creating a specially formatted oedipus output file. Second it process the oedipus file, using security plugins to identify a variety of security problems. Third, Oedipus creates an html report for the tester. Fourth, it provides a mechanism for running additional tools based on the results of the security scan (note thought, that these tools haven’t been written yet).

While Oedipus is listed as being alpha (and is in fairly early development) it looks like it’s maturing quickly. Thanks, Justin, for pointing it out.

pat eyler

AddThis Social Bookmark Button

For the first time ever, a Ruby team will take part in the Development Tools contest (formerly the RAD race) on the 23rd and 24th of February. Development Tools is a contest in which the competing teams race to develop an application as quickly as they can. Started in 1991, and organized by Software Release magazine, the Development Tools contest has grown into a showcase where development tools are evaluated.

Finalist IT, primarily a Java shop, has been working with Ruby on Rails enough that they’ve decided to field a Ruby team at Development Tools 2006. They believe that they can compete and win against the rest of the field (which includes a Java team also being fielded by Finalist).

The results of the contest will be announced on March 29th, 2006. Then, in April, Finalist IT will present a review of the experiences of their two teams. It will be interesting to see how things turn out. For more information, you can see Finalist’s web page about the event.

So, where will you be riding the rails today?

Steve Mallett

AddThis Social Bookmark Button

My heart goes pitter patter…. Ezra Zygmuntowicz has begun working on Rubuntu. That’s right. An Ubuntu with Ruby and Rails leanings:

I already have all the basics included as far as ruby/gems and a bunch of database bindings and ruby configured mongrel, apache and lighty. And I already have plenty of usefull ruby libs installed. What I really need is the icing on the cake. I want thsi to come setup with all the trimmings. So all you folks with killer vimrc’s and emacs ruby configs please contact me.

Any little creature comforts you like or nice customization you rely on to get through you ruby work on linux would be much appreciated.

Might I suggest Ruby > 1.8.3? I’m running Ubuntu Breezy & had to compile Ruby as apt-get rudely insisted on 1.8.3. Oh, for shame!

pat eyler

AddThis Social Bookmark Button

Ruby Brigades are one of the best things to happen to Ruby; they move Ruby into local communities in a way that nothing else can, they create a comraderie and focus for local Rubyists, and they provide an easy on-ramp for people who are just starting to explore Ruby. Perhaps the best part about Ruby Brigades is that, unlike books and tutorials, we can all get involved in making them happen in our own back yards — not only can we, but we should. Let me tell you why.

AddThis Social Bookmark Button

I’m up in Chicago for some Rails training and I’m learning some new things left and right. It’s nice to get together with other people and see what they’re doing - even if you already know some of the basics.

One ‘trick’ I learned yesterday that made me so mad I didn’t know a YEAR ago was using the gem_server (you have to have rubygems installed, but you already knew that…right?) to run a local webserver on port 8808. Browse to http://localhost:8808 and see your API docs for your installed rubygems.

Note that if some of your gems don’t have rdocs installed, you can nudge them to install using the gem rdoc –all command.

This is so handy for me. No more going off and trying to find the docs online, or having to browse to my hard drive and find them manually.

pat eyler

AddThis Social Bookmark Button

Henrik MÃ¥rtensson has posted a couple of blog entries about Ruby related patterns: Extract Mixin and Replace Mixin with Class. I’m more intrigued by Extract Mixin (I’m planning on applying it to some shared functionality in r43 and RWB.

Since Patterns have been a topic here, I thought these were worth pointing out. It makes me wonder though, are there other patterns that grow out of the Ruby Way, or are more visible/useful when seen through rose tinted glasses?

Curt Hibbs

AddThis Social Bookmark Button

One thing that has really surprised me has been the consistently high readership of my Rolling with Ruby on Rails tutorials that were published at ONLamp.com over a year ago. Every week the O’Reilly Network Newsletter has a list of the top five articles for the past week, and Rolling with Ruby on Rails has been in the top five list every single week since it was published. Of course, this is really a testament to the strength and popularity of Rails, and not my skills as a writer. I was just fortunate enough to have good timing.

As Steve Mallett wrote a few days ago, Bill Walton has taken this tutorial and updated it for Instant Rails. This is very cool! Thanks, Bill for taking the time to do this.

Steve Mallett

AddThis Social Bookmark Button

Bill Walton had some ‘issues’ following Curt Hibbs’ Rolling with Ruby on Rails as he tried to follow the tutorial using InstantRails, “a one-stop Rails runtime solution containing Ruby, Rails, Apache, and MySQL, all preconfigured and ready to run”.

Bill has written an update to Curt’s original, with Curt’s blessing, to “make it 100% keystroke-for-keystroke, window-for-window accurate for someone using this same tutorial for InstantRails”.

If you’ve banged your head against the tutorial using InstantRails here’s some healin’.

Steve Mallett

AddThis Social Bookmark Button

I’m planning on raising money for charity by attempting to travel around the world in 80 hours. Yeah, like Phileas, but in this century… and in real life.

I’d like to set up the effort’s site to send actual online donations to the charity(s) of choice and let them get the donation directly. That way it’s lightweight, there’s no admin on my part & more importantly no mistrust in handling wads of cash. It appears hard to do. Got a hack?

At the moment the only semi-workable method of doing this is to have the people donating fill in the email field in donation forms with my email so I get notification, then I can forward these to the donor.

The best solution would be for charities to simply add a “notify this email address” field, but that’s not reasonable to expect anytime soon.

Are there any workable solutions out there?

James Britt

AddThis Social Bookmark Button

Last week, 30 Second Rule was asked to speak at a conference of Arizona educators. I. along with Aaron Post and Dan Ritz, spoke on current Web development trends to an audience of about 35 High School teachers who are trying to teach their students Web design and development.

I consider myself fortunate the get the ear of such influential people. Long story short, I talked about (among other things) Ruby and agile development, and had a chance to explain their benefits.

Ruby wasn’t the only language I suggested students use; I was more interested in making an important general point than dogmatically pushing a particular preference.

But I do think there is a reasonable chance that Ruby could find its way into High School curricula (even if informally), along with agile techniques in general and an appreciation of open, rapid, lightweight tools.

It can’t happen too soon; one teacher told me he’s using Visual Basic.

And here I thought there were laws about contributing to the delinquency of minors.

AddThis Social Bookmark Button

I’ve started a Writeboard to keep track of people who will be coming to the Chicago Rails studio. We’d like to try and get a meetup together, probably for the night before the workshop starts.

Email me : caleb at AAA EEE III dash tech dot com (that’s aei-tech.com) for an invite.

<\b>UPDATE: Mike Clark says to hold on just a minute and we’ll all be getting invites to a more formalized group to discuss.

AddThis Social Bookmark Button

In the last entry, I talked about Ruby VALUEs and what they mean. A few readers brought up some good points - namely that object_id’s and VALUEs look very similiar:

If we go inside Ruby for a second, here’s how the object_id is calculated:

VALUE
rb_obj_id(VALUE obj)
{
    if (SPECIAL_CONST_P(obj)) {
        return LONG2NUM((long)obj);
    }
    return (VALUE)((long)obj|FIXNUM_FLAG);
}

You can trace back the SPECIAL_CONST_P macro to point to a few other macros which point to a few other macros, etc.

What ends up happening, in general, is that the VALUE and the object_id are the same.

irb(main):001:0> "some_string".object_id
=> 1136556
irb(main):002:0> nil.object_id
=> 4
irb(main):003:0> false.object_id
=> 0
irb(main):004:0> true.object_id
=> 2
irb(main):005:0> 5.object_id
=> 11

Why does 5 have an object_id of 11? Well, don’t forget that Fixnums are stored in the upper 31 bits, which means a shift left of one. We also use the lowest bit to mark that it is a Fixnum.

Thus 0×0101 (5) becomes 0×1011 (11).

If we look back at our string object from above, its VALUE (1136556) correlates to 0b1000101010111110101100. Note that the lower two bits are 0 - they have to be if they represent at least a 4 byte aligned memory address (see previous entry for why).

What about symbols?

irb(main):002:0> :foo.object_id
=> 3895566
irb(main):004:0> :foo.to_i
=> 15217

So :foo’s object_id is 0b1110110111000100001110 and its to_i gives 0b11101101110001. First notice that the object_id has a 1 in the 2nd lowest bit. This again denotes a special type. Also note that there’s something similiar between the object_id and the to_i value - in fact, if you chop off the right most 8 bits from the object_id, you get the same number as to_i.

This may come into play later.