Archive for the ‘Languages/Ruby’ Category.

Rails Forms With Auto-Hyperlink On FKs

Because I use primary_key_prefix_type = :table_name this did the trick for me. Basically, I just set up a hash mapping primary key column names (“InvoiceID” and the like) to the name of the appropriate controller (“invoice_admin”). When outputting a column, if the name of the column is contained in that hash, output a link. All I had to do was write a script to generate the hash and a template for the show.rhtml and Bob was my uncle…

 
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
 
    #lazy initializer for mapping between the names of FK fields and the appropriate controller
    #:return: => nil
    def initialize_identity_columns
        @identityColumns = { 
      'InvoiceID' =>  'invoice_admin' 
      # ... etc ... 
    } 
    end
 
    #called within show.rhtml (probably) ala 
    # <% for column in LineItem.content_columns %>
    # <%= show_column_with_auto_hyperlink(@line_item, column) %>
    #<% end %>
    #:return: => String
    #:arg: currentObj => ActiveRecord::Base
    #:arg: column => ActiveRecord::ConnectionAdapters::Column
    def show_column_with_auto_hyperlink(currentObj, column)
      if @identityColumns == nil
        initialize_identity_columns()
      end
      html = "<p><b>#{column.human_name}:</b> #{currentObj.send(column.name)}&nbsp;"
      optionalLink = nil    
      if @identityColumns[column.name] != nil 
          html += link_to("Show", { :controller => @identityColumns[column.name], :action => "show", :id => currentObj.send(column.name) })
      end
      html += "</p>"
      return html
    end
end

				

Udell Interviews Lam on DLR, Silverlight, IronRuby

I’ll be listening to this podcast ASAP.

Dynamic Language Runtime / IronRuby Inst-analysis

That Microsoft was going to increase support for dynamic languages is no surprise: they’ve been talking about that since (at least) PDC ’03 and various hires and initiatives have clearly been in the works. I haven’t seen the DLR yet, but my big question is: what version / runtime / patch level of the CLR  and libraries becomes the lowest-common denominator for Silverlight (i.e., cross-platform, in the browser)? Because for better or worse, that becomes the platform for dynamic languages in the .NET world.

I am surprised by the IronRuby announcement (and officially bestow the He-Man Programming Award to John Lam). I really thought we were going to see some form of Ruby#:Ruby::C#:Java. Although I’m happy (Ruby is now my #1 administrative programming language), I was actually hoping to see a new language. Ruby’s a fine language, but it doesn’t have a good story for concurrence, it has a boring model of XML (unlike VB), it has some unattractive Perl-isms. Most importantly, I think MS does a good job when they have the flexibility to evolve the language and, simultaneously, can devote the resources to developing the compilers, libraries, and toolsets.

IronRuby announced

Scott Guthrie just announced IronRuby! Yeehaw!!!!!!

Silverlight binding; demoing on Mac

Dynamic Language Runtime announced

“Shipping later this week” (I’m sure he means shipping a beta / CTP)

Uses Ruby naming scheme when programming .NET libraries (weird. Not sure I like that.)

“Switch the console into Python mode, Ruby mode, VB mode” (he means something called “Dynamic VB”)

www.silverlight.net is the commmunity site

(No sign of DLR / IronRuby / IronPython / Dynamic VB on that site as far as I can see)

“Componentize dispatching code, code generation, that sort of thing that compiler vendors do” … namechecks to Hugunin and Lam … we shipped this morning the DLR source code” on Codeplex …

(http://www.codeplex.com/Project/ProjectDirectory.aspx?ProjectSearchText=dynamic%20language%20runtime ? )

Wii Controls SAP via Ruby On Rails Mashup

I know that sounds like a some kind of Bayesian spam-evader, but apparently Edward Herrmann, a programmer at Colgate-Palmolive, and colleagues hacked their Wii controller to send messages to their Ruby On Rails application, which drove their SAP system (film after the jump). What a geek-tastic transcendance of normal categories.

Thanks to Anthony Beecher for the tip!

IntelliJ IDEA for Ruby Programming: First Look

My long-time favorite Java editor JetBrains/IntelliJ IDEA has added a Ruby plug-in that supports Rails. My initial reaction is that the vitally important quality of code completion is well below that of both Ruby In Steel and Komodo. Don’t be too excited by the presence of the Analyze and Refactor menus either — they’re non-functional (or at least I couldn’t get them to work).

The little “ruby” icon beside ‘def HeloWorld’ navigates to the view for the action — that’s pretty slick. You can generate Rails entities (controllers, etc.) via right-click context menus and you can Rake from within IDEA.

My quick feeling is that the plug-in, while welcome, seems to fall well short of the functionality in Komodo and Ruby In Steel much less the full array of functionality available in IDEA (or even ReSharper).

I wonder if anyone else is working on a Ruby IDE.

First Look: Komodo 4 for Ruby Programming

It’s been a good couple weeks for Ruby IDEs. First, Ruby In Steel was released. Pretty much simultaneously, ActiveState releasedKomodo 4 with support for Ruby.

Komodo is a significantly “weightier” IDE and Ruby is just one of the many languages it supports. It is, I suppose, more akin to Visual Studio itself than to Ruby In Steel, which adds Ruby support to Visual Studio.

I still have much more head-to-head comparison to doing, but I wanted to point out a clear “win” for Komodo: the Ruby shell shown in the bottom pane here is graphical, allowing for a significantly easier cut-and-paste experience than the IRB-in-a-DOS-Box approach:

 

P.S. What the heck is “IDE_GeneticAlgorithm”? Well, a while back there was a flurry of posts about “the best” customized color schemes for programmers. I thought it would be funny to write a distributed genetic algorithm that “bred” color schemes and evolved them on the Web. The problem is the age-old challenge of creating a decent traversal through colorspace (that isn’t along the gray axis). What’s a way to encode color in a single number such that like values have like colors?

First Look: Ruby In Steel

Here’s the Ruby In Steel editing / debugging experience. Intellisense works dynamically — as soon as you define a function, it becomes available to Intellisense. The debugging experience seems to be the standard VS one (that is, pretty darned good).

REPL functionality is provided by IRB in a console window: not ideal, but convenient. There’s quick access to Rails, Rake, and Gems (see the second screenshot).

The install silently guessed wrong on my Ruby install location, which caused my very, very first “puts 2+2″ to fail, but it was easy enough to guess that the issue could be fixed under Tools | Options…

So far, so good: more to come as experiences develop. I look forward to putting this head-to-head against Komodo.

 

Komodo 4 Supports Ruby

Hard on the heels of Ruby In Steel’s debut, Komodo 4 was released today. This new version supports Ruby and RoR. via Binstock on Software.

Ruby In Steel (Ruby Development Environment in VS 2005) Goes 1.0

Ruby programmers using Windows should definitely give this a look; this is very high on my “IDEs to look out for” list. It should be noted that this is not a CLR / .NET-based Ruby; it’s a plug-in to Visual Studio (Standard Edition and above; unfortunately, VS Express users are out of luck) that targets the standard Ruby interpreter.

Although Scite has it’s charms (like loading in a fraction of a second), VS is definitely a superior environment for extended development.