From: Mason Kelsey on
[Note: parts of this message were removed to make it a legal post.]

Sorry for the typo; I didn't mean "monitor". I'm a retired programmer, a
Dilbert dinosaur, and certainly know that inputs don't come from monitors.
The first computer I worked on had vacuum tubes and 1K of mainframe memory!
Having been in the field for 36 years before my retirement in 2001, the term
terminal used to be used in the distant past for a monitor/keyboard combo or
a teletype machine, typically with acoustic phone couples for the
connections to the mainframe. Clearly that is not how some use the term
terminal any more. So the world changes, what else is new?

I tried using the run/cmd that you suggested, and it does work. Thank you.
But I assume most Ruby programmers don't work in the run/cmd environment,
what I call the DOS Box. If so that is a serious step backwards by about 28
years. I actually had to use the "dir" and "cd" commands to get to the
subdirectory where my rb files were. I haven't used them in so many years I
have forgotten how many have passed. DOS commands, today! What a
disappointment! How primitive!

I did mean page 203, where the gets command is used, without the $stdin.
Page 230 is about SQLite. This is not an SQL problem. It is curious that
the gets command does not work from within SciTE.

But, finally, you say there is a SciTE forum!? Great! I just did a Google
search to find it myself. It is at http://www.nabble.com/SciTE-f14248.html for
anyone who is interested. I will be taking my question there.

Thanks for your reply,

No Sam

On Wed, Sep 2, 2009 at 5:15 PM, 7stud -- <bbxx789_05ss(a)yahoo.com> wrote:

> Mason Kelsey wrote:
> > Do I have to execute this from outside of SciTE?
>
> I don't know anything about Scite, but you should learn to use "the
> command" line before using a text editor to run programs.
>
> > Then where?
> > I
> > am running Windows XP. Unfortunately, "Beginning Ruby" does a lite job
> > on
> > input from monitors.
> >
>
> Computer programs don't get input from terminals; programs get input
> from *keyboards* (or files). Output is what goes to *monitors* (or
> files). Review p. 6-7 on using a command window to run programs from
> "the command line".
>
> >
> > The way gets is described, on page 203 of the
> > book,
> > just does not work.
> >
>
> I think you mean page 230 for anyone reading along.
>
>
> > Anyway, what is the point for SciTE to display the thing that looks like
> > a
> > DOS Box if it is always locked up?
> >
>
> I don't know. That might be a question better asked in the Scite user's
> forum, however you might get lucky here.
>
>
>
> >
> > I bet that the problem is something stupid I am not noticing. Enjoy
> > revealing my ignorance! And thanks.
> >
> > No Sam
>
>
> --
> Posted via http://www.ruby-forum.com/.
>
>

From: 7stud -- on
Mason Kelsey wrote:
>
> I tried using the run/cmd that you suggested, and it does work. Thank
> you.
> But I assume most Ruby programmers don't work in the run/cmd
> environment,
> what I call the DOS Box. If so that is a serious step backwards by
> about 28
> years.

I'm not sure what most ruby programmers do. But I think a lot of ruby
programmers use the command line to run programs. A lot of the answers
posted on this forum show the commands used to run a program on the
command line--although the open source world is heavily biased towards
unix/linux, so it is a unix/linux command line rather than a windows
command window.

IDE's are not so important for scripting languages. All you need is a
text editor that provides syntax highlighting and automatic indenting.
Obviously, as programs get longer and more complex a good IDE can be
helpful to navigate around the code.

>
> I did mean page 203, where the gets command is used, without the $stdin.
> Page 230 is about SQLite.
>

Then I would guess you have the 2nd edition, which you neglected to
mention.

>
> that
> the gets command does not work from within SciTE.
>

You have a gui, Scite, that is trying to run another gui, a dos command
window, in another thread. In my experience, open source text editors
often have trouble doing that, and then throw in windows, and you have a
recipe for disaster. You do know how eff'ed up windows is don't you?


> But, finally, you say there is a SciTE forum!? Great! I just did a
> Google
> search to find it myself. It is at
> http://www.nabble.com/SciTE-f14248.html for
> anyone who is interested. I will be taking my question there.
>
> Thanks for your reply,
>
> No Sam

--
Posted via http://www.ruby-forum.com/.

From: Markus Roberts on
> But I assume most Ruby programmers don't work in the run/cmd
> environment,
> what I call the DOS Box. If so that is a serious step backwards by
> about 28
> years.

Only if you consider windows a step forward.

-- MarkusQ

P.S. In my experience, programmers (esp. serious programmers) spend a
lot of their time in command line environments, not so much in GUIs,
and avoid wizards and web apps like the plague. Users, on the other
hand, do the converse. It's a matter of which party takes the
initiative; do you want the computer to lead you by the hand or to
quietly do your bidding?


From: Siep Korteling on
Mason Kelsey wrote:
> I'm having difficulty getting any command to work to pick up input from
> a
> screen or what looks like a DOS box when I run a script from SciTE. In
> the
> following code, which you will recognize as a slightly modified
> "basic_client. rb" from Chapter 12 of Beginning Ruby:
>
> require 'bot'
> #bot = Bot.new(:name => ARGV[0], :data_file => ARGV[1])
> bot = Bot.new(:name => "No Sam", :data_file => "bot_data")
> puts bot.greeting
> while input = $stdin.gets and input.chomp != 'end'
> puts '>> ' + bot.response_to(input)
> end
> puts bot.farewell
>
> I get the the thing that looks like a DOS Box appear but it is locked up
> and
> I am unable to input anything. When I kill it by clicking on the close
> button, I get the message:
>
>>ruby basic_client.rb
> Hi. I'm No Sam. Want to chat?
>>Exit code: -1073741510
>
> I have tried just using the gets by itself without the $stdin. with the
> same
> failure. Do I have to execute this from outside of SciTE? Then where?
> I
> am running Windows XP. Unfortunately, "Beginning Ruby" does a lite job
> on
> input from monitors. The way gets is described, on page 203 of the
> book,
> just does not work.
>
> Anyway, what is the point for SciTE to display the thing that looks like
> a
> DOS Box if it is always locked up?
>
> I bet that the problem is something stupid I am not noticing. Enjoy
> revealing my ignorance! And thanks.
>
> No Sam

On windows and using Scite, this simple code has the same behaviour:

puts "What is your name? "
answer = gets
puts "Hi, #{answer}. (any key to exit)"
gets

This however does work:

STDOUT.sync = true #no buffering
puts "What is your name? "
answer = gets
puts "Hi, #{answer}. (any key to exit)"
gets

If you run this from Scite, the output appears in the left pane. There
is no prompt, but the input should be typed there also.

hth,

Siep


--
Posted via http://www.ruby-forum.com/.

From: Mark on
On Wed, 02 Sep 2009 18:05:34 -0500, Mason Kelsey wrote:

> I tried using the run/cmd that you suggested, and it does work. Thank
> you. But I assume most Ruby programmers don't work in the run/cmd
> environment, what I call the DOS Box. If so that is a serious step
> backwards by about 28 years.

Not to me it isn't.

> I actually had to use the "dir" and "cd"
> commands to get to the subdirectory where my rb files were. I haven't
> used them in so many years I have forgotten how many have passed. DOS
> commands, today! What a disappointment! How primitive!

I should start walking on all 4's again then ;-)

--
Mark