Ruby Tuesday #16 Part 2 : IronRuby news

29 07 2008

At OSCON last week, John Lam made a number of announcements about IronRuby (and speaking of OSCON, you should check out the announcements Sam Ramji made, too.)  In summary:

There’s a binary release of IronRuby, which includes the standard Ruby libraries.

An ironruby-contrib project has been established – another way to get involved in the IronRuby community.

A set of changes to RubySpec have been submitted.

The full blog post on the IronRuby announcements is here.  Well worth reading in full.





Ruby Tuesday #10 Part 1 : Studying Form

17 06 2008

The next task I had set myself in my Ruby learning journey was to write a GUI for the Twitter client I have created.  A quick squiz around the internet reveals a number of potential frameworks.  In no particular order, here’s some I found:

FXRuby - "a library for developing powerful and sophisticated cross-platform graphical user interfaces."  I was toying with the idea of writing a weak and crude GUI, but this may still be the right choice.

Konundrum - "Very complete bindings to both the KDE API and the Qt APIs."  Very complete is clearly a good thing - none of your bog standard completeness here.  Now, what’s Qt?  It’s a "cross-platform application framework for desktop and embedded development" according to its authors, Trolltech, with "an intuitive API and a rich C++ class library."

Ruby/Tk - there seems to be Ruby bindings for the Tk toolkit. Tk is a "Tcl extension, written in C, designed to give the user a relatively high level interface to his or her windowing environment."  Tcl, in turn, is a "a powerfully simple, open source-licensed programming language."  Hmm.  Does all this sound a little obtuse and slightly recursive to you, too?

Ruby-GNOME2 -  "a set of Ruby language bindings for the GNOME 2.0 development environment."  GNOME "offers an easy to understand desktop for your GNU/Linux or UNIX computer." And lots of CAPITALS.  *nix only is a dealbreaker for me - although the documentation includes mention of Ruby/Gtk2, which uses Gtk+, which runs on Windows.  Could be clearer, but if you’re a fan of the esoteric this could be a good choice.

Shoes - "a very informal graphics and windowing toolkit."  Here’s a helpful poster thingy about it.

Of course, with IronRuby I could also use Silverlight.  I haven’t covered IronRuby yet, so I’ll leave Silverlight for another Ruby Tuesday.  For those of you who can’t wait, I’d suggest a little peek here.

Is all this choice a good thing?  Or does it distract me from building a GUI by leading me to have to find out some more about each framework / toolkit?  As good a concept as choice is, I’m not sure what the choice here really is.  I can choose between a bunch of frameworks that do more or less the same thing.  So unless anyone has a better idea, I’m going to plump for Shoes on the basis that it has the best, albeit extremely silly, name.





Ruby Tuesday #3 : Surveying the Rubyverse

29 04 2008

Last week, I installed Ruby on a PC and on a Mac.  I installed what is often called MatzRuby or MRI (Matz’s Ruby Interpreter) – but there are other implementations of Ruby.  I was already aware of IronRuby and JRuby.  Via this post on RubyInside, I found this post by Charles Nutter that covers the implementations that are available.  I’m mostly interested in MatzRuby and IronRuby, but it’s good to know what else is available, what stage they are at and so forth.

Having installed Ruby, the next thing that many of us would look for is an IDE.  You don’t need an IDE for Ruby, a text editor (preferably with syntax highlighting) will suffice.  Being new to Ruby, I don’t know whether I’ll plump for a Ruby IDE in the longer term.  There’s an interesting question here about programming habits – which come from your experience and preference and which come from the language you are trying to learn.  There are a number of IDEs for those interested – Sapphire in Steel puts Ruby into Visual Studio, and there’s a ruby specific version of NetBeans.  There is, no doubt, some way of editing Ruby in Eclipse, but I haven’t looked yet (I’ve used Eclipse before and it feels a little unwieldy to me, so the idea of Eclipse for Ruby seems somehow wrong to me.) For now, I’m going to be using a combination of text editors and IDEs to see what fits.





Ruby Tuesday #2 : Setting up

22 04 2008

The first thing to do is to install Ruby.  Along the way, I’m going to use a PC and a Mac.  Let’s start with the Mac.  Open a terminal and type:

ruby -v

On the Mac I used, which is running Tiger, I got the following response:

ruby 1.8.2 (2004-12-25) [universal-darwin8.0]

OK, so Ruby is already installed on the Mac.  But it’s not the latest version, which, at the time of writing, is 1.8.6.  Fortunately, there’s a download here on the Apple site that installs 1.8.6 - along with some other bits and bobs including RubyGems.  Once installed, open a fresh terminal window and type:

ruby -v

I now see:

ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0]

So, we now have Ruby 1.8.6 installed on the Mac.  Clearly, a Hello World is called for.  Type:

irb

That launches the interactive ruby shell and type:

puts "Hello World"

which produces:

Hello World=> nil

Great. Let’s move onto the PC.  On the machine I used, running Vista, Ruby wasn’t already installed. There’s a one-click installer for Windows - you can find it here.  You can pick the version you want to install, I picked “1.8.6-26 Final Release”.  It installs:

the Ruby language itself, dozens of popular extensions and packages, a syntax-highlighting editor, an execution environment, and a help file that contains the full text of the book, Programming Ruby: The Pragmatic Programmer’s Guide.

Test the installation with the now familiar:

ruby -v

Here’s the output I got:

ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

Finally, run the same steps for Hello World via the interactive shell.  I got the same result as I got on the Mac, which is nice.

Along the way I found a couple of links that might be useful to anyone else starting Ruby:

Getting started tips from David Heinemeier Hansson, the creator of Rails.
RubyDoc.org

So that’s Ruby installed.  Now there’s just the small matter of learning the language…





Django on IronPython

30 03 2008

At PyCon 2008 in Chicago earlier this month, the latest release of Django (0.96) was shown running on IronPython.  There’s an interesting post about it here, and there’s some background info here from Dino Viehland.

It’s great to see IronPython supporting Django.   It demonstrates the power and ambition of IronPython, but, more to the point, the combination of Django and the .NET platform is exciting.





ActiveMQ version 5 is released

17 12 2007

I’ve written a few articles about ActiveMQ over the last few months.  Version 5 has just been released.  There’s more info on James Strachan’s blog here.





Transactional Messages

16 09 2007

I’ve posted an article about transactional message processing using ActiveMQ and NMS. You can read it here.





Posting source code on WordPress

4 09 2007

Posting source code on WordPress.com has meant <pre> tags and choosing the right theme.  Until now.  The announcement yesterday of making posting source code only slightly harder than falling off an especially awkwardly shaped log is very welcome.  One more reason to use WordPress.  For those of you who want to get straight to posting, the detail is here.





Adventures in Wireless Ubuntu

25 08 2007

I have an old (nearly 5 years old) PC that has fallen out with Windows. Running Windows on it is slow. Very slow. Over its life, I’ve had to do two fresh installs of XP and battle with a host of malware. Until I got a Mac, it was my main computer, but over the last few months I’ve migrated to Windows in Parallels, so I don’t use this PC at all. Time to install Ubuntu and make the PC useful again. The Ubuntu install was painless and quick. I had a USB wireless adapter that wasn’t so keen on the switch away from Windows. Having gone through a few forums and tried a few things unsuccessfully, I decided to take another tack. I picked up a cheap Netgear WG111 and followed these instructions. To get the modprobe instruction to work I needed to find ndiswrapper.ko and move it to the right location. After that, I added the MAC address to the list my wireless router accepts, used the Network thingy in the Gnome panel to join my wireless network (using WPA2) and, would you believe it, it all worked. It’s worth reading this to get over the Keyring nag.

So, a few hours, a lot of command linery (Ubuntu isn’t for you if you’re allergic to the comand line) and a false start with the USB wireless adapter and my tired, old PC has a new lease of life.  It does take a while to boot, but once booted it’s quick as you like.





Backing up OS X command-line style

30 07 2007

I bought an external drive recently.  I bought it partly to back up the files on my main computer - a trusty Mac.  It came bundled with Retrospect Express.  I’ve tried to use Retrospect Express, but we don’t get along too well.  Before I got the drive, I’d read about using rsync to backup OS X.  So, I thought I’d give that a go.  I followed the instructions here.  Works a treat, and simple as you like.  Sometimes the command line is all you need.  For the easily scared among you, keep your eyes averted from the following warning to be found towards the bottom of the article:

Using command line utilities without experience can have unpredictable consequences including loss of data.