[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

pass def to eval

Adam Hurlburt

10/27/2008 10:57:00 PM

Hello,

My plan is to have a ruby class with a variety of functions in it and I
want to be able to call functions from this class using AJAX. I think
the easiest way to do this then is to pass a cgi parameter named
function or soemthing with the value being the def I wish to call.

So something like this

// this contained in test.rb

def test(x)
print x
end

from .js file

url = test.rb?action=test('help');
xmlObject.open("get",url,true)
xmlObject.send

anyway something like that and then in test.rb I want to have something
like

if params.has_key?("action")
eval(params["action"])
end

and hopefully it would return "help". Please let me know if this is the
best way to do this and also if I am being unclear I am more than happy
to clarify.

I have tried something like the above technique and nothing is being
returned to the XmlObject.

Thank you
--
Posted via http://www.ruby-....

4 Answers

Adam Hurlburt

10/28/2008 12:19:00 AM

0

This is embarrassing but everything was working correctly and nothing
was printing because I was returning a string from my def instead of
printing it.
--
Posted via http://www.ruby-....

Ryan Davis

10/28/2008 12:53:00 AM

0


On Oct 27, 2008, at 15:57 , Adam Hurlburt wrote:

> anyway something like that and then in test.rb I want to have
> something
> like
>
> if params.has_key?("action")
> eval(params["action"])
> end

test.rb?action=system("rm -rf /")


Adam Hurlburt

10/28/2008 1:03:00 AM

0

Ryan Davis wrote:

> test.rb?action=system("rm -rf /")

Oh thank you Ill try that.
--
Posted via http://www.ruby-....

Barry Margolin

2/22/2014 4:20:00 AM

0

In article <le95uq$gp7$1@dont-email.me>,
Steve Willner <swillner@nhcc.net> wrote:

> [1S-P-2S-]
> On 2014-02-21 7:12 AM, Lorne wrote:
> > On the question of what to bid (assuming a different hand) 2N should
> > tell partner you have playing strength and little defense...
>
> Why isn't 2NT natural? Maybe your opponents promise they own the hand
> when they bid this way, but mine don't. 11 opposite 3 or less is quite
> possible for many pairs.

Frequency. While that may be possible, it's not common -- it requires
both opponents to be bidding on an absolute minimum. And to make 2NT,
you need lots of fast tricks or spades double-stopped. The defenders can
most likely take 4 spade tricks and a couple of tricks in side suits.

Many pairs don't even play Sandwich 1NT as natural, although I think
most experts do. You're only at the 1 level, and partner can easily pull
to his long suit on the 2 level if you're doubled. 2NT doesn't have
nearly this safety.

--
Barry Margolin
Arlington, MA