Apr 29 2007

Extending Apollo with Ruby using RubyAMF

Tag: Apollo, Flex, Ruby, RubyAMFDerek Wischusen @ 3:08 am

At the end of my last post about RubyAMF I mentioned that I was particularly interested in how it could be used to extend Apollo applications using Ruby in the same way that Artemis makes it possible to extend Apollo with Java.

Here’s why:

  • It enables AMF3 communication between Flex and Ruby.
  • It comes with its own webrick servlet, so deploying RubyAMF is dead simple (if you have Ruby installed).
  • It’s small: less than 300k. So it’s a quick download.

Here’s an example:

I put together a very simple demo app that uses RubyAMF to extend Apollo. I am calling the app Clairify (because everything needs a name). Clairify allows you to take a screenshot of whatever is underneath it, mark it up with some simple drawing tools and text boxes, and then save it to disk. The concept behind Clairify is that you could use it to quickly provide feedback on an application’s UI.

It would take several steps and downloads for many people to run the app, so I’ve put together a short video.

Here is a quick overview of what is going on in the video:

  1. I launch Clairify.
  2. When Clairify launches all you see are the controls. The rest of the app is transparent.
  3. I then bring up the interface that I want to capture (the login screen of my simple issue tracker).
  4. I click the capture button. This calls code in Ruby (see below) that captures the screen and saves the image to a PNG that Apollo loads.
  5. I add some comments to screen.
  6. I click save, which uses Apollo’s File API to save the marked up image to my desktop as PNG.
  7. I open up the PNG in Fireworks.

Click here to view the video.

If you want to take a look at the Apollo source code, click here. (If you really want to know how to run this on your own machine let me know and I will put together some instructions).

And, here is the Ruby code:

require 'win32screenshot'
require 'RMagick'
include Magick

class CaptureService
  def screenCapture
    width, height, bitmap = Win32::Screenshot.desktop
    img_lst = ImageList.new
    img_lst.from_blob(bitmap)
    img_lst.write('public/screen.png')
    true
  end
end

Credits:
Clairify is based on the ScreenPlay app that is avalable on Adobe Labs.


Apr 29 2007

RubyAMF – an open source AMF gateway for Flex/Flash remoting with Ruby

Tag: Flex, Rails, RubyAMF, weborbDerek Wischusen @ 3:08 am

RubyAMF is an open source Ruby application being developed by Aaron Smith that enables AMF0/3 communication between Flex/Flash and Ruby.

So, you might be asking yourself, how is this different from WebORB for Rails? Well, the main difference is in how the apps are architected. WebORB for Rails is built as Rails plugin. This makes it really easy to use WebORB for Rails with your Ruby on Rails applications. However, this means you need to use Rails if you want to use WebORB for Rails, even if you want to use it for an application that does require any Rails specific code.

RubyAMF, on the other hand, is designed to be integrated directly with a server and, as such, does not require Rails. It even comes with its own webrick servlet, which means that all you have to do to start RubyAMF is download it, point a command line to the root folder, and enter ruby server/start. This makes it dead simple to use RubyAMF to integrate Flex/Flash with a Ruby application. However, if you want to use RubyAMF with Rails then you are going to have to do a little extra work.

So, for right now my simple heuristic is that if you want to use AMF remoting with Rails, then use WebORB for Rails. If you want AMF remoting with just Ruby, then use RubyAMF. (I suppose the names make that kind of obvious).

That said, I think it would be relatively trivial to rearchitect either app to be like the other, but I think it is good that they are different. Choice is, generally, a good thing.

Right now the thing that has me most excited about RubyAMF is how it could potentially be used to extend Apollo using Ruby in much the same way that Artemis does using Java. More on this in my next post….


Apr 14 2007

The [Transient] and [Mixin] metadata tags

Tag: FlexDerek Wischusen @ 4:02 am

There are a couple useful metadata tags that are not particularly well documented in the Flex Livedocs that I have come across recently.

[Mixin]

The first is the [Mixin] metadata tag, which I saw a while back while reading about the RandomWalk component in the Flex docs for Creating Applications for Testing, but I never quite understood what it did until I came across this post by Adam Flater.

So, here is what it does: when you put the [Mixin] metadata just above your class definition and add a static init function to the class like so,

[Mixin]
public class Model
{
  public static function init (systemManager : ISystemManager)
  {
    trace ("I get called first")
  }
}

the static init function will be called as soon as your application loads (assuming this class is referenced somewhere in the app), much like static initialization blocks in Java, or static constructors in C#. This is useful if you have some code that you want to run before any of the other code in the class.

[Transient]

I just learned about this tag today from a comment by one the readers of this blog (thanks David).

The [Transient] tag is extremely useful for working with Value Objects because it allows you to tag properties that you do not want to send across the wire when the object is serialized.

For example,

package com.rxr.issuetracker.vo
{
  import com.adobe.cairngorm.vo.IValueObject;
  import mx.collections.ArrayCollection;
  [Bindable]
  [RemoteClass(alias="com.rxr.issuetracker.vo.Project")]
  public class ProjectVO implements IValueObject
  {
    private var _issues : ArrayCollection =  new ArrayCollection();

    public var id : int;

    public var user_id : int;

    public var title : String;

    [Transient]
    public function get issues () : ArrayCollection
    {
       return _issues;
    }

    public function set issues ( value : Array ) : void
    {
      _issues= new ArrayCollection(value);
    }
  }
}

Now when you send this ProjectVO across the wire to Rails (or PHP, ColdFusion, Java, .NET, etc) the issues ArrayCollection will not be sent with it.

As always, let me know if you have any questions or if any of this is unclear or incorrect. Also, please let me know if you know about any other useful metadata tags that are not included in the list on livedocs.


Discount viagra pills
Best way to buy viagra online
Cheap levitra uk
Levitra on sale
Order cheap phentermine
Prednisone tablets 10 mg
Viagra no prescription online
Valium 10 mg
Viagra online shop
Buy tramadol cod
Purchase phentermine
Cheap propecia without prescription
Purchase tramadol online
Cialis samples canada
Best levitra prices
Buy propecia cheap
Discount viagra online
Cheapest cialis professional
Brand name cialis
Buy phentermine 37.5mg pills
Phentermine 37.5mg
Buy valium europe
Cheapest cialis price
Buying tramadol in uk
2mg xanax no prescription
Prescription phentermine online
Tramadol medication
Phentermine without a prescription
Phentermine purchase online
Buying prednisone online
Overnight delivery viagra
Cheap levitra no prescription
Cialis cialis
Online prescriptions xanax
Genuine viagra online
Levitra online buy
Best price cialis
Buying cialis online without a prescription
Viagra tablets for sale
Viagra canadian online pharmacy
Tramadol prescription online
Buy cialis viagra
Generic xanax xr
Buy xanax overnight
Buy cialis in the uk
Buy generic xanax no prescription
Order tramadol online overnight
Buy viagra online uk no prescription
Buy viagra 100mg

Prescription viagra canada
Valium from india
Buying levitra without prescription
Valium drug side effects
Buy viagra uk no prescription
Prednisone tablets
Generic viagra 100mg
Buy tramadol hcl
Buy cialis uk
Prescription viagra uk
Ordering cialis online
Buy tramadol hydrochloride
Prescription free viagra
How to buy phentermine online
Phentermine hcl without prescription
Cheapest place to buy viagra online
Purchase viagra online without prescription
10mg valium effects
Cialis over the counter
Buy generic phentermine online
Cialis online canadian pharmacy
Low cost levitra
Buy generic cialis uk
Xanax bars side effects
Cialis medication
Cheap cialis pills
Viagra prescription cost
Propecia information
Valium no rx
Buy cheap valium online
Cheap cialis viagra
Generic xanax no prescription
Phentermine online uk
No prescription cialis online
Order xanax online
Cialis uk sales
Viagra pharmacy prices
Phentermine buy australia
Cheap viagra online without prescription
Buy generic propecia uk
Cheap xanax bars
Xanax generic dosage
Tramadol india
Cialis 20 mg dosage
Cheap generic valium
Viagra price canada
Xanax overnight cod
Cheap tramadol cod
Viagra in usa
Viagra ordering
Buy viagra online in ireland
Discount viagra india
Where can i buy viagra in the uk
Cialis 20mg side effects
2.5mg cialis
Xanax 1mg
Generic cialis overnight
Phentermine 37.5 pills
Buy phentermine 37.5mg online
Fedex tramadol
Viagra discount prices
Buying xanax online without prescription
Best price tramadol
Cialis 20mg
Levitra samples
Viagra cheap no prescription
Buy valium without prescription uk
Tramadol cheapest
Buy propecia online without a prescription
Purchase cialis without a prescription
Viagra to buy
Viagra without prescription uk
Cheap 100mg viagra
Viagra lowest prices
Ordering propecia from canada
Cheap xanax for sale
Where to buy viagra online
Order prednisone no prescription
Phentermine canada no prescription
Buy female viagra without prescription
Phentermine buy uk
Online valium without prescription
Phentermine 37.5 wholesale
Generic cialis uk
Buy xanax online without prescription
Valium online pharmacy
Australia viagra online
Order viagra without prescription
Where to buy viagra in england
Cheapest generic viagra online
Where to buy levitra online
How to buy valium without a prescription
Buy pfizer viagra without prescription
Purchase xanax
Buy tramadol overnight
Generic propecia
Online prescription tramadol
Buy phentermine no script
Levitra price
Buy viagra online cheap
Viagra canada mastercard
Where to buy propecia in canada
Cialis for sale
Levitra canada
Viagra pills for sale
Best prices for cialis
Prednisone 20mg side effects
Buy cheap viagra online uk
Propecia uk prices
Cialis side effects
Overnight xanax delivery
Viagra in france
Cheap generic viagra
Phentermine with no prescription
Cheap cialis india
Generic viagra super active
Propecia cost
Viagra india price
Order phentermine online no prescription
Buy xanax canada
Get viagra prescription
Tramadol cod delivery
Best price on phentermine
Cialis canada no prescription
Phentermine 37.5 mg
Purchase phentermine without prescription
Prednisone 40 mg
Levitra us
Get tramadol prescription
Xanax with no prescription
Cost of viagra 50mg
Viagra in the philippines
Prescription valium
Cheap valium online
Mail order phentermine
Brand viagra cheap
Xanax no rx
Buy valium cheap online
Viagra online purchase in india
Buy viagra australia
Best viagra dose
40 mg prednisone side effects
Buy phentermine no rx
Drug phentermine
Where to buy cialis without prescription
Viagra purchase uk
Prescription propecia
Viagra 50mg side effects
Canada viagra
Viagra professional online
Australia viagra prescription
Tramadol dosage
Propecia uk pharmacy
Blood pressure and prednisone
Free cialis online
Pfizer viagra price
Buy valium no rx
Buy generic cialis online
Xanax price per pill
Phentermine 37.5mg side effects
Buying viagra in london
Xanax buy uk
Cialis prices uk
Cialis prescription cost
Cheap 37 5 phentermine
Valium pill 10mg
Xanax no prescription overnight
Viagra buy online no prescription
Get viagra
Free samples of cialis
Generic xanax
Buy xanax cheap online
Generic levitra uk
Cheap phentermine without prescription
Buy brand name viagra
Phentermine 37.5 buy online
Buy viagra in england
Prednisone online
Levitra 20mg
Tramadol no prescription required
Xanax bars effects
Order tramadol cod
Valium without prescription uk
100mg tramadol effects
Propecia generic online
Viagra generic
Buy cialis online from canada
Viagra generic cheap
Phentermine hcl no prescription
Generic viagra online without prescription
Cialis order canada
Authentic phentermine 37.5
Viagra express delivery
Cheap tramadol overnight delivery
Discount viagra usa
Viagra sale uk
Free cialis samples
No prescription valium
Buying cialis
Propecia generic cost