-BEGINNERS- Where do I Start?

Hello World....... I am very new to code but have been glancing at it
for years. Catching glimpses here and reading articles there, but, I
never actually started doing anything but absorbing info and general
understanding. So.... I started in looking for a code to learn, I start
by looking for a java setup since I drink lots of coffee....lol Well
when reading about java i seen an article about how Ruby was way more
comprehensive and easy going in a sense you don't have to spoon feed the
compiler to make things with your set objects or commands. So i decided
to go with Ruby since it wasn't that hard to understand when reading
_why's Guide to Ruby. I got a few chapters in and started to get swamped
with examples that I never used but only read.... At this point I had
just installed Lucid Lynx(Ubuntu [which i have no experience with
installing through the terminal]) so with Lynx in place I had read a how
to article on installing Ruby and did so successfully.(I am pretty sure
anyway)

So now I have Ruby 1.9.3 with RVM as the main source for my install. At
this point I get confused. How do i use ruby? What I thought of was I
want to be able to enter some code an execute it to see what happens.
Like the "Try Ruby" tutorial page where they have a open ruby enviorment
for people to get a taste of the Ruby in action. I havent been able to
figure out how to do taste testing like that on my own. I have been in
the terminal and typed "Ruby" which is auto loaded at the time the
terminal is opened so then it breaks into the ruby mode and allows me to
write lines and press enter to end the line an move to the next however
it doesn't work like I thought, mostly because I dont know what to think
yet. At this point I want to try the stuff that I have been reading
about in _why's ruby book. Am I just suppose to start writing things in
my terminal? How do i test the code I wrote? How do I save and run the
code right there as I am writing it like in the "Try Ruby"? In the
online try ruby it allows me to enter some code and hit Return to make
it run the script. But when i hit enter in the terminal it just moves to
the next line which leads me to believe that there is a start/end
command to let the Ruby know what I want to run an when to run it.
Basically I don't what is going on, am I using ruby when I type "Ruby"
in the terminal? How do I make things execute and show me the results? I
feel quite close, like I am just missing a few understandings. Like how
do I open ruby, how do i use ruby, and do I interact and communicate
with ruby in a manner that i type and it responds?

I guess I just dont understand fully yet about what to do with ruby and
how to make it talk to me when I talk to it. Yesterday I didn't even
know how to install ruby, but now i have it installed and dont know how
to use it or interact with it. Any advice for someone who is it at
ground zero with NO code experience would be helpful. How do use ruby?
How do I make it function, how do i interact with ruby?

DAY 2 is where I am at on learning Ruby-

···

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

Cool, so far you are doing everything right; well, one version of right =]

What you are looking for is 'irb'. That is the interactive ruby console which will allow you to try code line or block at a time. It should be in your path with rvm.

When you want to try putting scripts together, simply put a hash bang line at the top along these lines;

#!/usr/bin/env ruby

And then make your script executable;

chmod u+x /path/to/your/script

Have fun
Sam

···

On 25/04/12 15:58, Thought M. wrote:

So now I have Ruby 1.9.3 with RVM as the main source for my install. At
this point I get confused. How do i use ruby? What I thought of was I
want to be able to enter some code an execute it to see what happens.

update-

I got the irb to work in my terminal and it is functioning just as I'd
hoped.

Now I just am curious about the hash bang.

The CHMOD is change modify i assume and the u+x is making it "x"
executable, path is to define which file to make changes to and
modify.... yeah

So the CHMOD, is that to finalize the ruby code, as in, can i add an
make changes to the code still? Making the file executable doesn't lock
the code right, just makes it turn from writting to functionable
material right?

So can you explain what the "!" path/to/env Ruby is all about?

THANKS-

···

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

Hi,

I don't want to be rude, but I think you could answer most questions
yourself with a simple Google search. For example, searching for "hash
bang line" leads to a Wikipedia article, which explains just that and
even mentions Ruby as an example:

The same goes for the "chmod" command.

I don't really think it makes sense to go through all Ruby and Linux
basics in a forum. That's what tutorials and books are for (you'll
easily find them).

···

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

Yes I understand that this is not a tutorial class I ask lots of stupid
questions to smart people that know the answers. However, my initial
question was more or less to figure out how to "get into" ruby an use it
to learn about the lessons and tutorials I have been reading already in
_why's guide. I needed to know about "irb" which i didn't, I also needed
to know that i was for certain using ruby and why it didn't respond to
me when I typed stuff in. I was honestly lost an didn't understand. But
for me to ask clarity on a response about how and what he told me to do
is not to far out of place an makes me feel you jumped the gun on this
comment to google for help when I am already engaged in a conversation
or message posting with people that can help.

Sorry, I just didn't think is was a big deal to ask a question about my
response I received.

Thanks for helping me............

···

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

Hello World....... I am very new to code but have been glancing at it
for years. Catching glimpses here and reading articles there, but, I
never actually started doing anything but absorbing info and general
understanding. So.... I started in looking for a code to learn, I start
by looking for a java setup since I drink lots of coffee....lol Well
when reading about java i seen an article about how Ruby was way more
comprehensive and easy going in a sense you don't have to spoon feed the
compiler to make things with your set objects or commands. So i decided
to go with Ruby since it wasn't that hard to understand when reading
_why's Guide to Ruby. I got a few chapters in and started to get swamped
with examples that I never used but only read.... At this point I had
just installed Lucid Lynx(Ubuntu [which i have no experience with
installing through the terminal]) so with Lynx in place I had read a how
to article on installing Ruby and did so successfully.(I am pretty sure
anyway)

So now I have Ruby 1.9.3 with RVM as the main source for my install.

Awesome :slight_smile: Nice job getting all that installed, I know it can be really
rough when you are new and aren't familiar with all the idioms. I had to
have my school's sysadmin install Linux for me when I first started. If he
hadn't helped me out, I wouldn't even be here today. You're way ahead of
the curve given that you've been able to figure all that out on your own.

At this point I want to try the stuff that I have been reading

about in _why's ruby book.

_why's book is a lot of fun, but I think it was written for ruby 1.8. Most
things will still be the same, but some are easier now, and others are just
a little bit different.

As an aside I've always felt the Poignant Guide's strengths were more in
it's entertainment value than it's pedagogical merit.

I tried to address the gap newbies face by recording sessions where I
taught my friends Ruby. We also had quizzes and challenges to work
through. I'm not sure how well I succeeded, but if you find yourself
getting frustrated with existing resources, you're welcome to give it a try
at http://ruby-kickstart.com/

Am I just suppose to start writing things in

my terminal? How do i test the code I wrote? How do I save and run the
code right there as I am writing it like in the "Try Ruby"? In the
online try ruby it allows me to enter some code and hit Return to make
it run the script. But when i hit enter in the terminal it just moves to
the next line which leads me to believe that there is a start/end
command to let the Ruby know what I want to run an when to run it.
Basically I don't what is going on, am I using ruby when I type "Ruby"
in the terminal? How do I make things execute and show me the results? I
feel quite close, like I am just missing a few understandings. Like how
do I open ruby, how do i use ruby, and do I interact and communicate
with ruby in a manner that i type and it responds?

When you type "ruby" and hit return, it expects you to type in a program in
the command line. You've already discovered irb, but if you'd like to see
how this works, you can type "ruby", then "puts 'hello world'", then
control-D

Sorry, I just didn't think is was a big deal to ask a question about my

response I received.

Don't worry about it, some people don't remember what it's like to be new.

···

On Tue, Apr 24, 2012 at 10:58 PM, Thought M. <lists@ruby-forum.com> wrote:
On Wed, Apr 25, 2012 at 12:51 AM, Thought M. <lists@ruby-forum.com> wrote:

Try http://www.oldkingjames.org and click on learn to program and there are some Ruby lessons for beginners to programming itself.

···

Date: Wed, 25 Apr 2012 12:58:07 +0900
From: lists@ruby-forum.com
Subject: -BEGINNERS- Where do I Start?
To: ruby-talk@ruby-lang.org

Hello World....... I am very new to code but have been glancing at it
for years. Catching glimpses here and reading articles there, but, I
never actually started doing anything but absorbing info and general
understanding. So.... I started in looking for a code to learn, I start
by looking for a java setup since I drink lots of coffee....lol Well
when reading about java i seen an article about how Ruby was way more
comprehensive and easy going in a sense you don't have to spoon feed the
compiler to make things with your set objects or commands. So i decided
to go with Ruby since it wasn't that hard to understand when reading
_why's Guide to Ruby. I got a few chapters in and started to get swamped
with examples that I never used but only read.... At this point I had
just installed Lucid Lynx(Ubuntu [which i have no experience with
installing through the terminal]) so with Lynx in place I had read a how
to article on installing Ruby and did so successfully.(I am pretty sure
anyway)

So now I have Ruby 1.9.3 with RVM as the main source for my install. At
this point I get confused. How do i use ruby? What I thought of was I
want to be able to enter some code an execute it to see what happens.
Like the "Try Ruby" tutorial page where they have a open ruby enviorment
for people to get a taste of the Ruby in action. I havent been able to
figure out how to do taste testing like that on my own. I have been in
the terminal and typed "Ruby" which is auto loaded at the time the
terminal is opened so then it breaks into the ruby mode and allows me to
write lines and press enter to end the line an move to the next however
it doesn't work like I thought, mostly because I dont know what to think
yet. At this point I want to try the stuff that I have been reading
about in _why's ruby book. Am I just suppose to start writing things in
my terminal? How do i test the code I wrote? How do I save and run the
code right there as I am writing it like in the "Try Ruby"? In the
online try ruby it allows me to enter some code and hit Return to make
it run the script. But when i hit enter in the terminal it just moves to
the next line which leads me to believe that there is a start/end
command to let the Ruby know what I want to run an when to run it.
Basically I don't what is going on, am I using ruby when I type "Ruby"
in the terminal? How do I make things execute and show me the results? I
feel quite close, like I am just missing a few understandings. Like how
do I open ruby, how do i use ruby, and do I interact and communicate
with ruby in a manner that i type and it responds?

I guess I just dont understand fully yet about what to do with ruby and
how to make it talk to me when I talk to it. Yesterday I didn't even
know how to install ruby, but now i have it installed and dont know how
to use it or interact with it. Any advice for someone who is it at
ground zero with NO code experience would be helpful. How do use ruby?
How do I make it function, how do i interact with ruby?

DAY 2 is where I am at on learning Ruby-

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

When you want to try putting scripts together, simply put a hash bang
line at the top along these lines;

#!/usr/bin/env ruby

And then make your script executable;

chmod u+x /path/to/your/script

Have fun
Sam

Thanks for getting back to me quickly, I was lingering hopeing I'd get a
response because I'm so eager to get started.

So when you stated that when I want to get started putting together some
scripts, simply put a "hash bang line" at the top along these
lines................. What does that do? I found the same path you
speak of and see "env" is executable file. What does the "!" point do?

What i imagine it doing is telling ruby to make use of the env file some
how, and the "!" is telling ruby to use it only this once??? Am i
close? I don't like just typing things in without understanding why and
what it does. Not that your not spot on about what you speak of but
because just following orders mindlessly isn't something i like doing.
Can you please explain what the hash bang is about and what it does as
well as how ruby ties into that action?

Oh! the irb does sound perfect, exactly what i need at this point thank
you so much for that.

So when hash bangin' ruby outta the env file does that give ruby a blank
canvas per say, like opening a new page all of it's own? I just can't
imagine fully what is going on and need to know so my thoughts will
quiet down. Thanks-

···

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

This should get you started with hashbang lines: Shebang (Unix) - Wikipedia

I'll try to illustrate with a few examples. Assume a script called 'rubyduby.rb' in your current working directory, and that '>' represents your shell prompt.

Lets say rubyduby.rb looks like this;

···

On 25/04/12 16:46, Thought M. wrote:

update-

I got the irb to work in my terminal and it is functioning just as I'd
hoped.

Now I just am curious about the hash bang.

The CHMOD is change modify i assume and the u+x is making it "x"
executable, path is to define which file to make changes to and
modify.... yeah

So the CHMOD, is that to finalize the ruby code, as in, can i add an
make changes to the code still? Making the file executable doesn't lock
the code right, just makes it turn from writting to functionable
material right?

So can you explain what the "!" path/to/env Ruby is all about?

THANKS-

-----------------------------------------------
require 'etc'
puts "RubyDuby: #{Etc.getlogin}"
-----------------------------------------------

# choose your ruby with rvm, and run your script
> rvm use 1.9.3
> ruby ./rubyduby.rb

Now this will 'feed' your script to the first ruby interpreter your shell finds in your path. If you had another ruby installed with rvm, you could switch to that and run it again.

# choose another ruby with rvm, and run your script
> rvm use rbx
> ruby ./rubyduby.rb

But what about if I am tired and don't want to keep typing ruby? I need to give my script a hashbang, and make it executable. Now rubyduby.rb looks like this;
-----------------------------------------------
#!/usr/bin/env ruby
require 'etc'
puts "RubyDuby: #{Etc.getlogin}"
-----------------------------------------------

# After adding a hashbang line, make it executable, and run it!
> chmod u+x ./rubyduby.rb
> ./rubyduby.rb

To answer a few questions;

*) Will making the file executable 'lock' or 'compile' my file in some way? No; and you can continue to run it by typing ruby first if you like.
*) Can I edit my newly executable script? Yes; save and rerun to your hearts content.
*) Why make the hashbang line with env instead of ruby directly? Because if you point it directly at ruby (/usr/bin/ruby or something), then switching rubies with rvm won't switch the ruby your script is invoked with. Wrapping it with env causes it to be run with the ruby you chose with rvm (generally!). 'man env' for more info.

Hope that helps =]

Sam

Josh Cheek wrote in post #1058231:

Sorry, I just didn't think is was a big deal to ask a question about my

response I received.

Don't worry about it, some people don't remember what it's like to be
new.

No, this has nothing to do with being new. It's a matter of using the
right source for certain information.

Sure, you can always hope for someone that will explain everything step
by step. And if you actually find a "personal tutor", great! But you
should also know where to find things on your own, as it will save you
and others a lot of time.

Things like the "hash bang line" or Linux file properties are
well-documented basics. It's a matter of seconds to find the right
Wikipedia article and excellent tutorials. So why post the question in a
forum and wait for somebody else to do the work?

I'd rather use the forum *after* having done some research on my own.
Then you actually get to the interesting points.

···

On Wed, Apr 25, 2012 at 12:51 AM, Thought M. <lists@ruby-forum.com> > wrote:

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

Just saw this[1], not sure if anyone has mentioned it yet.

1: http://iwanttolearnruby.com/

···

On Fri, Apr 27, 2012 at 7:17 AM, Alexander McMillan <alexandermcmillan@hotmail.com> wrote:

Try http://www.oldkingjames.org and click on learn to program and there are
some Ruby lessons for beginners to programming itself.

Date: Wed, 25 Apr 2012 12:58:07 +0900
From: lists@ruby-forum.com
Subject: -BEGINNERS- Where do I Start?
To: ruby-talk@ruby-lang.org

Hello World....... I am very new to code but have been glancing at it
for years. Catching glimpses here and reading articles there, but, I
never actually started doing anything but absorbing info and general
understanding. So.... I started in looking for a code to learn, I start
by looking for a java setup since I drink lots of coffee....lol Well
when reading about java i seen an article about how Ruby was way more
comprehensive and easy going in a sense you don't have to spoon feed the
compiler to make things with your set objects or commands. So i decided
to go with Ruby since it wasn't that hard to understand when reading
_why's Guide to Ruby. I got a few chapters in and started to get swamped
with examples that I never used but only read.... At this point I had
just installed Lucid Lynx(Ubuntu [which i have no experience with
installing through the terminal]) so with Lynx in place I had read a how
to article on installing Ruby and did so successfully.(I am pretty sure
anyway)

So now I have Ruby 1.9.3 with RVM as the main source for my install. At
this point I get confused. How do i use ruby? What I thought of was I
want to be able to enter some code an execute it to see what happens.
Like the "Try Ruby" tutorial page where they have a open ruby enviorment
for people to get a taste of the Ruby in action. I havent been able to
figure out how to do taste testing like that on my own. I have been in
the terminal and typed "Ruby" which is auto loaded at the time the
terminal is opened so then it breaks into the ruby mode and allows me to
write lines and press enter to end the line an move to the next however
it doesn't work like I thought, mostly because I dont know what to think
yet. At this point I want to try the stuff that I have been reading
about in _why's ruby book. Am I just suppose to start writing things in
my terminal? How do i test the code I wrote? How do I save and run the
code right there as I am writing it like in the "Try Ruby"? In the
online try ruby it allows me to enter some code and hit Return to make
it run the script. But when i hit enter in the terminal it just moves to
the next line which leads me to believe that there is a start/end
command to let the Ruby know what I want to run an when to run it.
Basically I don't what is going on, am I using ruby when I type "Ruby"
in the terminal? How do I make things execute and show me the results? I
feel quite close, like I am just missing a few understandings. Like how
do I open ruby, how do i use ruby, and do I interact and communicate
with ruby in a manner that i type and it responds?

I guess I just dont understand fully yet about what to do with ruby and
how to make it talk to me when I talk to it. Yesterday I didn't even
know how to install ruby, but now i have it installed and dont know how
to use it or interact with it. Any advice for someone who is it at
ground zero with NO code experience would be helpful. How do use ruby?
How do I make it function, how do i interact with ruby?

DAY 2 is where I am at on learning Ruby-

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

Sure, but when you're new, the set of things you know is so large that it
is much more difficult to find specific pieces of information. When you're
new, you might not know a pund sign is called a hash, that an exclamation
is called a bang. You might not realize it's handled by the OS instead of
some part of Ruby. You might not know that it isn't just some comment with
special meaning in the same way that Foo#bar is.

When you have no context, figuring out what to google for is much more
difficult, and when you do find an explanation, it may not make sense
because it isn't congruent with the premises in your head. If he had found
something explaining it, he might have thought it was talking about
something else, because it's talking about executable *nix programs, and
maybe he thought it was just a comment. And if he did think it was a
comment, what would he google for? "ruby comment exclamation" ? The results
aren't as helpful as the query you recommended, but even the query itself
assumes knowledge that is elusive to beginners.

···

On Wed, Apr 25, 2012 at 5:12 AM, Jan E. <lists@ruby-forum.com> wrote:

Josh Cheek wrote in post #1058231:
> On Wed, Apr 25, 2012 at 12:51 AM, Thought M. <lists@ruby-forum.com> > > wrote:
>
>> Sorry, I just didn't think is was a big deal to ask a question about my
>
> response I received.
>>
>>
> Don't worry about it, some people don't remember what it's like to be
> new.

No, this has nothing to do with being new. It's a matter of using the
right source for certain information.

Sure, you can always hope for someone that will explain everything step
by step. And if you actually find a "personal tutor", great! But you
should also know where to find things on your own, as it will save you
and others a lot of time.

Things like the "hash bang line" or Linux file properties are
well-documented basics. It's a matter of seconds to find the right
Wikipedia article and excellent tutorials. So why post the question in a
forum and wait for somebody else to do the work?

I'd rather use the forum *after* having done some research on my own.
Then you actually get to the interesting points.

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

I have to say, I love newbies like Thought M who are very, VERY new to programming, but really want to learn. And I also love the great people on lists such as this who help them out. Without both of these people, there would be no Ruby community.

I agree with Jan as a matter of Netiquette and efficiency that one should do all possible research first before asking questions. But as Josh points out, when you are brand new, you really have only the simplest idea of what questions to even ask (whether of Google or anywhere else).

I'm sure as our new community member develops as a programmer, more will be asked of him/her, especially in regards to doing some homework before posting. In the meantime, Thought M, welcome aboard! Glad to have you in the community.

steven

···

On Apr 25, 2012, at 4:12 AM, Jan E. wrote:

Josh Cheek wrote in post #1058231:

On Wed, Apr 25, 2012 at 12:51 AM, Thought M. <lists@ruby-forum.com> >> wrote:

Sorry, I just didn't think is was a big deal to ask a question about my response I received.

Don't worry about it, some people don't remember what it's like to be
new.

No, this has nothing to do with being new. It's a matter of using the
right source for certain information.

[...]

I'd rather use the forum *after* having done some research on my own.
Then you actually get to the interesting points.