[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

rubycookbook 15.1 problem

rajibsukanta

11/24/2006 12:56:00 PM

I was following along Lucas's rubycookbook receipe 15.1 for creating a
ROR application for displaying the o/p of dir command on a windows
machine onoto a browser.

my application is named "check" instead of "status" as given in
receipe.

my C:/Documents and
Settings/ri004902/check/app/controllers/check_controller.rb .. file
looks as
.........................................................
class CheckController < ApplicationController
def index
time = Time.now
@time = time
@dr = exec "dir/p"
end
end
.......................................
and my C:\Documents and
Settings\ri004902\check\app\views\check\index.rhtml .. file is
................................................................
<h1>Directory structure at <%= @time %></h1>
<p><%= @dr %></p>
......................................................

I start the webbrick and point my brwser to
http://localhost:3000/check/

what i get is
Application error (Rails)

I tried with @dr= 'dir/p' in index of CheckController .. but in vain.

could anyone provide me a lead.



Cheers
Rajib

13 Answers

Ross Bamford

11/24/2006 2:10:00 PM

0

On Fri, 24 Nov 2006 12:55:34 -0000, <rajibsukanta@yahoo.co.in> wrote:

I don't know Rails all that well, but it strikes me as doubtful that you=
=

want:

> @dr =3D exec "dir/p"

which will _replace_ the executing ruby process with a new process (here=
=

running dir/p), and won't return. Maybe you'd want backticks instead:

@dr =3D `dir/p`

Also, I'm not sure whether you mean `dir/p` or `dir /p`. In any event, =

note that those are backticks, not single quotes as you've already tried=
.

Hope that helps,
-- =

Ross Bamford - rosco@roscopeco.remove.co.uk

matt

11/24/2006 3:44:00 PM

0

<rajibsukanta@yahoo.co.in> wrote:

> I was following along Lucas's rubycookbook receipe 15.1 for creating a
> ROR application for displaying the o/p of dir command on a windows
> machine onoto a browser.
>
> my application is named "check" instead of "status" as given in
> receipe.
>
> my C:/Documents and
> Settings/ri004902/check/app/controllers/check_controller.rb .. file
> looks as
> ........................................................
> class CheckController < ApplicationController
> def index
> time = Time.now
> @time = time
> @dr = exec "dir/p"
> end
> end
> ......................................
> and my C:\Documents and
> Settings\ri004902\check\app\views\check\index.rhtml .. file is
> ...............................................................
> <h1>Directory structure at <%= @time %></h1>
> <p><%= @dr %></p>
> .....................................................
>
> I start the webbrick and point my brwser to
> http://localhost:3000/check/
>
> what i get is
> Application error (Rails)
>
> I tried with @dr= 'dir/p' in index of CheckController .. but in vain.
>
> could anyone provide me a lead.

This could be irrelevant - I'm on Mac OS X, and there is no "dir"
command there - but OMM the example as printed doesn't work either,
because the single-quotes in the original should be backticks. The
recipe has:

@ps = 'ps aux'

But it should be:

@ps = `ps aux`

Perhaps you should try `dir/p` (whatever that may be) instead of using
exec? Just a guess... m.

--
matt neuburg, phd = matt@tidbits.com, http://www.tidbits...
Tiger - http://www.takecontrolbooks.com/tiger-custom...
AppleScript - http://www.amazon.com/gp/product/...
Read TidBITS! It's free and smart. http://www.t...

rajibsukanta

11/25/2006 7:12:00 AM

0



On Nov 24, 8:44 pm, m...@tidbits.com (matt neuburg) wrote:
> <rajibsuka...@yahoo.co.in> wrote:
> > I was following along Lucas's rubycookbook receipe 15.1 for creating a
> > ROR application for displaying the o/p of dir command on a windows
> > machine onoto a browser.
>
> > my application is named "check" instead of "status" as given in
> > receipe.
>
> > my C:/Documents and
> > Settings/ri004902/check/app/controllers/check_controller.rb .. file
> > looks as
> > ........................................................
> > class CheckController < ApplicationController
> > def index
> > time = Time.now
> > @time = time
> > @dr = exec "dir/p"
> > end
> > end
> > ......................................
> > and my C:\Documents and
> > Settings\ri004902\check\app\views\check\index.rhtml .. file is
> > ...............................................................
> > <h1>Directory structure at <%= @time %></h1>
> > <p><%= @dr %></p>
> > .....................................................
>
> > I start the webbrick and point my brwser to
> >http://localhost:3000/check/
>
> > what i get is
> > Application error (Rails)
>
> > I tried with @dr= 'dir/p' in index of CheckController .. but in vain.
>
> > could anyone provide me a lead.This could be irrelevant - I'm on Mac OS X, and there is no "dir"
> command there - but OMM the example as printed doesn't work either,
> because the single-quotes in the original should be backticks. The
> recipe has:
>
> @ps = 'ps aux'
>
> But it should be:
>
> @ps = `ps aux`
>
> Perhaps you should try `dir/p` (whatever that may be) instead of using
> exec? Just a guess... m.

Oh .. i thought that was right..now i tried with

class CheckController < ApplicationController
def index
time = Time.now
@time = time
@dr = ` dir `
end
end

.... but in vain still that " Application error (Rails)" is bugging me.

any lead?

btw .. what is the best way to debug rails application

thanks
rajib
>
> --
> matt neuburg, phd = m...@tidbits.com,http://www.tidbits...
> Tiger -http://www.takecontrolbooks.com/tiger-custom...
> AppleScript -http://www.amazon.com/gp/product/...
> Read TidBITS! It's free and smart.http://www.ti... Hide quoted text -- Show quoted text -

hancock4

1/5/2012 8:08:00 PM

0

On Jan 4, 3:50 pm, Lord Vader III <lord.vader....@gmail.com> wrote:

> Listening to them say "cuepon" instead of "coupon" was driving me
> insane.  To this day I still can't understand why people pronounce it
> "cuepon".

Everyone around here pronounces it "cuepon". Sometimes people in
other areas say "koopon".

Dano

1/5/2012 8:15:00 PM

0

wrote in message
news:974cdeaa-490f-48a6-92ff-e55860657f2d@t16g2000vba.googlegroups.com...

On Jan 4, 3:50 pm, Lord Vader III <lord.vader....@gmail.com> wrote:

> Listening to them say "cuepon" instead of "coupon" was driving me
> insane. To this day I still can't understand why people pronounce it
> "cuepon".

Everyone around here pronounces it "cuepon". Sometimes people in
other areas say "koopon".

==============================================

If such a trivial thing drives him insane, it's a very short ride...

trotsky

1/6/2012 12:28:00 AM

0

On 1/5/12 2:08 PM, hancock4@bbs.cpcn.com wrote:
> On Jan 4, 3:50 pm, Lord Vader III<lord.vader....@gmail.com> wrote:
>
>> Listening to them say "cuepon" instead of "coupon" was driving me
>> insane. To this day I still can't understand why people pronounce it
>> "cuepon".
>
> Everyone around here


Where, cyberspace?

Michael Black

1/6/2012 4:56:00 AM

0

verysorry

1/6/2012 8:52:00 AM

0

Michael Black <et472@ncf.ca> wrote:

>I don't think it's the mispronunciation so much as the person embracing
>something suddenly and using it a lot. So when your mother starts using
>"hassle" and uses it frequently, that's annoying.

>"Awesome" is way overused these days.

"Absolutely" <= also overused IMHO

Obveeus

1/6/2012 12:09:00 PM

0


"Michael Black" <et472@ncf.ca> wrote:

> I think that's what annoyed the character on the show, the jumping in
> completely, along with the mispronounciation of the word, which surely is
> a blind copying of something said on one of the reality shows about
> couponing.

There was no mispronounciation of the word. 'Coupon' has two
pronounciations and both of them are perfectly acceptable.


zox625

1/6/2012 4:32:00 PM

0

On Jan 6 2012 7:08 AM, Obveeus wrote:

> "Michael Black" <et472@ncf.ca> wrote:
>
> > I think that's what annoyed the character on the show, the jumping in
> > completely, along with the mispronounciation of the word, which surely is
> > a blind copying of something said on one of the reality shows about
> > couponing.
>
> There was no mispronounciation of the word. 'Coupon' has two
> pronounciations and both of them are perfectly acceptable.

Yes. From Random House Dictionary:

?Pronunciation. COUPON, related to cope and coup, is of French origin. It
has developed an American pronunciation variant (kyoo-pon) with an
unhistorical y-sound not justified by the spelling. This pronunciation is
used by educated speakers and is well-established as perfectly standard,
although it is sometimes criticized. Its development may have been
encouraged by analogy with words like curious, cupid, and cute, where c is
followed by a 'long-u' and the (y) is mandatory.

-----?