I'm trying to run a thread that prints out the time in (H:M:S) format.
Can you look at it and say something about it?
I want the clock to run on it's own part of the screen without
interfering with my "what's your name?" thing.
When I run the code this is what happens (and let's think, for now I
type my name as "lol")
Current time - 12:27:31
What's your name?
Current time - 12:27:39ol #"ol" when i typed "lol"
lol is a nice name
Current time - 12:28:55
I'm trying to run a thread that prints out the time in (H:M:S) format.
Can you look at it and say something about it?
I want the clock to run on it's own part of the screen without
interfering with my "what's your name?" thing.
When I run the code this is what happens (and let's think, for now I
type my name as "lol")
Current time - 12:27:31
What's your name?
Current time - 12:27:39ol #"ol" when i typed "lol"
lol is a nice name
Current time - 12:28:55
On Sun, Dec 7, 2014 at 10:44 AM, Cynic limbu <cyniclimbu@gmail.com> wrote:
> My code goes here - Threading a clock in Ruby. - Pastebin.com
>
> I'm new to threading and also new to animations.
>
> I'm trying to run a thread that prints out the time in (H:M:S) format.
>
> Can you look at it and say something about it?
> I want the clock to run on it's own part of the screen without
> interfering with my "what's your name?" thing.
>
> When I run the code this is what happens (and let's think, for now I
> type my name as "lol")
>
> Current time - 12:27:31
> What's your name?
> Current time - 12:27:39ol #"ol" when i typed "lol"
> lol is a nice name
> Current time - 12:28:55
>
> And yes, I'm new to "\r" carriage return too.
On Sun, Dec 7, 2014 at 10:44 AM, Cynic limbu <cyniclimbu@gmail.com> wrote:
> My code goes here - Threading a clock in Ruby. - Pastebin.com
>
> I'm new to threading and also new to animations.
>
> I'm trying to run a thread that prints out the time in (H:M:S) format.
>
> Can you look at it and say something about it?
> I want the clock to run on it's own part of the screen without
> interfering with my "what's your name?" thing.
>
> When I run the code this is what happens (and let's think, for now I
> type my name as "lol")
>
> Current time - 12:27:31
> What's your name?
> Current time - 12:27:39ol #"ol" when i typed "lol"
> lol is a nice name
> Current time - 12:28:55
>
> And yes, I'm new to "\r" carriage return too.
I want the clock to run on the first line of the shell
And when I'm typing my name in when it's asking, I want the clock to just
stay where it is and not clone itself on the second line.
The output of your code is same to mine.
When it prints out "What's your name?"
The current time clones itself and prints its value after "whats your
name?" has been asked. Which is what I'm trying to avoid.
···
On Mon, Dec 8, 2014 at 1:09 PM, Raj Sahae <rajsahae@gmail.com> wrote:
Curses would be a good approach, but you haven't really defined what you
want your interaction to be like?
It's not a good approach, but another way would be to just wrap the stream
calls in a mutex.
On Sun, Dec 7, 2014 at 10:44 AM, Cynic limbu <cyniclimbu@gmail.com> >> wrote:
> My code goes here - Threading a clock in Ruby. - Pastebin.com
>
> I'm new to threading and also new to animations.
>
> I'm trying to run a thread that prints out the time in (H:M:S) format.
>
> Can you look at it and say something about it?
> I want the clock to run on it's own part of the screen without
> interfering with my "what's your name?" thing.
>
> When I run the code this is what happens (and let's think, for now I
> type my name as "lol")
>
> Current time - 12:27:31
> What's your name?
> Current time - 12:27:39ol #"ol" when i typed "lol"
> lol is a nice name
> Current time - 12:28:55
>
> And yes, I'm new to "\r" carriage return too.