Noel Rappin Writes Here

May 24, 2010: Martin Gardner

Posted on May 24, 2010

Top Story

Rails 2.3.6 released, with more changes than I expected, taking it just a little bit beyond a bug-fix release. Follow the link for the full release notes.

Things that caught my eye:

  • Looks like they made an official plugin to give Rails 2.3.6 the default HTML safe behavior of Rails 3. Although the note is vague and I could be misunderstanding.

  • Alert and notice are now separate methods rather than just being keys on the flash.

  • You can now set the length of indexes in MySQL, and place a new column at an arbitrary point in the table.

  • Added test functions assert_present and assert_blank. Looks like I need to change a book chapter…

A matter of Ruby style

James Edward Gray had a couple of tweets on Friday praising a piece of Ruby that I was honestly unfamiliar with, namely using a regular expression inside brackets to reference a string

irb(main):001:0\> "hello dolly"[/ll./]
=\> "llo"
irb(main):002:0\> "hello dolly"[/ll(.)/, 1]
=\> "o"
irb(main):003:0\> "hello dolly"[/xx/]
=\> nil

Did not know you can do that. The semantics are that the regex by itself returns nil or the entire matching substring, but if you have a second integer argument in the bracket then it returns the matched group corresponding to that index.

Nifty. Undeniably compact. Keeps me from having to remember which character in the matching operator comes first.

What’s the verdict – please do chime in – cool feature, or unreadable hack?

Book status

I expect Beta 3 to be out sometime in the next 24 hours. Not completely sure what to do next, but I think I’ll probably look over some of the material on test quality in conjunction with my upcoming Chicago Ruby talk.

Not least, read this

Martin Gardner passed away over the weekend. It occurs to me that I have no idea how well-known Gardner is among those of you who read this. Gardner wrote the “Mathematical Games” column in Scientific American for 25 years ending in 1981. More to the point, at least for me, if you were a young math nerd roaming the stacks of the Wilmette Library in the early 80s, you would have found many, many collections of Gardner’s work.

Gardner’s books were among the first places I ever saw somebody having fun with the kinds of math and logic problems that are pretty much what I do for a living now. Among other things, his books were the first place I encountered Escher’s art, and I distinctly remember being fascinated by a what was basically a mechanical game playing AI using matchboxes and marbles. I was too young or impatient or dumb to actually try to solve most of the problems in Gardner’s columns, but the sense of joy that he showed in a particularly elegant puzzle and solution was infectious.

Funny footnote – I thought for a second that I’d use an anagram of “Rest In Peace Martin Gardner” as the headline, so I went to the anagram server, and it’s funny how many anagrams pop up using the word “reincarnated”, given that Gardner was such a famous skeptic.


comments powered by Disqus

Copyright 2024 Noel Rappin

All opinions and thoughts expressed or shared in this article or post are my own and are independent of and should not be attributed to my current employer, Chime Financial, Inc., or its subsidiaries.