I am starting with Rails and I am wandering questions about Rails
possibilities. Actually, I want to design an application that has
particular needs and I would like to know wether Rails can do them. As I
am newbie with Rails, I ask you these questions.
Basically, it is possible to execute shell commands from a rails pages
(eg: I want to launch a c++ program)?
Can it define a drawing area? ( if I want to draw charts and so on ) ?
can we parse xml files?
Actually, my question is, can Rails the same thing that Ruby?
Rails is a framework built on top of the language Ruby. So yes, you can
do
with Rails what you can do with Ruby alone too. All of what you want to
achieve can be done in Ruby.
Basically, it is possible to execute shell commands from a rails pages
(eg: I want to launch a c++ program)?
yes, there are various ways of achieving this, one is to use the
“system()” method to execute shell commands.
Can it define a drawing area? ( if I want to draw charts and so on ) ?
Draw in what way? There are PDF plugins; Flash plugins; graphics
plugins; most obviously, the most common output is for web in HTML,
and I’ve drawn “charts” with CSS styling before.
can we parse xml files?
Yes, there are plugins/gems for that (as well as just doing it
manually line-by-line)
Actually, my question is, can Rails the same thing that Ruby?
Of course. Rails is ruby. It’s just a framework written in ruby.
Go to the “Rails guides” website, work through them, and you’ll get
yourself going in no time.
You could use imagemagik at the backend and draw through that, then
render
the generated image to the server. Normally you would do this client
side in
javascript with something like this www.highcharts.com/ or by using
this
api: Charts | Google for Developers
@Martin W., about charts, I would like to know if you can draw as
you can do in java for example, I mean defining a “canvas” then start
drawing in?
You are talking about gui programming. gui programs launch one
or more windows which can be programmed to contain buttons or other
controls with graphs.
ruby executes on the server, and then it sends an html page back to
the browser. Using gui programming to launch a window on the server
would be pointless–the client can’t see it.
The languages that execute in a browser are javascript and flash.
They can be used to produce charts, etc. in the main window or in pop-up
windows.
Web programming is an inter disciplinary task. To produce modern
looking websites, you need to know html, css, javascript or flash, and a
server side language like php, python, perl, or ruby.
Thanks, www.highcharts.com seems nice, but assuming I also need to draw
something different than a charts, something like shapes and so on? Is
there any possibilities with Rails to do it?
Actually I think what he means is to create a drawing surface in java,
write
on it and send it to the client either embedded in a data-uri or
through an
extra get request. This was a common technique in the .Net world to
create
images server side and it would probably work with jruby and java, but
even
if it does there are better ways to do this in the browser, like