Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Computing
Conference & Expo
November 2-4, 2009 NYC
Register Today and SAVE !..

2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
In many cases, the end of the year gives you time to step back and take stock of the last 12 months. This is when many of us take a hard look at what worked and what did not, complete performance reviews, and formulate plans for the coming year. For me, it is all of those things plus a time when I u...
SYS-CON.TV
Silverlight and Ruby on the Mac
I have been listening to a lot of people tell me that I should be using Ruby for my Silverlight development

Ingredients you're going to need before following along with this blog post:

  • Mono (latest stable release) for Mac OS X
  • Silverlight 2.0 Plugin for Firefox (you can download this from http://www.silverlight.net
  • Silverlight Dynamic Languages SDK (You can download this from CodePlex )

Don't worry if the dynamic languages SDK seems like it's a windows-only download. Things are going to get really interesting during this post, and there will be some really, really blurry cross-platform lines... especially when we start busting out the Mono.

Hello Ruby

I have been listening to a lot of people tell me that I should be using Ruby for my Silverlight development because the dynamic language dramatically simplifies common development tasks and that my Silverlight applications will be quicker to market, cooler, more elegant, and indeed will sprout their own halos and emit solid gold from their debuggers. Not being one to believe anything anybody tells me, this series of blog posts is all about me trying to determine for myself if any of this prattle about Ruby and Silverlight being the holy grail is true. The first step in any evaluation of a new technology for me is the Hello World app. So this is how to build a Hello Ruby application using Silverlight and nothing but a Mac running Leopard... NO Windows machines.

Environment Setup

After installing Mono and the SDL SDK, its time to get rockin'. The SDL SDK comes with a shell script that will generate an empty Silverlight Ruby application in the directory of your choice. To do this, I dropped into Terminal in the SDK directory and issued the following command:

script/sl ruby hello

This created a new directory called hello that contained an index.html to host my Silverlight control, some stylesheets for reporting errors in specific divs, and of course a directory called ruby that contains all the good stuff.

Once I've got this directory set up, I change into the hello/ruby directory and I edit the App.xaml file and the App.rb file. The following image is a screenshot of me editing the App.xaml file:

Keep in mind that I'm not using a Windows machine to do any of this, nor have I invoked anything mono-related yet. Also worth noting is the classic Ruby syntax where I'm defining an event handler for the Click event on my button. One main difference between building C# Silverlight apps and Dynamic Silverlight apps is that the Xaml parser does not know ahead of time about dynamic classes and so cannot rig events directly in Xaml. My guess is that this also means I'm not going to be able to use ObjectDataSources with Ruby objects, but that's a topic for another post.

The next thing we need is a XAP file. A Xap file is basically a ZIP file that contains your Xaml, your Ruby, and all of your dependent DLLs and resources. When you hit a website that is hosting a Silverlight control, the plugin fetches the Xap file, cracks it open, and then starts running code in the client-side sandbox using what it found in the XAP.

This is where mono comes in. The SDL SDK comes with a tool called Chiron (that's pronounced KAI-RON in case you're curious). This tool can either run a web server that dynamically generates a XAP from the contents of a directory, or it can produce a static XAP that you can then use to deploy your control. For debugging and testing purposes, running the web server is a great option because you can see changes you make just by refreshing the browser.

To run Chiron, I simply changed to the hello directory and ran ../script/server /w (Chiron in web server mode defaulting to the current directory). Worth noting here is that Chiron.exe is a Windows-compiled application, but because it makes use of System.Net it can be invoked flawlessly using mono. In fact, when you run the server script, it is actually invoking Mono to run Chiron.exe. Here's a screenshot of me hitting the Chiron-hosted website using Firefox (again, this is all on the Mac):

So what's really going on here??

Basically what's happening is that when my client (Firefox on Leopard in this case) hits a web page that is hosting a Silverlight 2.0 control, the plug-in downloads the appropriate XAP file and then begins executing. It uses traditional Silverlight CLR code to create an instance of the DLR host that is appropriate for the language it discovered I'm using. In this case, it's going to use the Silverlight CLR to create an instance of the Ruby DLR host. From that point afterward, the Ruby DLR host is in charge and I'm now running Ruby code in the DLR, which is inside the Silverlight-CLR, which is inside the browser plug-in sandbox provided by Firefox.

Verdict

So far so good. I can use my favorite text editor to create Ruby files that are powering my Silverlight app and still have my Xaml so that I can still make use of Expression Blend (yes, I'd have to use Windows for this) to do up my GUIs. My next test will be to see if I can data bind a Silverlight Xaml GUI to Ruby objects. I'll cover my attempt to get that working in my next blog post.

tags:              

links: digg this  del.icio.us technorati  reddit

See the complete article here

About Kevin Hoffman
Kevin Hoffman, editor-in-chief of SYS-CON's iPhone Developer's Journal, has been programming since he was 10 and has written everything from DOS shareware to n-tier, enterprise web applications in VB, C++, Delphi, and C. Hoffman is coauthor of Professional .NET Framework (Wrox Press) and co-author with Robert Foster of Microsoft SharePoint 2007 Development Unleashed. He authors The .NET Addict's Blog at .NET Developer's Journal.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

SOA World Latest Stories
Just when the US Postal Service looks down for the count, a self-funded Seattle start-up called PaperKarma figures its destiny is to suppress junk mail on which the post office depends. The company was started by Sean Mortazavi, who hasn’t given up his day job at Microsoft yet, and P...
As a result, it said, of “customer feedback and evolving usage patterns,” Microsoft cut the price of its cloud-ified SQL Azure database 48%–75% for databases larger than 1GB and introduced a new entry-level 100MB model. It blogged that it’s noticed that many projects start small but ...
Wide and cheap availability of cloud-based media services is upon us. With the transformations these services are already bringing to the consumption of music, video and interactive media, change has likewise come to professional workflows. Documents in 2012 are read, written, collabor...
Centrify is going into the mobile business in support of iOS and Android phones and tablets. The move involves putting its multi-platform support for Microsoft’s Active Directory on its own cloud so companies can protect the increasing ubiquitous BYOD they need to control and secure ...
Sooner than expected, Apple Thursday started previewing a developer-directed beta of Mountain Lion, its next-generation Mac OS X 10.8, due out late this summer. It’s borrowed some more features from iOS like the popular and unlimited iChat-replacing iMessages IM as well as Notes, Gam...
Cloud is a shift from the focus on underlying technology implementation to leveraging existing implementations and further building upon them. Cloud orchestration or a network of clouds is the wave of the future where these clouds can operate with elasticity, scalability, and efficienc...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE