Shout out for the Scottish Ruby Conference #scotruby


Back in 2010 I dabbled with Ruby (remember when Microsoft was still doing stuff with IronRuby) and during that period I attended the Scottish Ruby Conference – and thoroughly enjoyed it! I was surrounded by a see of Apple products wherever I sat and stared at very little GUI IDE on the stage (I recall a lot of VIM and Emacs). It was so different from my “day job” and I left with huge respect for the then small but passionate community.

Well, my twitter #scotruby tells me it is on again today. It looks like a beautiful day in Scotland and a big part of me wishes I was there.

Enjoy

Edd strikes again – IronRuby for Rubyists on InfoQ


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

Colleague, friend and generally top guy on IronRuby Edd Morgan has just been published over on InfoQ.

To wet the appetite… a snippet or three.

IronRuby for Rubyists

IronRuby is Microsoft’s implementation of the Ruby language we all know and love with the added bonus of interoperability with the .NET framework — the Iron in the name is actually an acronym for ‘Implementation running on .NET’. It’s supported by the .NET Common Language Runtime as well as, albeit unofficially, the Mono project. You’d be forgiven for harbouring some question in your mind about running a dynamic language such as Ruby atop the CLR – that’s where the DLR (Dynamic Language Runtime) comes in. The DLR is Microsoft’s way of providing dynamic language capability on top of the CLR. Both IronRuby and the DLR are, as part of Microsoft’s commitment to open source software, available as part of the Microsoft Public License on GitHub and CodePlex respectively…

And

Metaprogramming with IronRuby

The art and science of metaprogramming — especially in Ruby, where it’s an absolute joy — is something that could very easily span an entire article. As you would hope, IronRuby code is fully able to manipulate itself allowing you to bend your classes to your whim just as you would expect with a good dynamic language…

And

Riding the irails?

So let’s get to the point. I think it’s a solid bet to make that a large proportion of Ruby programmers are familiar with the Rails framework – perhaps it’s even safe to assume that most were first led to the Ruby language by the siren song of the Rails framework itself.

Long story short, IronRuby is compatible enough to run your Rails app…

Now… get yourself over to the full article and also check out some of Edds other work below.

Related Links:

IronRuby rocks at IronRuby-rocks.com


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

My colleague Edd (who wrote two great guest posts for me on IronRuby) just pointed me at a new site ironruby-rocks.com. It is early days for the site but I felt it was worth some additional exposure even at this early stage.

Posts are nice and varied right now – from working with Microsoft Office to working with SQL Server.

I wish the site the very best of luck.

Related Links:

Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

45minute video on introduction to Windows Azure and running Ruby on Rails in the cloud


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

Last week I presented at Cloud and Grid Exchange 2010. I did an introduction to Windows Azure and a demo of Ruby on Rails running on Azure.

My slides and links can be found here – but just spotted that the excellent Skills Matter folks have already published the video.

Watch the video at http://skillsmatter.com/podcast/cloud-grid/looking-at-the-clouds-through-dirty-windows 

P.S. I really need to shed a few pounds!

Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

Open Source on .NET evening at UK Tech Days April 14th #uktechdays


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

That fine chap http://twitter.com/serialseb is pulling together an interesting evening of fun on the Wednesday in London and I for one will definitely be there.

Lots of goodness to learn about. If you are a .NET developer who still isn’t looking at Open Source, then the 14th is a great opportunity to see what you are missing out on.

Current program:

  • OpenRasta – A web application framework for .net
  • An introduction to IoC with Castle Windsor
  • FluentValidation, doing your validation in code
  • CouchDB, NoSQL: designing document databases
  • Testing your asp.net applications with IronRuby
  • Building a data-driven app in 15 minutes with FluentNHibernate

Register now

Related Links:

5 Steps to getting started with IronRuby


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

IronRuby is a Open Source implementation of the Ruby programming language for .NET, heavily relying on Microsoft’s Dynamic Language Runtime. The project’s #1 goal is to be a true Ruby implementation, meaning it runs existing Ruby code. Check out this summary of using the Ruby standard library and 3rd party libraries in IronRuby. IronRuby has tight integration with .NET, so any .NET types can be used from IronRuby and the IronRuby runtime can be embedded into any .NET application.

These 5 steps should get you nicely up and running on IronRuby – OR … you could just watch a video session from the lead developer which took place earlier this month (March 2010 – 60mins). But the 5 steps will be quicker :-)

Step 1 – Install IronRuby :-)

You can install IronRuby automatically using an MSI or manually. For simplicity I would recommend the MSI install.

TIP: As of the 25th of March IronRuby has not quite shipped. The download above is a Release Candidate (RC) which means it is still undergoing final testing by the team. You will need to uninstall this version (RC3) once the final release is available. The good news is that uninstalling IronRuby RC3 will work without a hitch as the MSI does relatively little.

Step 2 – Install an IronRuby friendly editor

You will need to Install an editor to work with IronRuby as there is no designer support for IronRuby inside Visual Studio. There are many editors to choose from but I would recommend you either went with:

  • SciTE (Download the MSI): This is a lightweight text editor which is simple to get up and running. SciTE understands Ruby syntax and allows you to easily run IronRuby code within the editor with a small change to the config file.
  • SharpDevelop 3.2 (Download the MSI): This is an open source development environment for C#, VB, Boo and now IronRuby. IronRuby support is new but it does include integrated debugging. You might also want to check out the main site for SharpDevelop.

TIP: There are commercial tools for Ruby development which offer richer support such as intellisense.. They can be coerced into working with IronRuby. A good one to start with is RubyMine which needs some small changes to make it work with IronRuby.

Step 3 – Run the IronRuby Tutorial

Run through the IronRuby tutorial which is included in the IronRuby download. It covers off the basics of the Ruby languages and how IronRuby integrates with .NET. In a typical install it will end up at C:\Program Files\IronRuby 0.9.4.0\Samples\Tutorial.

image

Which will give you the tutorial implemented in .NET and Ruby.

image

TIP: You might also want to check out these two introductory posts Using IronRuby and .NET to produce the ‘Hello World of WPF’ and What’s IronRuby, and how do I put it on Rails?

Step 4 – Get some good books to read

Get a great book on Ruby and IronRuby. There are several free ebooks on Ruby which will help you learn the language. The little book of Ruby is a good place to start.

I would also recommend you purchase IronRuby Unleashed (Buy on Amazon UK | Buy on Amazon USA). You might also want to check out this mini-review.

Other books are due out soon including IronRuby in Action.

TIP: Also check out the official documentation for using .NET from IronRuby.

Step 5 – Keep an eye on the team blogs

Keep an eye on the IronRuby team blogs including Jimmy Schementi, Jim Deville and Tomas Matousek (full list)

TIP: And keep a watch out for the final release of IronRuby – due anytime soon!

Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

Rob Blackwell on interoperability and Azure


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

At QCon in March we had a sample Azure application implemented in both Java and Ruby to demonstrate that the Windows Azure Platform is not just about .NET. The following is an interesting interview with Rob Blackwell, the R&D director of the partner who implemented the application.

UK Interoperability Team Interviews Rob Blackwell, R&D Director at Active Web Solutions.

Is Microsoft taking interoperability seriously?

Yes. In the past, I think Microsoft has, quite rightly come in for criticism, but architects and developers should look at this again. The Interoperability Bridges site (http://www.interoperabilitybridges.com/ ) shows a wide range of projects that allow interoperability from Java, Ruby and PHP for example.

The Windows Azure platform has been architected with interoperable APIs in mind. It’s straightforward to access the various storage facilities from just about any language or platform. Azure compute is capable of running more than just C# applications!

Why is interoperability important to you?

My company provides consultancy and bespoke development services. We’re a Microsoft Gold Partner, but we live in the real world where companies have a mix of technologies provided by a variety of vendors.

When developing an enterprise software solution, you rarely have a completely blank canvas. We often see integration scenarios where we need to exchange data with legacy systems. It’s not unusual to see modern Silverlight applications being built on top of Java or Mainframe based back ends.

Could you give us some examples of where interoperability has been important for your projects?

We developed an innovative Sea Safety system for the RNLI Lifeboats here in the UK. Commercial Fishing is one of the most dangerous professions and we helped developed the MOB Guardian System which uses satellite technology and man overboard devices to raise the alarm when a fisherman gets into trouble. The solution is implemented in .NET running on Windows, but without interoperable standards, it would have been impossible to communicate with the satellite gateway technology. For more information, please see the case study: http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?CaseStudyID=4000005892

More recently, we were asked to build a web site to accompany the QCon 2010 conference in London to help demonstrate and promote interoperability. We built the site using Java and Restlet and hosted it in Windows Azure Compute. The site accepts feedback from visitors and all the data is stored in Windows Azure Storage. We also ported the application to Ruby on Rails for demonstration purposes. Visitors to the stand were surprised that this was even possible.

Why should Java developers be interested in Windows Azure?

Windows Azure Storage consists of Blobs, Queues and Tables. The storage is scalable, durable, secure and cost-effective. Using the WindowsAzure4j library, it’s easy to use, and takes just a few lines of code. If you are writing an application with large data storage requirements, or you want an offsite backup, it makes a lot of sense.

Running Java applications in Azure Compute is straightforward with tools like the Tomcat Solution Accelerator (http://code.msdn.microsoft.com/winazuretomcat )and AzureRunMe (http://azurerunme.codeplex.com/ ).

The Windows Azure AppFabric Service Bus can also be used to connect heterogeneous systems running on different networks and in different data centres.

How can The Service Bus be considered an interoperability solution?

I think that the Windows Azure AppFabric Service Bus is one of Microsoft’s best kept secrets. Think of it as “a globally scalable application plumbing kit in the sky”.

If you have used Enterprise Service Buses before, you’ll be familiar with the concept. Applications can connect to the service bus to securely exchange data – these can be point to point or multicast links.

With the AppFabric Service Bus, the applications can exist anywhere that has access to the Internet and the connections can traverse firewalls. This makes it easy to extend or scale your application or reach out to other networks and technologies.

For example, let’s say you have a SQL Server database running on premises and you want to expose the data to a Java application running in the cloud. You could set up a point to point Service Bus connection and use JDBC. Traditionally this would have been difficult or impossible without punching holes in firewalls and compromising security.

Rob Blackwell is R&D Director at Active Web Solutions, www.aws.net , a Microsoft Gold Partner specialising in leading edge software solutions. He is an occasional writer and conference speaker and blogs at www.robblackwell.org.uk

Related Links:

Live examples of the Windows Azure Platform running Java and Ruby on Rails


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

At QCon in March we had a booth focused on interoperability out of which came the idea to create an application implemented in both Java and Ruby on Rails, running on top of the Windows Azure Platform.

Nothing fancy, just an application to capture attendees view on Microsoft and Interoperability. It was implemented by Active Web Solutions, long time fans of Azure.

Wroth a quick squint :-) Check out the related links below for info to get you up and running.

image

Check out

Related Links:

Mini Book Review of IronRuby Unleashed by Shay Friedman


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

When I get some time (and hell starts to look a little chilly) I would love to do a more detailed review. But I wanted to get something “out there” as I really like this book and reviews of it seem a little thin on the ground.

In brief:

  • Is it a good book? Yes
  • Would I recommend this book to a .NET developer who was new to Ruby? Yes (This is me by the way)
  • Would I recommend this book to a Ruby developer who was new to .NET ? Yes
  • Would I recommend this book to a developer who sometimes does Ruby and sometimes does .NET? Yes
  • Would I recommend this book to a developer new to .NET and new to Ruby? Yes

The above demonstrates how well balanced this book is (IMHO).

What I like about it:

  • Its assumes pretty much no knowledge of IronRuby or .NET. All it asks is that you are a developer interested in IronRuby. Yet it manages to cover off the topics in a good degree of detail.
    • If you are a Ruby developer you skip Part 2, if you are a .NET developer you skip some of Part 1 and whizz through the short intros to the individual technologies such as WPF.
  • It is definitely not a “lets makes the manual look pretty” book – this is original content thoughtfully written and presented.
  • It is pretty comprehensive – in 500 pages it packs in 
    • Intro to IronRuby
    • Intro to .NET
    • Intro to Ruby
    • Using IronRuby with Windows Forms, ASP.NET, WPF, Silverlight etc
    • Getting Rails working with IronRuby
    • Unit testing with IronRuby – which I think is an excellent way for a .NET developer to start using IronRuby
    • Embedding IronRuby in a .NET app  – another interesting “first step” for a .NET developer

What I didn’t like:

  • Err… nothing yet. Ok, If I am being picky then the start of chapter 2 irked me a little as it went through the history of .NET. “The first version [of the .NET Framework] wasn’t that great”.  Felt pretty good to me compared to Java and C++ development at the time :-)

image

Buy on Amazon UK | Buy on Amazon USA

Related Links:

Guest Post: Using IronRuby and .NET to produce the ‘Hello World of WPF’


Note: Cross posted from IUpdateable from Eric Nelson.

Permalink

[You might want to also read other GuestPosts on my blog – or contribute one?]

On the 26th and 27th of March (2010) myself and Edd Morgan of Microsoft will be popping along to the Scottish Ruby Conference. I dabble with Ruby and I am a huge fan whilst Edd is a “proper Ruby developer”. Hence I asked Edd if he was interested in creating a guest post or two for my blog on IronRuby. This is the second of those posts.

If you should stumble across this post and happen to be attending the Scottish Ruby Conference, then please do keep a look out for myself and Edd. We would both love to chat about all things Ruby and IronRuby.

And… we should have (if Amazon is kind) a few books on IronRuby with us at the conference which will need to find a good home.

This is me and Edd and … the book:

eric09 imageimage

Order on Amazon: http://bit.ly/ironrubyunleashed

Using IronRuby and .NET to produce the ‘Hello World of WPF’

In my previous post I introduced, to a minor extent, IronRuby. I expanded a little on the basics of by getting a Rails app up-and-running on this .NET implementation of the Ruby language — but there wasn’t much to it! So now I would like to go from simply running a pre-existing project under IronRuby to developing a whole new application demonstrating the seamless interoperability between IronRuby and .NET. In particular, we’ll be using WPF (Windows Presentation Foundation) — the component of the .NET Framework stack used to create rich media and graphical interfaces.

Foundations of WPF

To reiterate, WPF is the engine in the .NET Framework responsible for rendering rich user interfaces and other media. It’s not the only collection of libraries in the framework with the power to do this — Windows Forms does the trick, too — but it is the most powerful and flexible. Put simply, WPF really excels when you need to employ eye candy. It’s all about creating impact. Whether you’re presenting a document, video, a data entry form, some kind of data visualisation (which I am most hopeful for, especially in terms of IronRuby – more on that later) or chaining all of the above with some flashy animations, you’re likely to find that WPF gives you the most power when developing any of these for a Windows target.

Let’s demonstrate this with an example. I give you what I like to consider the ‘hello, world’ of WPF applications: the analogue clock.

Today, over my lunch break, I created a WPF-based analogue clock using IronRuby… Any normal person would have just looked at their watch.
- Twitter

The Sample Application:

Click here to see this sample in full on GitHub.

Using Windows Presentation Foundation from IronRuby to create a Clock class

image

Invoking the Clock class

image 

Gives you

image

The above is by no means perfect (it was a lunch break), but I think it does the job of illustrating IronRuby’s interoperability with WPF using a familiar data visualisation. I’m sure you’ll want to dissect the code yourself, but allow me to step through the important bits. (By the way, feel free to run this through ir first to see what actually happens).

Now we’re using IronRuby – unlike my previous post where we took pure Ruby code and ran it through ir, the IronRuby interpreter, to demonstrate compatibility. The main thing of note is the very distinct parallels between .NET namespaces and Ruby modules, .NET classes and Ruby classes. I guess there’s not much to say about it other than at this point, you may as well be working

with a purely Ruby graphics-drawing library.

You’re instantiating .NET objects, but you’re doing it with the standard Ruby .new method you know from Ruby as Object#new — although, the root object of all your IronRuby objects isn’t actually Object, it’s System.Object. You’re calling methods on these objects (and classes, for example in the call to System.Windows.Controls.Canvas.SetZIndex()) using the underscored, lowercase convention established for the Ruby language. The integration is so seamless. The fact that you’re using a dynamic language on top of .NET’s CLR is completely abstracted from you, allowing you to just build your software.

A Brief Note on Events

Events are a big part of developing client applications in .NET as well as under every other environment I can think of. In case you aren’t aware, event-driven programming is essentially the practice of telling your code to call a particular method, or other chunk of code (a delegate) when something happens at an unpredictable time. You can never predict when a user is going to click a button, move their mouse or perform any other kind of input, so the advent of the GUI is what necessitated event-driven programming.

Th
is is where one of my favourite aspects of the Ruby language, blocks, can really help us. In traditional C#, for instance, you may subscribe to an event (assign a block of code to execute when an event occurs) in one of two ways: by passing a reference to a named method, or by providing an anonymous code block. You’d be right for seeing the parallel here with Ruby’s concept of blocks, Procs and lambdas. As demonstrated at the very end of this rather basic script, we are using .NET’s System.Timers.Timer to (attempt to) update the clock every second (I know it’s probably not the best way of doing this, but for example’s sake).

Note: Diverting a little from what I said above, the ticking of a clock is very predictable, yet we still use the event our Timer throws to do this updating as one of many ways to perform that task outside of the main thread.

You’ll see that all that’s needed to assign a block of code to be triggered on an event is to provide that block to the method of the name of the event as it is known to the CLR. This drawback to this is that it only allows the delegation of one code block to each event. You may use the add method to subscribe multiple handlers to that event – pushing that to the end of a queue. Like so:

def tick
    puts "tick tock"
end

timer.elapsed.add method(:tick)
timer.elapsed.add proc { puts "tick tock" }
tick_handler = lambda { puts "tick tock" }
timer.elapsed.add(tick_handler)

 

The ability to just provide a block of code as an event handler helps IronRuby towards that very important term I keep throwing around; low ceremony. Anonymous methods are, of course, available in other more conventional .NET languages such as C# and VB but, as usual, feel ever so much more elegant and natural in IronRuby.

Note: Whether it’s a named method or an anonymous chunk o’ code, the block you delegate to the handling of an event can take arguments – commonly, a sender object and some args.

Another Brief Note on Verbosity

Personally, I don’t mind verbose chaining of references in my code as long as it doesn’t interfere with performance – as evidenced in the example above. While I love clean code, there’s a certain feeling of safety that comes with the terse explicitness of long-winded addressing and the describing of objects as opposed to ambiguity (not unlike this sentence). However, when working with IronRuby, even I grow tired of typing System::Whatever::Something. Some people enjoy simply assuming namespaces and forgetting about them, regardless of the language they’re using. Don’t worry, IronRuby has you covered.

It is completely possible to, with a call to include, bring the contents of a .NET-converted module into context of your IronRuby code – just as you would if you wanted to bring in an ‘organic‘ Ruby module. To refactor the style of the above example, I could place the following at the top of my Clock class:

class Clock
    include System::Windows::Shape
    include System::Windows::Media
    include System::Windows::Threading
    # and so on...

 

And by doing so, reduce calls to System::Windows::Shapes::Ellipse.new to simply Ellipse.new or references to System::Windows::Threading::DispatcherPriority.Render to a friendlier DispatcherPriority.Render.

Conclusion

I hope by now you can understand better how IronRuby interoperates with .NET and how you can harness the power of the .NET framework with the dynamic nature and elegant idioms of the Ruby language.

The manner and parlance of Ruby that makes it a joy to work with sets of data is, of course, present in IronRuby — couple that with WPF’s capability to produce great graphics quickly and easily, and I hope you can visualise the possibilities of data visualisation using these two things. Using IronRuby and WPF together to create visual representations of data and infographics is very exciting to me. Although today, with this project, we’re only presenting one simple piece of information – the time – the potential is much grander.

My day-to-day job is centred around software development and UI design, specifically in the realm of healthcare, and if you were to pay a visit to our office you would behold, directly above my desk, a large plasma TV with a constantly rotating, animated slideshow of charts and infographics to help members of our team do their jobs. It’s an app powered by WPF which never fails to spark some conversation with visitors whose gaze has been hooked. If only it was written in IronRuby, the pleasantly low ceremony and reduced pre-processing time for my brain would have helped greatly.

Edd Morgan blog

Related Links: