Register Now!
Save $200
Register before October 17th to SAVE! ... and also receive a FREE copy of the Best-Selling AJAX Book, a $119 Value!
Untitled Document
2008 East
Platinum Sponsor
Untitled Document
2008 East Gold Sponsors
Untitled Document
2008 East Exhibitors
Untitled Document
2008 East Media Sponsors
Untitled Document
2008 Association Sponsor
2007 West Sponsors Conference Directory
2007 East Sponsors
Untitled Document
2008 SYS-CON Events

Can't Miss RSS Feed
Subscribe to the RSS Feed & Get All The Conference News As It Happens!

2008: Decision Year for RIAs - October 20-22, 2008 San Jose

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
  • 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.


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.


links: digg this 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

Latest AJAXWorld RIA Stories
Containers and Kubernetes allow for code portability across on-premise VMs, bare metal, or multiple cloud provider environments. Yet, despite this portability promise, developers may include configuration and application definitions that constrain or even eliminate application po...
Enterprises are striving to become digital businesses for differentiated innovation and customer-centricity. Traditionally, they focused on digitizing processes and paper workflow. To be a disruptor and compete against new players, they need to gain insight into business data and...
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing sm...
DXWorldEXPO LLC announced today that Ed Featherston has been named the "Tech Chair" of "FinTechEXPO - New York Blockchain Event" of CloudEXPO's 10-Year Anniversary Event which will take place on November 12-13, 2018 in New York City. CloudEXPO | DXWorldEXPO New York will present ...
Chris Matthieu is the President & CEO of Computes, inc. He brings 30 years of experience in development and launches of disruptive technologies to create new market opportunities as well as enhance enterprise product portfolios with emerging technologies. His most recent venture ...
Untitled Document

Call 201 802-3020 or Click Here to Save $200!

Register Today and
Save $200

Your registrations includes: Golden Pass Delegates will receive full conference access on October 20-22, 2008 including: Lunch and Coffee Breaks, Collectible Bag and Archives of all sessions on DVD. Includes access to all Conference Sessions including the Technical Sessions, Exhibits, Keynotes, Vendor Technology Presentations, and Power Panels.

Sponsorship Opportunities

AJAXWorld offers the undisputed best platform to position your company as a leading vendor in the fast-emerging marketplace for AJAX and Enterprise Web 2.0.

Please call

Who Should Attend?

 CTOs & VPs of Engineering
 Directors of Technology
 Sr. User Interface Architects
 Front-End Engineers
 VCs & Industry Analysts
 Directors of Business Development
 Software Engineers
 Senior Architects
 Application Programmers & Software Developers
 Project Managers
 Web Programmers & Designers
 Companies & Organizations that need to stay in
  front of the latest Web technology

AJAXWorld Security Bootcamp

Introducing at AJAXWorld RIA Conference 2008 West the world's first-ever full, one-day immersive "AJAX Security Bootcamp" - led by one of the world's foremost AJAX security experts and teachers, HP's Billy Hoffman.

View the full one-day schedule

AJAXWorld 2008 West - Tracks

Track 01: Enterprise RIAs
Track 02: Frameworks & Toolkits
Track 03: Web 2.0 & Mashups
Track 04: Hot Topics
Track 05: The Future of the Web
Track 06: iPhone Developer Summit

Brought To You By:

AJAXWorld Magazine is the pre-eminent independent vendor-neutral resource for the fastest growing new segment of the software business: entirely Web-based applications and experiences.

Download the Latest Issue!

AJAXWorld Webcasts


AJAXWorld Keynotes & Power Panels

2008 SYS-CON TV Keynotes: Can We Fix the Web? By Douglas Crockford - by Douglas Crockford
2008 SYS-CON TV Keynotes: 2008: The Year of the RIA - by Anthony Franco
2008 SYS-CON TV Power Panel: The Business Value of RIAs
2008 SYS-CON TV Power Panel: What Lies Beyond AJAX
2007 SYS-CON TV Keynotes: Why Web 2.0 for the Enterprise Is Far More Than Just a Facelift - by Ted Farrell
2007 SYS-CON TV Keynotes: Fueling the Next Generation Web: A Peek Behind the Green Curtain - by Bob Brewin
2007 SYS-CON TV Keynotes: AJAX in the Balance - by Joe Stagner

AJAXWorld Sessions on SYS-CON.TV

· Bill Scott - Yahoo! UI Library
· David Heinemeier Hansson - AJAX on Rails
· Jesse James Garrett - Elements of User Experience
· Dion Hinchcliffe - Real World AJAX
· Eric Miraglia - Open Source AJAX Development
· Paul Rademacher - Mashing Up Your Web Application
· Adam Sah - Google Gadgets
· Doug Crockford - An Introduction to JavaScript
· David Linthicum - Enterprise Web 2.0
· Patrick Grady - The Imagination & Experience Web

AJAXWorld...All The AJAX Rock Stars in One Spot!

Past Events Archive

SOAWorld Conference & Expo 2008 East
Virtualization Conference & Expo 2008 East
AJAXWorld 2008 Conference & Expo East
SOAWorld Conference & Expo 2007 West
Virtualization Conference & Expo 2007 West
AJAXWorld 2007 Conference & Expo West
SOAWorld Conference & Expo 2007 East
Virtualization Conference & Expo 2007 East
AJAXWorld 2007 Conference & Expo East
Other SYS-CON Events

Join Over 10,000 Early AJAX Adopters
Who Have Attended AJAXWorld
• A&R Edelman
• Academic Enterprise
• Accoona Corp [2 delegates]
• Acxiom
• Adams Capital Management
• Adaptive Edge
• Adaptive Path
• Adobe Systems Incorporated [21 delegates]
• Adobe Systems Romania
• Ajax13
• All Risks, Ltd.
• alliance
• Alliance For Community Care
• AlphaDetail Inc
• Altera Corporation
• [6 delegates]
• Appeon Corporation [2 delegates]
• Apple Computer [5 delegates]
• Apress [3 delegates]
• Arkivio
• Astute Solutions
• Avaya Inc [2 delegates]
• Avenda Systems
• Avenue A | Razorfish [3 delegates]
• Axcella, LLC [2 delegates]
• Aximsoft
• Azimyth
• Backbase USA Inc. [4 delegates]
• BAE Systems [2 delegates]
• Bank of America [2 delegates]
• Barkley Evergreen & Partners Interactive
• Bayview Financial [2 delegates]
• BEA Systems [3 delegates]
• Billeo
• BMC Software, Inc. [2 delegates]
• Borland Software Corporation
• Bradford Technologies, Inc [2 delegates]
• Brilliance
• Brocade Communications Systems, Inc. [2 delegates]
• Brookside Capital LLC
• Brulant
• Bungee Labs, Inc [6 delegates]
• Bureau of Labor Statistics
• BUZ Interactive
• Cadena Software
• Calix Networks
• Callidus Software [2 delegates]
• Cambia Security
• Carnegie Mellon West
• Cautella, Inc.
• Celequest [3 delegates]
• Change Vision, Inc.
• Charles E. Kenney, CPA
• Charles Schwab & Co., Inc. [8 delegates]



.NET Developer's Journal - .NETDJ   |   ColdFusion Developer's Journal - CFDJ   |   Eclipse Developer's Journal - EDJ   |   Enterprise Open Source Magazine - EOS
Open Web Developer's Journal - OPEN WEB   |   iPhone Developer's Journal - iPHONE   |   Virtualization - Virtualization   |   Java Developer's Journal - JDJ   |
PowerBuilder Developer's Journal - PBDJ   |   SEO / SEM Journal - SJ   |   SOAWorld Magazine - SOAWM   |   IT Solutions Guide - ITSG   |   Symbian Developer's Journal - SDJ
WebLogic Developer's Journal - WLDJ   |   WebSphere Journal - WJ   |   Wireless Business & Technology - WBT   |   XML-Journal - XMLJ   |   Internet Video - iTV
Flex Developer's Journal - Flex   |   AJAXWorld Magazine - AWM   |   Silverlight Developer's Journal - SLDJ   |   |   Web 2.0 Journal - WEB2

SYS-CON EVENTS  |  AJAXWorld Conference & Expo  |  iPhone Developer Summit  |  OpenWeb Developer Summit  |  SOA World Conference & Expo  |  Virtualization Conference & Expo
INTERNATIONAL SITES:   India  |  U.K.  |  Canada  |  Germany  |  France  |  Australia  |  Italy  |  Spain  |  Netherlands  |  Brazil  |  Belgium
 Terms of Use & Our Privacy Statement     About Newsfeeds / Video Feeds
Copyright ©1994-2008 SYS-CON Publications, Inc. All Rights Reserved. All marks are trademarks of SYS-CON Media.
Reproduction in whole or in part in any form or medium without express written permission of SYS-CON Publications, Inc. is prohibited.