Deal of the Day

Home » Main » Manning Forums » 2007 » Ruby in Practice

Thread: Need to lose the Microsoft `smart quotes' in the code examples

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Pages: 1 - Last Post: Oct 27, 2008 9:12 AM by: marcric
fjfish

Posts: 2
From: Birkhenhead, Merseyside, UK
Registered: 4/29/08
Need to lose the Microsoft `smart quotes' in the code examples
Posted: Apr 29, 2008 7:41 AM
  Click to reply to this thread Reply

It really grates and also means that any attempt to cut and paste from the PDF would fail.

assaf


Posts: 8
From: Oakland
Registered: 6/26/08
Re: Need to lose the Microsoft `smart quotes' in the code examples
Posted: Jun 26, 2008 3:48 AM   in response to: fjfish in response to: fjfish
  Click to reply to this thread Reply

Working on it.

marcric


Posts: 12
From: Rio de Janeiro, Brazil
Registered: 9/28/08
Re: Need to lose the Microsoft `smart quotes' in the code examples
Posted: Sep 28, 2008 11:29 PM   in response to: assaf in response to: assaf
  Click to reply to this thread Reply

I have downloaded the samples code today and get that kind of error on "CH2\2.4.1":

E:\Ruby in Practice\Code\CH2\2.4.1>ruby ps_checker_with_fixture.rb
Loaded suite ps_checker_with_fixture
Started
EE
Finished in 0.015 seconds.

1) Error:
test_initialized(TestProcessChecker):
Errno::ENOENT: No such file or directory - ps -A
./process_checker.rb:3:in ``'
./process_checker.rb:3:in `initialize'
ps_checker_with_fixture.rb:6:in `new'
ps_checker_with_fixture.rb:6:in `setup'

2) Error:
test_rails_server(TestProcessChecker):
Errno::ENOENT: No such file or directory - ps -A
./process_checker.rb:3:in ``'
./process_checker.rb:3:in `initialize'
ps_checker_with_fixture.rb:6:in `new'
ps_checker_with_fixture.rb:6:in `setup'

2 tests, 0 assertions, 0 failures, 2 errors

I have changed the file "process_checker.rb" taking out the smart quotes, and get it right:

E:\Ruby in Practice\Code\CH2\2.4.1>ruby ps_checker_with_fixture.rb
Loaded suite ps_checker_with_fixture
Started
..
Finished in 0.0 seconds.

2 tests, 2 assertions, 0 failures, 0 errors

E:\Ruby in Practice\Code\CH2\2.4.1>

assaf


Posts: 8
From: Oakland
Registered: 6/26/08
Re: Need to lose the Microsoft `smart quotes' in the code examples
Posted: Sep 29, 2008 11:53 PM   in response to: marcric in response to: marcric
  Click to reply to this thread Reply

Marcic, these look like but are not accidental smartquotes. In Ruby you can use the backtick to execute a command and capture its output, so `ps -A` runs the ps command, which lists all running processes, and returns that list as a string.

Windows doesn't have the ps command, contrary to what the README file says. I changed the README file to be clearer about that.

marcric


Posts: 12
From: Rio de Janeiro, Brazil
Registered: 9/28/08
Re: Need to lose the Microsoft `smart quotes' in the code examples
Posted: Oct 27, 2008 9:12 AM   in response to: assaf in response to: assaf
  Click to reply to this thread Reply

Hi Assaf,

Sorry to miss the backtick meaning.

But we have a similar command in Windows should be: `mem /c `

I works fine for me.

Regards.

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff