running ruby

W

William James

Hi Everyone...With the help of trial and error, I have made some
progress. I modified my hello.rb file by adding some ruby code that I
found on the web. The added code contained an analysis of a stock
using a yahoo website. (Actually, my interest in ruby is to do some of
my own stock market analysis). In the code was a request to enter a
stock symbol. This request kept the ruby window (with the "Hello
World" statement) on my desktop as it waited for me to enter a stock
symbol. Once I entered the symbol, a long calculation was made and
then the ruby window disappeared. Thus, one way to keep the window in
view is to add a request for input. I suppose a pause statement might
also work.

(1)Is there another way to keep the window in
view until I enter an exit command?

(2) I still have the problem that the window consists of white
characters on a black background. Is there a ruby command to change
the window or create another window with features that I can control?

Thanks for your help. Yahdoco

Your questions have already been answered. Your problem
is that you don't know how to use the Windows console
(also known as a DOS box). You need to learn how to use
it before you attempt to learn to program in Ruby.
 
Y

yahdoco

Your questions have already been answered. Your problem
is that you don't know how to use the Windows console
(also known as a DOS box). You need to learn how to use
it before you attempt to learn to program in Ruby.
----------------------------------
Hi William...That's why I call myself a newbie. I don't know what I
don't know. Like many scientists, my method of solving problems is to
discover things by trial and error. Eventually, I will fill in the
gaps in my knowledge. If some nice guys out in ruby-land will help me,
that would be nice too. Thank you for your comments and have a nice
day! Yahdoco
 
P

Phil

-----Original Message-----
From: yahdoco [mailto:[email protected]]
Sent: Thursday, September 06, 2007 5:25 PM
To: ruby-talk ML
Subject: Re: running ruby

(1)Is there another way to keep the window in
view until I enter an exit command?

(2) I still have the problem that the window consists of white
characters on a black background. Is there a ruby command to change
the window or create another window with features that I can control?

Have you actually read the responses to your questions?

For 1: Start -> Run -> command.com
For 2: Right click on title bar of command window, Properties, Colors tab.

*Both* of these questions have been answered. Multiple times.
 
A

Alex Young

yahdoco said:
----------------------------------
Hi William...That's why I call myself a newbie. I don't know what I
don't know. Like many scientists, my method of solving problems is to
discover things by trial and error. Eventually, I will fill in the
gaps in my knowledge. If some nice guys out in ruby-land will help me,
that would be nice too. Thank you for your comments and have a nice
day! Yahdoco
1) Add a line saying "gets" to the end of your script.
2) Add a line saying "system '70'" to the start of your script.
 
P

Phil

-----Original Message-----
From: yahdoco [mailto:[email protected]]
Sent: Thursday, September 06, 2007 5:45 PM
To: ruby-talk ML
Subject: Re: running ruby
Your questions have already been answered. Your problem
is that you don't know how to use the Windows console
(also known as a DOS box). You need to learn how to use
it before you attempt to learn to program in Ruby.
----------------------------------
Hi William...That's why I call myself a newbie. I don't know what I
don't know. Like many scientists, my method of solving problems is to
discover things by trial and error. Eventually, I will fill in the
gaps in my knowledge. If some nice guys out in ruby-land will help me,
that would be nice too. Thank you for your comments and have a nice
day! Yahdoco

http://www.dummies.com/WileyCDA/DummiesTitle/productCd-0470137282,subcat-HAR
DWARE.html

http://www.dummies.com/WileyCDA/DummiesTitle/productCd-0764502344,subcat-OS.
html
 
Y

yahdoco

-----Original Message-----
From: yahdoco [mailto:[email protected]]
Sent: Thursday, September 06, 2007 5:25 PM
To: ruby-talk ML
Subject: Re: running ruby
(1)Is there another way to keep the window in
view until I enter an exit command?
(2) I still have the problem that the window consists of white
characters on a black background. Is there a ruby command to change
the window or create another window with features that I can control?

Have you actually read the responses to your questions?

For 1: Start -> Run -> command.com
For 2: Right click on title bar of command window, Properties, Colors tab.

*Both* of these questions have been answered. Multiple times.
 
Y

yahdoco

Have you actually read the responses to your questions?
For 1: Start -> Run -> command.com
For 2: Right click on title bar of command window, Properties, Colors tab.
*Both* of these questions have been answered. Multiple times.
Phillip Gawlowski
----------------------------------
Hi Phillip...I have not ignored the messages sent here. Let me begin
by saying that I am using Windows98. It may have some limitations you
are not aware of. I have carried out the operations you are talikng
about. Here are the results:

start>run>enter "command.com"
c:\WINDOW\Desktop>
Right Click on Title Bar
(DIALOG BOX comes up)
MS-DOS Prompt Properties
TABS->|Program,Font,Memory,Screen,Misc|
There is no Colors Tab.
When I click on Screen, it shows the screen
I will get (white characters on a black
foreground). There is no button to control
color or reverse black and white.
I have gone to the Control Panel-->Display in MyComputer. It allows me
to control colors in many places, but not in this window. It looks
like I change what I would like to change. Thanks for trying to help
me.
----------------------------------
----------------------------------
My next plan is to try to transfer the data from the black-white
screen to a Notepad file called outzzz.txt. Perhaps someone can
correct my code below to make this happen. Here is the code:
..................................
#generate some simple output (comment)
puts "Hello World"

f = File.new("outzzz.txt", "w")
f.write("this is a test")

require 'open-uri'
require 'csv'

def get_adjusted_close stock_symbol
puts "-- #{stock_symbol} Adjusted Close - Historical --"
url = "http://ichart.finance.yahoo.com/table.csv?
s=#{stock_symbol}&d=7&e=1&f=2006&g=d&a=2&b=26&c=1990&ignore=.csv"
puts "Connecting to #{url}\n"

csv = CSV.parse(open(url).read)

csv.each{|row|
puts "#{row[0]} - #{row.last}"
}
puts "---------------------------------"
end

example_stocks = "CSCO GOOG"
print "Enter a series of stock symbols separated by spaces (example:
#{example_stocks}) to retrieve the historical adjusted close.\n"
stock_symbols = gets
stock_symbols ||= example_stocks

stock_symbols.split.each{|symbol|
get_adjusted_close(symbol)
f.write(get_adjusted_close(symbol))
}

Thanks for your help. Yahdoco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,951
Messages
2,570,113
Members
46,699
Latest member
Abigail89S

Latest Threads

Top