Hi,
I am new to this forum. so forgive me if my post replicating old post.
Ok I have a ruby script with xml input file. ruby script extract
required info from xml file and present in html output with help of
nokogiri lib.
Ruby script is working fine. right now, we need to install ruby and
nokogiri on all machines to run ruby script. I want to put it like a
website. so i configured apache over my ubuntu machine. its working
fine. i can access index page on server from all machines.
What i want?
I want to design html page with form tag like:
<form action="server address"
enctype="multipart/form-data" method="post">
<p>
Please specify a file<br>
<input type="file" name="datafile" size="40">
</p>
<div>
<input type="submit" value="Send">
</div>
</form
So whenever user select xml file and press send. input file should go to
ruby script on server and html output will be generated. user get output
over his/her browser. I dont know how to do it :( i am trying to figure
it out.
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Rajesh
|
11/29/2010 2:49:36 PM |
|
[Note: parts of this message were removed to make it a legal post.]
You'll want to check out one of the many Ruby web frameworks. If all you
want is something simple like this, I'd suggest using Sinatra:
http://sinatrarb.com/
Since you're using Apache, I'd suggest phusion passenger to get it talking
with Sinatra: http://www.modrails.com/
|
|
0
|
|
|
|
Reply
|
Steve
|
11/29/2010 3:40:36 PM
|
|
Steve Klabnik wrote in post #964767:
> You'll want to check out one of the many Ruby web frameworks. If all you
> want is something simple like this, I'd suggest using Sinatra:
> http://sinatrarb.com/
>
> Since you're using Apache, I'd suggest phusion passenger to get it
> talking
> with Sinatra: http://www.modrails.com/
this looks quite complicated to me :(
is there any way, i can just invoke ruby script on server side?
Also, how i can feed input tag of form as input to my ruby script?
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Rajesh
|
12/1/2010 9:34:49 AM
|
|
[Note: parts of this message were removed to make it a legal post.]
On Wed, Dec 1, 2010 at 9:34 AM, Rajesh Huria <rajesh.huria@gmail.com> wrote:
> Steve Klabnik wrote in post #964767:
> > You'll want to check out one of the many Ruby web frameworks. If all you
> > want is something simple like this, I'd suggest using Sinatra:
> > http://sinatrarb.com/
> >
> > Since you're using Apache, I'd suggest phusion passenger to get it
> > talking
> > with Sinatra: http://www.modrails.com/
>
> this looks quite complicated to me :(
> is there any way, i can just invoke ruby script on server side?
>
You mean using CGI? Its possible. You will need to configure your web server
for it. Its slow though.
> Also, how i can feed input tag of form as input to my ruby script?
>
Check out the ruby CGI library. I would guess that is a good starting point
for what you want to achieve.
http://ruby-doc.org/core/classes/CGI.html
For something simple, you really cant beat Sinatra. It is not typical to
make Ruby web programs just using CGI, or have PHP-like deployment.
--
http://richardconroy.blogspot.com | http://twitter.com/RichardConroy
|
|
0
|
|
|
|
Reply
|
Richard
|
12/1/2010 10:20:50 AM
|
|
On 2010-12-01, at 4:34 AM, Rajesh Huria wrote:
> Steve Klabnik wrote in post #964767:
>> You'll want to check out one of the many Ruby web frameworks. If all you
>> want is something simple like this, I'd suggest using Sinatra:
>> http://sinatrarb.com/
>>
>> Since you're using Apache, I'd suggest phusion passenger to get it
>> talking
>> with Sinatra: http://www.modrails.com/
>
> this looks quite complicated to me :(
If you can configure Apache, you're going to find this easy :-)
Have a look at the sinatra book:
http://sinatra-book.gittr.com/
or this video:
http://rubyconf2008.confreaks.com/lightweight-web-services.html
> is there any way, i can just invoke ruby script on server side?
> Also, how i can feed input tag of form as input to my ruby script?
All that is covered in both of those links.
Cheers,
Bob
>
> --
> Posted via http://www.ruby-forum.com/.
>
----
Bob Hutchison
Recursive Design Inc.
http://www.recursive.ca/
weblog: http://xampl.com/so
|
|
0
|
|
|
|
Reply
|
Bob
|
12/1/2010 1:59:54 PM
|
|
Ok guys, thnx for the answers.. i am freaked out with all experiments :)
here is the code snipshots:
index.php:
<html><body>
<form action="upload.php" enctype="multipart/form-data" method="post">
<p>
Please specify a file to Parse:<br>
<input type="file" name="file" id="file">
</p>
<div>
<input type="submit" value="Parse">
</div>
</form>
</body>
</html>
upload.php:
<?php
if (//some check)
{
//some code
}
else
{
//some code
system('ruby -v'); // This is giving proper output i.e ruby version
system('ruby myprogram.rb'); // no action
}
?>
myprogram.rb is executing fine over shell but when i try to execute via
upload.php, nothing is happening. Any idea why ruby not working on
server side when accessing via upload.php ?
do i need to do anything on apache side?
i dont have any ruby handler installed on apache? is this could be the
reason?
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Rajesh
|
12/6/2010 6:10:37 PM
|
|
do user will have a possibilty to pass any parameters to system() call ?
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Eugeni
|
12/6/2010 10:32:39 PM
|
|
Chad Perrin wrote in post #966635:
> On Tue, Dec 07, 2010 at 03:10:37AM +0900, Rajesh Huria wrote:
>>
>> system('ruby -v'); // This is giving proper output i.e ruby version
>> system('ruby myprogram.rb'); // no action
>>
>> myprogram.rb is executing fine over shell but when i try to execute via
>> upload.php, nothing is happening. Any idea why ruby not working on
>> server side when accessing via upload.php ?
>
> I suspect you are having some path issues. The PHP script probably
> isn't
> "aware" of how to find the myprogram.rb script. Try using the full path
> to the Ruby script there.
I checked with getcwd(); // current working directory on server
In this case, myprogram.rb lies in same directory as current working
directory. do you think, its still path problem?
> Then . . . assuming that works, you might want to look into how you can
> make path handling a little more robust and flexible. First step, of
> course, is just making sure that the Ruby program will work in this
> context, and you should be able to do it with something like:
>
> system('ruby /absolute/path/to/myprogram.rb');
>
>
>>
>> do i need to do anything on apache side?
>
> It's probably related to the execution context of your PHP script (what
> it "thinks" is its current working directory) and the location of your
> Ruby program.
current working directory and location of ruby program is same
>> i dont have any ruby handler installed on apache? is this could be the
>> reason?
>
> That should not affect the execution of a Ruby script via PHP's system()
> function, as far as I'm aware.
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Rajesh
|
12/6/2010 10:37:01 PM
|
|
Eugeni Akmuradov wrote in post #966675:
> do user will have a possibilty to pass any parameters to system() call ?
system takes all linux commands with options. i am not sure about
parameters :(
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Rajesh
|
12/6/2010 10:38:29 PM
|
|
[Note: parts of this message were removed to make it a legal post.]
Good Afternoon,
Can I ask the stupid question? Why not recode the ruby script in PHP if you
are unwilling to do this the right way and use something along the lines of
Sinatra et al.?
John
|
|
0
|
|
|
|
Reply
|
John
|
12/6/2010 11:03:09 PM
|
|
John W Higgins wrote in post #966680:
> Good Afternoon,
>
> Can I ask the stupid question? Why not recode the ruby script in PHP if
> you
> are unwilling to do this the right way and use something along the lines
> of
> Sinatra et al.?
>
> John
because ruby script use some library(nokogiri) which is not so easy to
recode in php :)
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Rajesh
|
12/7/2010 12:24:36 AM
|
|
thnx for all replied.. problem is solved.. we did not installed anything
extra.. no sintara nothing.. just put everything in home directory for
apache. its working fine.
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Rajesh
|
12/7/2010 1:33:29 PM
|
|
|
11 Replies
244 Views
(page loaded in 0.166 seconds)
Similiar Articles: socket programming...lsof? - comp.lang.rubyHi All, Is there a ruby substitute for lsof's functionality ... there is no server side! -- Posted via http://www.ruby-forum.com/. JAX-WS - Turning on outgoing SOAP headers for client - comp.lang ...JAX-WS Client - comp.lang.java.programmer ruby on server side - comp.lang.ruby JAX-WS - Turning on outgoing SOAP headers for client - comp.lang ... ruby on server side ... ruby des encrypt - comp.lang.ruby... lang.python ... ruby des encrypt - comp.lang.ruby... smime speed spkac verify ... lang.ruby Create a Cipher ... raw level, RSA encryption ... tomys des ... server side ... Cannot access PIX 501 PDM - comp.dcom.sys.ciscoVPN connection from one Pix 506 to several Pix 501 ... is there a neat way to fix this in the PDM (3 ... lang.ruby The problem exists if you cant access the server side ... Re: How to disconnect client from Server forcefully - comp ...Requirement is that diconnect should be done from the server side. Actually I tried to ... SoLVED Re: rest-client headers or cookies - comp.lang.ruby ... The secret sauce ... Difference between community and standard edition - comp.databases ...I get paid for designing his DB, writing client and server side code and installing everything on his server. Am I OK with the community edition? Sending a keep alive signal to remote terminal - comp.os.linux ...> The problem exists if you cant access the server side stuff. On a normal telnet type ... Net::Telnet - How to send keystrokes like ESC - comp.lang.ruby ... Sending a keep ... JAX-WS Client - comp.lang.java.programmerWhat happens on the > service and the client side ... I am using the mini HTTP server in JAX-WS that ships with ... Re: rest-client headers or cookies - comp.lang.ruby ... PervasiveSQL 9.1 unable to create a database - comp.databases ...... from a workstation? > - If workstation, have you entered the server name into the name space > (left side ... Mysql2::Error: Can't create database - comp.lang.ruby... on ... PIX, PPTP and static NAT? - comp.dcom.sys.ciscoHi, I've run into a bit of a problem, I hope someone with more PIX experience then myself can help out. Situation: A small LAN (about 20 PCs, file server, 2 or 3 ... IBM COBOL Migration to Windows COBOL - comp.lang.cobol... to Shell Script or some scripting language, like Perl, Python, REXX, Ruby. ... ISAPI and access ISAM data, but there is NO COMPARISON to using ASP.NET, server side ... How to convert data with different charsets into other databases ...... to be sure the values are the same from each side of ... transfer GBK into UTF-8 in csv file - comp.lang.ruby How ... SQL alteration - comp.databases.oracle.server How to ... reset iostat -e error counters - comp.unix.solarisHardware: V240 server with SCSI ... Pix: Initiate VPN on one side only... - comp.dcom.sys.cisco ... vpn client install error 1304:....verify you have access - comp ... ruby on ... Kamasutra Full B-Grade Movie With Nudity Must See (1 Hour 50 Min ...comp lang ruby (4545) comp soft-sys sas (4424) ... comp databases oracle server (785) comp lang python ... in that website on Right side below search box click on ... yahoo pop: how can I download Sent messages? - comp.mail.misc ...YPOPS! is a little server which 'speaks' HTTP on the Yahoo! Mail side (i.e. to Yahoo! ... How to open file dialog in Ruby, and get open FileName ... Ruby: client-side or server-side? - Stack OverflowRuby is an all-purpose script/programming language which can be executed on both client and server environments. As client-side, you can use it to create a GUI ... Server-side scripting - Wikipedia, the free encyclopediaServer-side scripting was first used in early 1995 by Fred DuFresne while developing the ... Ruby, e.g. Ruby on Rails (*.rb, *.rbw) SMX (*.smx) Lasso (*.lasso) WebDNA (*.dna,*.tpl) 7/25/2012 12:17:01 AM
|