Go to specific row and column

Discussion in 'Ruby' started by don, Aug 14, 2006.

  1. don

    don Guest

    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
    don, Aug 14, 2006
    #1
    1. Advertising

  2. On 14/08/06, don <> 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 Lifson, Aug 14, 2006
    #2
    1. Advertising

  3. don

    don Guest

    On 2006-08-14, Farrel Lifson wrote:
    > On 14/08/06, don <> 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
    don, Aug 14, 2006
    #3
  4. 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.
    Cliff Cyphers, Aug 14, 2006
    #4
  5. don

    Chad Perrin Guest

    On Mon, Aug 14, 2006 at 09:14:52PM +0900, Farrel Lifson wrote:
    > On 14/08/06, don <> 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
    Chad Perrin, Aug 14, 2006
    #5
  6. don

    don Guest

    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
    don, Aug 14, 2006
    #6
  7. don

    Guest

    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
    , Aug 15, 2006
    #7
  8. don

    Ken Bloom Guest

    don <> 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/
    Ken Bloom, Aug 15, 2006
    #8
  9. don

    don Guest

    On 2006-08-15, 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
    don, Aug 15, 2006
    #9
  10. don

    don Guest

    On 2006-08-15, Ken Bloom wrote:
    > don <> 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
    >
    don, Aug 15, 2006
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bazza Formez
    Replies:
    4
    Views:
    393
    Vanni Tomezzoli
    Dec 9, 2004
  2. =?Utf-8?B?SmF2?=

    Is ViwState Page-Specific or UserControl-Specific

    =?Utf-8?B?SmF2?=, Aug 16, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    521
    =?Utf-8?B?SmF2?=
    Aug 16, 2006
  3. johnsonlim026
    Replies:
    0
    Views:
    924
    johnsonlim026
    Feb 27, 2010
  4. D
    Replies:
    0
    Views:
    197
  5. Giggle Girl

    ie6 Insert Row at specific Row Index of Table

    Giggle Girl, Feb 5, 2006, in forum: Javascript
    Replies:
    18
    Views:
    259
    Thomas 'PointedEars' Lahn
    Feb 7, 2006
Loading...

Share This Page