Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Go to specific row and column

Reply
Thread Tools

Go to specific row and column

 
 
don
Guest
Posts: n/a
 
      08-14-2006
Hi,

I'm new to Ruby and programming and I know I'm getting a
little ahead of myself, but I'm having trouble finding the
command that sends you to a specific row and column on a
monitor before writing something. Also any related
commands.

I have the pickaxe book if the commands are in there. I
know about printf and sprintf, but I do not think that is
what I am looking for.

Thanks in advance,


Don
 
Reply With Quote
 
 
 
 
Farrel Lifson
Guest
Posts: n/a
 
      08-14-2006
On 14/08/06, don <(E-Mail Removed)> wrote:
> Hi,
>
> I'm new to Ruby and programming and I know I'm getting a
> little ahead of myself, but I'm having trouble finding the
> command that sends you to a specific row and column on a
> monitor before writing something. Also any related
> commands.
>
> I have the pickaxe book if the commands are in there. I
> know about printf and sprintf, but I do not think that is
> what I am looking for.
>
> Thanks in advance,
>
>
> Don
>
>

That kind of functionality is usually provided by an external library
such as ncurses. There is a ruby/ncurses binding available at
http://ncurses-ruby.berlios.de/

Farrel

 
Reply With Quote
 
 
 
 
don
Guest
Posts: n/a
 
      08-14-2006
On 2006-08-14, Farrel Lifson wrote:
> On 14/08/06, don <(E-Mail Removed)> wrote:
>> Hi,
>>
>> I'm new to Ruby and programming and I know I'm getting a
>> little ahead of myself, but I'm having trouble finding the
>> command that sends you to a specific row and column on a
>> monitor before writing something. Also any related
>> commands.
>>
>> I have the pickaxe book if the commands are in there. I
>> know about printf and sprintf, but I do not think that is
>> what I am looking for.
>>
>> Thanks in advance,
>>
>>
>> Don
>>
>>

> That kind of functionality is usually provided by an external library
> such as ncurses. There is a ruby/ncurses binding available at
> http://ncurses-ruby.berlios.de/
>
> Farrel
>


Farrel, thanks for the fast response.

So, are you saying there is not a "go to col 23, row 19"
type command in Ruby unless I install something else on my
linux system?

Don
 
Reply With Quote
 
Cliff Cyphers
Guest
Posts: n/a
 
      08-14-2006
don wrote:
>> That kind of functionality is usually provided by an external library
>> such as ncurses. There is a ruby/ncurses binding available at
>> http://ncurses-ruby.berlios.de/
>>
>> Farrel
>>

>
> Farrel, thanks for the fast response.
>
> So, are you saying there is not a "go to col 23, row 19"
> type command in Ruby unless I install something else on my
> linux system?


In general this concept of external libs is the de facto and for a good
reason. For common things that can be utilized from many sources it's
good to put in an external libs. In this case you have a C ncurses
library and a ruby wrapper that interfaces with the base library.

 
Reply With Quote
 
Chad Perrin
Guest
Posts: n/a
 
      08-14-2006
On Mon, Aug 14, 2006 at 09:14:52PM +0900, Farrel Lifson wrote:
> On 14/08/06, don <(E-Mail Removed)> wrote:
> >
> >I'm new to Ruby and programming and I know I'm getting a
> >little ahead of myself, but I'm having trouble finding the
> >command that sends you to a specific row and column on a
> >monitor before writing something. Also any related
> >commands.
> >
> >I have the pickaxe book if the commands are in there. I
> >know about printf and sprintf, but I do not think that is
> >what I am looking for.
> >

> That kind of functionality is usually provided by an external library
> such as ncurses. There is a ruby/ncurses binding available at
> http://ncurses-ruby.berlios.de/


. . or a different language, like Logo.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"It's just incredible that a trillion-synapse computer could actually
spend Saturday afternoon watching a football game." - Marvin Minsky

 
Reply With Quote
 
don
Guest
Posts: n/a
 
      08-14-2006
On 2006-08-14, Cliff Cyphers wrote:
> don wrote:
>>> That kind of functionality is usually provided by an external library
>>> such as ncurses. There is a ruby/ncurses binding available at
>>> http://ncurses-ruby.berlios.de/
>>>
>>> Farrel
>>>

>>
>> Farrel, thanks for the fast response.
>>
>> So, are you saying there is not a "go to col 23, row 19"
>> type command in Ruby unless I install something else on my
>> linux system?

>
> In general this concept of external libs is the de facto and for a good
> reason. For common things that can be utilized from many sources it's
> good to put in an external libs. In this case you have a C ncurses
> library and a ruby wrapper that interfaces with the base library.
>


Hi Cliff.

I wasn't commenting on the goodness or badness. I'd just
hoped there was a command I could use in my beginners
program.

Don
 
Reply With Quote
 
guillaume.marcais@gmail.com
Guest
Posts: n/a
 
      08-15-2006

don wrote:
>
> Hi Cliff.
>
> I wasn't commenting on the goodness or badness. I'd just
> hoped there was a command I could use in my beginners
> program.


There is curses in the standard library. So this little script should
work without installing anything extra:

---------------------------------------------
#! /usr/bin/ruby

require 'curses'

Curses.init_screen
s = Curses.stdscr
10.times do |i|
s.setpos(i, i)
s << "toto"
Curses.refresh
sleep(1)
end
Curses.close_screen
--------------------------------------------

The documentation is poor, but it doesn't take a lot of poking around
to figure out how it works. For documentation, see
http://www.ruby-doc.org, in the standard library, curses.

Hope this help,
Guillaume.

> Don


 
Reply With Quote
 
Ken Bloom
Guest
Posts: n/a
 
      08-15-2006
don <(E-Mail Removed)> wrote:
> On 2006-08-14, Cliff Cyphers wrote:
>> don wrote:
>>>> That kind of functionality is usually provided by an external library
>>>> such as ncurses. There is a ruby/ncurses binding available at
>>>> http://ncurses-ruby.berlios.de/
>>>>
>>>> Farrel
>>>>
>>>
>>> Farrel, thanks for the fast response.
>>>
>>> So, are you saying there is not a "go to col 23, row 19"
>>> type command in Ruby unless I install something else on my
>>> linux system?

>>
>> In general this concept of external libs is the de facto and for a good
>> reason. For common things that can be utilized from many sources it's
>> good to put in an external libs. In this case you have a C ncurses
>> library and a ruby wrapper that interfaces with the base library.
>>

>
> I wasn't commenting on the goodness or badness. I'd just
> hoped there was a command I could use in my beginners
> program.


Curses is among the standard libraries, (loaded with require 'curses')
but since most types of programs (e.g. web programs, GUI programs,
simple scripts) don't need the functionality of "go to col 23, row
19", it doesn't make sense to put it in as a language primative.

Learn to love libraries.

--Ken

--
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu/~kbloom1/
 
Reply With Quote
 
don
Guest
Posts: n/a
 
      08-15-2006
On 2006-08-15, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>
> don wrote:
>>
>> Hi Cliff.
>>
>> I wasn't commenting on the goodness or badness. I'd just
>> hoped there was a command I could use in my beginners
>> program.

>
> There is curses in the standard library. So this little script should
> work without installing anything extra:
>
> ---------------------------------------------
> #! /usr/bin/ruby
>
> require 'curses'
>
> Curses.init_screen
> s = Curses.stdscr
> 10.times do |i|
> s.setpos(i, i)
> s << "toto"
> Curses.refresh
> sleep(1)
> end
> Curses.close_screen
> --------------------------------------------
>
> The documentation is poor, but it doesn't take a lot of poking around
> to figure out how it works. For documentation, see
> http://www.ruby-doc.org, in the standard library, curses.
>
> Hope this help,
> Guillaume.
>
>> Don


Thanks Guillaume. That is what I was looking for. I'll
play with your code and check out the curses documentation.

Don
 
Reply With Quote
 
don
Guest
Posts: n/a
 
      08-15-2006
On 2006-08-15, Ken Bloom wrote:
> don <(E-Mail Removed)> wrote:
>> On 2006-08-14, Cliff Cyphers wrote:
>>> don wrote:
>>>>> That kind of functionality is usually provided by an external library
>>>>> such as ncurses. There is a ruby/ncurses binding available at
>>>>> http://ncurses-ruby.berlios.de/
>>>>>
>>>>> Farrel
>>>>>
>>>>
>>>> Farrel, thanks for the fast response.
>>>>
>>>> So, are you saying there is not a "go to col 23, row 19"
>>>> type command in Ruby unless I install something else on my
>>>> linux system?
>>>
>>> In general this concept of external libs is the de facto and for a good
>>> reason. For common things that can be utilized from many sources it's
>>> good to put in an external libs. In this case you have a C ncurses
>>> library and a ruby wrapper that interfaces with the base library.
>>>

>>
>> I wasn't commenting on the goodness or badness. I'd just
>> hoped there was a command I could use in my beginners
>> program.

>
> Curses is among the standard libraries, (loaded with require 'curses')
> but since most types of programs (e.g. web programs, GUI programs,
> simple scripts) don't need the functionality of "go to col 23, row
> 19", it doesn't make sense to put it in as a language primative.
>
> Learn to love libraries.


I will, Ken, as soon as I understand what they are. Thanks
for the reply.

Don

>
> --Ken
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pump data by row and column to dynamic created column in gridview johnsonlim026 ASP .Net 0 02-27-2010 05:29 PM
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
ie6 Insert Row at specific Row Index of Table Giggle Girl Javascript 18 02-07-2006 07:54 AM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM
Row / Column gets much bigger when editing a row in grid Bazza Formez ASP .Net 4 12-09-2004 11:03 PM



Advertisments