Browser applications (applets, flash...) with Ruby?

F

francis.rammeloo

Howdy,

Is it possible to write applications in Ruby and let them run in an
internet browser, just like you could with applets or flash? Preferably
without the user having to install a special plug-in...

Has it been done? Would this be possible with JRuby?
I'd appreciate your insights a lot, please share them.

Kind regards,

Francis
 
R

Richard Conroy

Howdy,

Is it possible to write applications in Ruby and let them run in an
internet browser, just like you could with applets or flash? Preferably
without the user having to install a special plug-in...

Well you could host 'static content' flash and applets, and have them
referenced in your view templates. Not really the approach I would go
with (would use AJAX instead for rich content).
Has it been done? Would this be possible with JRuby?
I'd appreciate your insights a lot, please share them.

AFAIK there is no way to do this, unless there is some wierd
NET stuff where you can bundle up arbitrary code in something
that is browser runnable.
 
D

Daniel Baird

Howdy,

Is it possible to write applications in Ruby and let them run in an
internet browser, just like you could with applets or flash?
[..] Has it been done?

There's RJS in the Ruby on Rails framework, that converts your Ruby
code into Javascript, or something.

See what Google has to say.
 
L

Logan Capaldo

Howdy,

Is it possible to write applications in Ruby and let them run in an
internet browser, just like you could with applets or flash? Preferably
without the user having to install a special plug-in...
You would definitely need a special plugin, to directly run ruby on the
browser.
Has it been done? Would this be possible with JRuby?
I'd appreciate your insights a lot, please share them.
It might be possible with JRuby, if the browser has a JVM plugin and you
could send a verison of the JRuby interpreter down the pipe that would
be happy with the security restrictions on applets.

Another option is to try rb2js [1], which translates ruby into Javascript,
which can then of course be run in the browser.

[1] http://rb2js.rubyforge.org/
 
F

francis.rammeloo

Thank you all. I would like to write some games like Tetris and post
them on my website. It's a bit frustrating that I have no other choices
but Java and Flash. (Oh and yes I've seen a Tetris written in
Javascript, but it's still too limited I think.)

Do you think this will become easier in the future? Maybe there will be
a sort of universal VM for running browser applications and that all
programming languages can compile to. Is there anything going on that
points in that direction?

Thanks a lot again for sharing your thoughts.

Kind regards,
Francis
 
J

Jonas Hartmann

Thank you all. I would like to write some games like Tetris and post
them on my website. It's a bit frustrating that I have no other choices
but Java and Flash. (Oh and yes I've seen a Tetris written in
Javascript, but it's still too limited I think.)

Do you think this will become easier in the future? Maybe there will be
a sort of universal VM for running browser applications and that all
programming languages can compile to. Is there anything going on that
points in that direction?

Thanks a lot again for sharing your thoughts.

Kind regards,
Francis

While I am really a noob, I still think JavaScript is NOT to LIMITED.
JavaScript has a bad scent cause there are so many people with really
NO idea about programming that want "nifty" javascript on their
webpages ;-(.

While I dont like JavaScript very much, I think its a REAL language
you can do REAL things with. Maybe you can take a look at CANVAS in
Safari/Mozilla or SVG and use these tools with JS to write web
browser, client side, based games.

Good luck :)
 
R

Richard Conroy

Thank you all. I would like to write some games like Tetris and post
them on my website. It's a bit frustrating that I have no other choices
but Java and Flash. (Oh and yes I've seen a Tetris written in
Javascript, but it's still too limited I think.)

Well in those respects, your Java & Flash content is effectively static
content unless you are doing interesting things like recording high
scores.

For interactive content online, Java & flash are probably the primary
development languages. For games that don't require real-time
control you can probably use Rails + AJAX, and down the road
yuu might be able to use SVG too.
Do you think this will become easier in the future? Maybe there will be
a sort of universal VM for running browser applications and that all
programming languages can compile to. Is there anything going on that
points in that direction?

One True Language-ism is dead. While you could do some funky .NET
stuff to get One True Binary at least, it probably would be overkill.
 
D

Daniel Baird

While I am really a noob, I still think JavaScript is NOT to LIMITED.
JavaScript has a bad scent cause there are so many people with really
NO idea about programming that want "nifty" javascript on their
webpages ;-(.

While I dont like JavaScript very much, I think its a REAL language
you can do REAL things with. Maybe you can take a look at CANVAS in
Safari/Mozilla or SVG and use these tools with JS to write web
browser, client side, based games.

I agree that JavaScript is a real language.. I'd even go so far as to
say that you can do more in JavaScript that in Java.

But, graphical output is very difficult to do in a cross-browser way.
So JS is not that good for certain types of in-browser games.
 
B

Ben Nagy

Hi,

I was just wondering if anyone has any example implementations of stateful
network protocols with Eventmachine they'd be willing to share. The built in
documentation uses very simplistic examples and has a "we should add this"
reference to more complicated example code that might exist...

Cheers,

ben
 
F

Francis Cianfrocca

Hi,

I was just wondering if anyone has any example implementations of stateful
network protocols with Eventmachine they'd be willing to share. The built in
documentation uses very simplistic examples and has a "we should add this"
reference to more complicated example code that might exist...

Cheers,

ben

Hi Ben, if you sync to the latest version of the code from the
Rubyforge SCM, and look in version_0/lib/protocols, you'll find an
HTTP client implementation which is functionally incomplete but should
show you what you're looking for. This approach (essentially a
recursive-descent parser with the current parse-state stored in a
variable rather than on the call stack) may seem ugly, but it works
quite well for simple protocols. We've had some chatter lately on the
eventmachine list about using parser-generators for more intricate
protocols and some people have worked on this, but it's not ready yet.

If you'd like, please tell me what you're thinking of (feel free to do
so by private email) and I can perhaps suggest an alternative
approach. If you're implementing one ot the standard protocols, it
would be good to put it into the EM distro. Python's Twisted does
this, and EM eventually needs to have all the standards
out-of-the-box. The one I'm working on myself at the moment is AMQP.
 
J

Jonas Hartmann

Daniel said:
I agree that JavaScript is a real language.. I'd even go so far as to
say that you can do more in JavaScript that in Java.

But, graphical output is very difficult to do in a cross-browser way.
So JS is not that good for certain types of in-browser games.

If you do stuff on Bitmap basis. No.
And you can do that with <canvas> in a very speedy way afaik.
 
G

Guido Sohne

Is it possible to write applications in Ruby and let them run in an
internet browser, just like you could with applets or flash? Preferably
without the user having to install a special plug-in...

It depends on your goals. If you want everything in Ruby then you have
to use it on the server side and then it can generate all the content
that you want. I have used Rails as a 'launchpad' for a Javascript
application.

It really started as a Rails application, but I wanted to achieve two
things, the first was reducing the frequency of round trips, and to
eliminate session from the server, so that it can run from anywhere.

I have considered writing Ruby code that generates JavaScript but code
generators are not the road that I thought would be best. JavaScript
and Ruby can communicate with each other, as long as you can pass your
data around as JSON, or as URL parameters (say, for updates). RJS I
wouldn't say is a code generator, but rather it helps to orchestrate
various common scenarios for making the normal static content much
more interactive.

If you want to take this to the conclusion that I reached, then you
would write the application in Javascript and only rarely talk with
the server at which point it is no longer a Ruby application but a
JavaScript applications.

The division fell naturally into server side processing that does data
updates, fetches and validation (to get around the same origin
limitation) and the client represents the data directly as HTML
elements, or objects attached to these elements.

But what you are trying to do, I'd say that is what JavaScript was
created for. Rails comes with the prototype and scriptaculous
JavaScript libraries, which help to make your JavaScript idioms a bit
more Ruby like ...

See http://semaflickr.sohne.net if you want to see what I mean ...

-- G.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top