Flex UI + XML RPC backend?

8 views
Skip to first unread message

paul

unread,
Jun 20, 2007, 11:02:03 AM6/20/07
to New Haven Ruby Brigade
Bruce Eckels (Flex cheerleader) has an article on how easy it is to
put a Flex UI in front of an xml-rpc backend. He uses a Python xml
rpc server, but you can easily throw together a Ruby one like this:

require "xmlrpc/server"

s = XMLRPC::Server.new(8080)

s.add_handler("reverse") do |s|
s.reverse
end

s.add_handler("scramble") do |s|
s.split(//).sort{rand}.join
end

s.set_default_handler do |name, *args|
raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
" or wrong number of parameters!")
end

s.serve

I am having trouble finding the free and open Flex SDK (not sure it
exists yet), but Flex/Appollo/AIR might make a nice UI for a Ruby
application.

Regards,

Paul.

paul

unread,
Jun 20, 2007, 11:03:00 AM6/20/07
to New Haven Ruby Brigade

Dan Bernier

unread,
Jun 20, 2007, 11:25:34 AM6/20/07
to New-Haven-R...@googlegroups.com
That sounds interesting! From your example, it'd probably be easy to
add something like attr_reader, so you can make an Application object,
and "publish" certain methods to the GUI.

module FlexXmlRpcApp
def self.publish(*methods)
instance_variable_set '@s', XMLRPC::Server.new(8080)
methods.each do |m|
@s.add_handler(m.to_s) do
self.send m
end
end
end
end

class MyApp
include FlexXmlRpcApp
def foo

end

I wrote that all within the Gmail window, so no promises... =)

Although it's kind of sad that we resort to XMLRPC for a fat client
GUI (unless I'm misunderstanding).


--
For building invisible machines...
http://invisibleblocks.wordpress.com

Dan Bernier

unread,
Jun 20, 2007, 11:26:47 AM6/20/07
to New-Haven-R...@googlegroups.com
D'oh! Hit "send" early. That 'MyApp' class should look like this:

class MyApp
include FlexXmlRpcApp
publish :foo

def foo
'foo'
end
end

paul

unread,
Jun 20, 2007, 11:35:54 AM6/20/07
to New Haven Ruby Brigade

On Jun 20, 11:25 am, "Dan Bernier" <danbern...@gmail.com> wrote:
> That sounds interesting! From your example, it'd probably be easy to
> add something like attr_reader, so you can make an Application object,
> and "publish" certain methods to the GUI.
>
> module FlexXmlRpcApp
> def self.publish(*methods)
> instance_variable_set '@s', XMLRPC::Server.new(8080)
> methods.each do |m|
> @s.add_handler(m.to_s) do
> self.send m
> end
> end
> end
> end
>
> class MyApp
> include FlexXmlRpcApp
> def foo
>
> end
>
> I wrote that all within the Gmail window, so no promises... =)
>
> Although it's kind of sad that we resort to XMLRPC for a fat client
> GUI (unless I'm misunderstanding).
>

Right, it is *very* easy to put together an xml-rpc server to expose
your ruby functionality and it works. This could be used for a Fat
Client or just for a desktop application. It looks like a reasonably
easy way to put a nice-looking GUI on your Ruby as an alternative to,
say, writing a Camping application just to get a GUI.

Regards,

Paul.

Dan Bernier

unread,
Jun 20, 2007, 11:42:22 AM6/20/07
to New-Haven-R...@googlegroups.com
On 6/20/07, paul <nov...@gmail.com> wrote:
>
>
>

If you find more info on the Flex thing, let me know. This could be
the trojan horse for Ruby at my company... =)

Gregory Brown

unread,
Jun 20, 2007, 12:08:58 PM6/20/07
to New-Haven-R...@googlegroups.com
On 6/20/07, Dan Bernier <danbe...@gmail.com> wrote:

> If you find more info on the Flex thing, let me know. This could be
> the trojan horse for Ruby at my company... =)

Do we have anything planned for the July meeting? I'd love to see a
presentation on this or at least get together and hack around on it.
I don't have free cycles this month to prepare a talk myself, but it's
definitely an interesting topic,

paul

unread,
Jun 20, 2007, 1:21:07 PM6/20/07
to New Haven Ruby Brigade

On Jun 20, 12:08 pm, "Gregory Brown" <gregory.t.br...@gmail.com>
wrote:

Good idea, we should have room for it. AFAIK, we had planned for Gary
to give us a RailsConf report.

July 11th is the 'second Wednesday'. Can we get a room at UNH again?

Regards,

Paul.


paul

unread,
Jun 20, 2007, 1:31:08 PM6/20/07
to New Haven Ruby Brigade

On Jun 20, 12:08 pm, "Gregory Brown" <gregory.t.br...@gmail.com>
wrote:

> On 6/20/07, Dan Bernier <danbern...@gmail.com> wrote:
>
> > If you find more info on the Flex thing, let me know. This could be
> > the trojan horse for Ruby at my company... =)

Surely you don't intend to suggest that Ruby is malware?
http://en.wikipedia.org/wiki/Trojan_horse_%28computing%29
;)

Regards,

Paul

Gregory Brown

unread,
Jun 20, 2007, 3:39:06 PM6/20/07
to New-Haven-R...@googlegroups.com
On 6/20/07, paul <nov...@gmail.com> wrote:

> July 11th is the 'second Wednesday'. Can we get a room at UNH again?

I can ask about it, though reserving it last time was a bit of a
hassle. Do we have other options? If not, let me know, and I'll put
in for the room.

Dan Bernier

unread,
Jun 20, 2007, 3:42:55 PM6/20/07
to New-Haven-R...@googlegroups.com
Maybe I should call it "Ruby's gelcap"...something to make it go down
more smoothly. =)

On 6/20/07, paul <nov...@gmail.com> wrote:
>
>
>

paul

unread,
Jun 21, 2007, 10:08:46 AM6/21/07
to New Haven Ruby Brigade

On Jun 20, 3:42 pm, "Dan Bernier" <danbern...@gmail.com> wrote:
> Maybe I should call it "Ruby's gelcap"...something to make it go down
> more smoothly. =)
>

> On 6/20/07, paul <nova...@gmail.com> wrote:
>
>
>
>
>
> > On Jun 20, 12:08 pm, "Gregory Brown" <gregory.t.br...@gmail.com>
> > wrote:
> > > On 6/20/07, Dan Bernier <danbern...@gmail.com> wrote:
>
> > > > If you find more info on the Flex thing, let me know. This could be
> > > > the trojan horse for Ruby at my company... =)
> > Surely you don't intend to suggest that Ruby is malware?
> >http://en.wikipedia.org/wiki/Trojan_horse_%28computing%29
> > ;)
>
> > Regards,
>
> > Paul
>
> --
> For building invisible machines...http://invisibleblocks.wordpress.com

I found where you can get the (freebeer, no sign-on required) Flex 2.0
SDK http://www.adobe.com/products/flex/downloads/

The AIR (formerly Apollo, the runtime that runs on the desktop and
outside the browser) is available here: http://labs.adobe.com/downloads/air.html
There are OSX and Windows version, Linux is promised. It is a small
download (if you already have Flash 9.0 installed).

You can also download a trial version of Flex 3.0 alpha and "Flex
Builder" the Ecplise plugin that gives you an IDE for all of the
above, but they are not (beer)free and Flex Builder is not going to be
free

Regards,

Paul.


Gregory Brown

unread,
Jun 21, 2007, 10:12:06 AM6/21/07
to New-Haven-R...@googlegroups.com
On 6/21/07, paul <nov...@gmail.com> wrote:
>
>
>
> On Jun 20, 3:42 pm, "Dan Bernier" <danbern...@gmail.com> wrote:
> > Maybe I should call it "Ruby's gelcap"...something to make it go down
> > more smoothly. =)
> >
> > On 6/20/07, paul <nova...@gmail.com> wrote:
> >
> >
> >
> >
> >
> > > On Jun 20, 12:08 pm, "Gregory Brown" <gregory.t.br...@gmail.com>
> > > wrote:
> > > > On 6/20/07, Dan Bernier <danbern...@gmail.com> wrote:
> >
> > > > > If you find more info on the Flex thing, let me know. This could be
> > > > > the trojan horse for Ruby at my company... =)
> > > Surely you don't intend to suggest that Ruby is malware?
> > >http://en.wikipedia.org/wiki/Trojan_horse_%28computing%29
> > > ;)
> >
> > > Regards,
> >
> > > Paul
> >
> > --
> > For building invisible machines...http://invisibleblocks.wordpress.com
>
> I found where you can get the (freebeer, no sign-on required) Flex 2.0
> SDK http://www.adobe.com/products/flex/downloads/
>
> The AIR (formerly Apollo, the runtime that runs on the desktop and
> outside the browser) is available here: http://labs.adobe.com/downloads/air.html
> There are OSX and Windows version, Linux is promised. It is a small
> download (if you already have Flash 9.0 installed).

^ unless of course, you're on x86_64, which is half of the reason to
use GNU/Linux. :-/
(for me)

But i guess where you'd need a GUI mainly is OS X and Windows, so that
sounds neat.

paul

unread,
Jun 21, 2007, 10:16:03 AM6/21/07
to New Haven Ruby Brigade

On Jun 21, 10:12 am, "Gregory Brown" <gregory.t.br...@gmail.com>
wrote:


> On 6/21/07, paul <nova...@gmail.com> wrote:
>
>
>
>
>
> > On Jun 20, 3:42 pm, "Dan Bernier" <danbern...@gmail.com> wrote:
> > > Maybe I should call it "Ruby's gelcap"...something to make it go down
> > > more smoothly. =)
>
> > > On 6/20/07, paul <nova...@gmail.com> wrote:
>
> > > > On Jun 20, 12:08 pm, "Gregory Brown" <gregory.t.br...@gmail.com>
> > > > wrote:
> > > > > On 6/20/07, Dan Bernier <danbern...@gmail.com> wrote:
>
> > > > > > If you find more info on the Flex thing, let me know. This could be
> > > > > > the trojan horse for Ruby at my company... =)
> > > > Surely you don't intend to suggest that Ruby is malware?
> > > >http://en.wikipedia.org/wiki/Trojan_horse_%28computing%29
> > > > ;)
>
> > > > Regards,
>
> > > > Paul
>
> > > --
> > > For building invisible machines...http://invisibleblocks.wordpress.com
>
> > I found where you can get the (freebeer, no sign-on required) Flex 2.0

> > SDKhttp://www.adobe.com/products/flex/downloads/


>
> > The AIR (formerly Apollo, the runtime that runs on the desktop and
> > outside the browser) is available here: http://labs.adobe.com/downloads/air.html
> > There are OSX and Windows version, Linux is promised. It is a small
> > download (if you already have Flash 9.0 installed).
>
> ^ unless of course, you're on x86_64, which is half of the reason to
> use GNU/Linux. :-/
> (for me)
>
> But i guess where you'd need a GUI mainly is OS X and Windows, so that
> sounds neat.

Yeah, depends on your target audience. For a Corp. environment, that
is probably enough.

paul

unread,
Jun 22, 2007, 10:07:06 AM6/22/07
to New Haven Ruby Brigade

paul

unread,
Jun 26, 2007, 4:01:59 PM6/26/07
to New Haven Ruby Brigade

On Jun 22, 10:07 am, paul <nova...@gmail.com> wrote:
> Now there is a video: http://www.adobe.com/devnet/flex/articles/eckel_video.html
>

Here is another video of Bruce Eckel and James Ward building a Flex
front end to a RESTful back end [0]. They are using TurboGears, but
it could just as easily been Rails or Camping:

This gives a better idea of what is involved in using Flex and
ActionScript. I like the REST approach better than xml-rpc too.

Regards,

Paul.

[0] http://www.adobe.com/devnet/flex/articles/eckel_video.html

Reply all
Reply to author
Forward
0 new messages