Nervous Nuby Starting Out!


#1

Anybody out there who’s patient and willing to give a newby help if
required?
I’m just starting out considering trying to learn Ruby as a first
language (considering Applescript as language 0.5). This is largely
because I
have a nebulous sense that Applescript is a collection of bad habits
waiting to pounce, especially if I’m learning it on my own. I’ve
‘proved’
with Applescript that I like scripting for personal hobbyist things
(usually involving tweaking something to taste, text munging and simple
small
things rather than trying to write a big huge app, so far). Suddenly
I’m bumping into limitations of Applescript for things I want to do, and
they’re not necessarily to do with hooking apps up (which I know how to
ask for help for from the mailing list) as much as fairly simple ‘unixy’
things to do with strings, simple XML and regexes, plus the stuff about
basic program design, flow control &c. Mainly attracted to Ruby by the
big huge user community and the idea that I could make a very cautious
attempt to learn from the ground up – mainly put off from it so far by
the impression that it is full of people much cleverer than I am!
I don’t want to hook Mac-specific stuff up to it until I’ve found my
feet a bit, and can always keep the little Applescripts I have that work
(I
know the Mac-specific stuff is there if required, because people keep
making jokes on the internet about how many of the developers working
on Ruby are doing it on Macs), but could do with sorting out an easy XML
parser (Hpricot has been suggested) and working with strings and XML
elements.(and regexes and hashes if I can cautiously start to get my
head
round them).
Also, it’s my current writing-a-blog-about project in the sense that,
looking for something to blog about that I’m thinking about and there
aren’t 99,999 blogs about already, I have started to write my
impressions so
far (including where I find mental road-blocks in Why’s excellent
friendly book) at:
macrubyist.livejournal.com

Please, if you think this is Far Too Ambitious, please pass over it in
discreet silence and I’ll get the hint eventually (probably after I’ve
been knocking my head against it for weeks or months and can’t do 'puts
‘Hello world’). Don’t discourage me yet. If you don’t think it’s a
completely cuckoo thing to do as a self-taught project, I’d love to hear
from
you. Especially if somebody would tell me it’s really easy to compile
from source under Darwin, because the last time I tried to compile from
source it was in an abortive attempt to learn Linux several years ago,
with
several unfriendly problems, and I’m scared.


#2

Dear Macrubyist,

welcome to the Ruby language!

Anybody out there who’s patient and willing to give a newby help if
required?

Many patient people are around on this here … just post your problem
:slight_smile:

I’m just starting out considering trying to learn Ruby as a first
language

There is a very nice tutorial on the web that presupposes almost
no knowledge about computing :

http://pine.fm/LearnToProgram/?Chapter=00

It will guide you from the very first beginnings to coding a program
that involves a dinosaur baby’s behavior, as it might be observed
in computer games, so you’ll really get a feel of the more complex
things in a very short time.

Suddenly
I’m bumping into limitations of Applescript for things I want to do, and
they’re not necessarily to do with hooking apps up (which I know how to
ask for help for from the mailing list) as much as fairly simple ‘unixy’
things to do with strings, simple XML and regexes, plus the stuff about
basic program design, flow control &c.

Well I don’t really know too much about Applescript and whether you
could
use it to do things you want, but Ruby certainly is able to do all these
things.
For xml parsing, there’s Hpricot and there are very nice tutorials about
it, also, there
is rio

http://rio.rubyforge.org/ ,

for i/o processing, which I use very often.
As you go, you’ll find that many other packages are distributed
in a nice way as “gems”, which you can easily install and work with
right away.

(and regexes and hashes if I can cautiously start to get my head
round them).

A hash is just a dictionary, that associates a set of keys to some
other set, the set of values. These can be of all kinds:

english_german={‘head’=>[‘Kopf’,‘Haupt’,‘Hydrozephalus’],
‘body’=>‘Koerper’,‘foot’=>‘Fuss’,number_of_feet_in_humans=>2}

For Regexps, there is a nice tutorial here:

http://www.regular-expressions.info/ruby.html

Ruby has extensive online documentation,

http://www.rubycentral.com/book/

Personally, I’ve also liked Hal F.'s book
“The Ruby Way” with its many examples a great deal.

Especially if somebody would tell me it’s really easy to compile
from source under Darwin, because the last time I tried to compile from
source it was in an abortive attempt to learn Linux several years ago,
with
several unfriendly problems, and I’m scared.

Ruby should be there right away, if you have OS 10.2 or later.
But it is certainly a good idea to be able to compile something from
source, if you want to work with packages … you can move this to
next week, though.


The (…and where are all those cartoon foxes, anyway? Could do with
seeing a friendly face…) MacRubyist

You can also learn Ruby from comics - here:
http://poignantguide.net/ruby

Best regards,

AQxel


#3

On Jun 17, 2007, at 5:42 AM, Axel E. wrote:

in computer games, so you’ll really get a feel of the more complex

things to do with strings, simple XML and regexes, plus the stuff
is rio
round them).

source it was in an abortive attempt to learn Linux several years


Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

Welcome !
There is also an AppleScript gem. Once you get comfy with Ruby and
RubyGems, you can use the AppleScript Gem to write Ruby in place of
AppleScript for scripting applications on your mac!


#4

The MacRubyist wrote:

Anybody out there who’s patient and willing to give a newby help if
required?

Welcome to Ruby!

Check out http://rubymentor.rubyforge.org/wiki/wiki.pl. This is targeted
directly at folks like you.

Good luck. Remember you can always ask questions here.


#5

“Axel E.” removed_email_address@domain.invalid wrote:

[very useful hints and bits snipped, will definitely look at this stuff]

Unfortunately, the very first real-world Ordinary Stupid Problem i
actually want to solve is that the flow of control in one of my
Applescripts
that creates text data and saves it in a small bunch of XML files (which
i use because my boyfriend pointed out that XML works well as a Better
Text File) is slightly wonky and won’t iterate through the last file, so
i’d actually quite like to implement the
iterate-through-small-bunch-of-files thing in Ruby. I know the basics of
using the DOM in as simple
and easy way as I can get away with.
Having just run irb so far because am slightly scared of getting into
compilation and package management without using binaries, (and I tried
telling Tiger to ‘require gems’ and it didn’t like that, which
presumably
means i have to download & compile) would you advise me to:
a) debug my Applescript properly by staring at it until I grow
cross-eyed, because debugging is good experience and then i won’t be
tempted to
jump ahead too far just to get something to work.
b) try to compile and install Gems so I can have a go at using the
packages that will give me an XML parser
or

c) Take a Deep Breath and start from the beginning with the Pickaxe and
Why’s cartoon book, desperately reining in my desire to work with any
real-world data at all until I’ve got the hang of the basics, at which
point I can ‘plumb in’ actual data, because the reason I want to have a
go
at Ruby In The First Place is to take a step back and learn from the
ground up to avoid the heaving mass of spaghetti code I can see in my
future if I keep learning Applescript as self-taught with nobody to talk
to.
The (…still nervous…) MacRubyist


#6

On Sun, 17 Jun 2007 19:05:05 +0900
The MacRubyist removed_email_address@domain.invalid wrote:

Anybody out there who’s patient and willing to give a newby help if
required?

I can tell you that this list is full of patient people. I have been
frequenting (and lurking on and off) this list for almost 6 months now
(maybe a little more) and I’ve gotten some great input and great help.

Someone pointed out the RubyMentor project which is an awesome resource.

Thanks,
Samantha

http://www.babygeek.org/

“Beware when the great God lets loose a thinker on this planet. Then all
things are at risk.”
–Ralph Waldo Emerson


#7

Don’t install gems.

Instead, install a more recent version of Ruby than what comes with oyur
mac.

First, download the graphic installer for ports or fink, then

port install ruby

or

fink install ruby

and you’re set.

Have you joined my RubyMentor project? Are they treating you nicely? :slight_smile:

Aur


#8

On 6/17/07, The MacRubyist removed_email_address@domain.invalid wrote:

i’d actually quite like to implement the
iterate-through-small-bunch-of-files thing in Ruby. I know the basics of using the DOM in as simple
and easy way as I can get away with.

That’s pretty much the first thing I did with Ruby, it’s fairly
simple, and a good way to learn.

Having just run irb so far because am slightly scared of getting into
compilation and package management without using binaries, (and I tried
telling Tiger to ‘require gems’ and it didn’t like that, which presumably
means i have to download & compile) would you advise me to:
a) debug my Applescript properly by staring at it until I grow
cross-eyed, because debugging is good experience and then i won’t be tempted to
jump ahead too far just to get something to work.
b) try to compile and install Gems so I can have a go at using the
packages that will give me an XML parser
or

I suggest ‘b’. No compile needed. Just download from rubyforge,
unzip it, and then run:
ruby setup.rb

c) Take a Deep Breath and start from the beginning with the Pickaxe and
Why’s cartoon book, desperately reining in my desire to work with any
real-world data at all until I’ve got the hang of the basics, at which
point I can ‘plumb in’ actual data, because the reason I want to have a go
at Ruby In The First Place is to take a step back and learn from the
ground up to avoid the heaving mass of spaghetti code I can see in my
future if I keep learning Applescript as self-taught with nobody to talk to.
The (…still nervous…) MacRubyist

Nothing to fear here. Give it a shot, you’ll be pleasantly surprised.


#9

On Jun 17, 2007, at 5:05 AM, The MacRubyist wrote:

Especially if somebody would tell me it’s really easy to compile
from source under Darwin, because the last time I tried to compile
from
source it was in an abortive attempt to learn Linux several years
ago, with
several unfriendly problems, and I’m scared.

This is a good set of compiling instructions for Ruby on Mac OS X:

http://hivelogic.com/narrative/articles/ruby-rails-mongrel-mysql-osx

Just skip the instructions for the applications you don’t need.

James Edward G. II


#10

It sounds as if you have many things that you want to do. That is a
good place to start. Programming Ruby is very helpful for getting
started. Everyday scripting with Ruby is a good one for getting an idea
for using Ruby in the way you suggest.

Just start small and put things together as you go. That works for all
disciplines and not just programming.

GL with Ruby!

p.s. You need not worry about compiling as it is not compiled.


#11

On Jun 18, 2007, at 10:17 AM, Lloyd L. wrote:

p.s. You need not worry about compiling as it is not compiled.

The Ruby executable is compiled, which is what the original post was
referring to.

James Edward G. II


#12

Dear MacRubyist,

Unfortunately, the very first real-world Ordinary Stupid Problem i
actually want to solve is …

it’s always good to work on or towards the solution of real world
problems - that keeps you focused … there are piles of dust
tossing themselves up on books I wanted to work through from A-Z
to get to know about some topic in a theoretic way – it never came
true.

Having just run irb so far because am slightly scared of getting into
compilation and package management without using binaries, (and I tried
telling Tiger to ‘require gems’ and it didn’t like that, which presumably
would you advise me to:

I would advise that you put off the idea that you must iterate
through files for, say, one day and try and work through
Chris P.'s book, which is on the web (see my last post).
It introduces you to some of the very basic
features of the language, and doesn’t take long to go through.
Just try some of his exercises and this will raise your mood,
because everything will work, and it will work much sooner
than for other computing languages.
You don’t need to install anything or compile anything for that.

After having completed Chris P.'s book, you will feel strong enough
to kill one the dinosaurs he makes you look at in the last chapter,
then you should follow the advice about how to get hpricot and/or
rio to work on a Mac ( just ask again if it doesn’t work),
and try some of the examples on the website tutorials of these
packages.

From the many responses you already got you can see that there are some
people around who can and will help you.

So, welcome again, and good luck,

Best regards,

Axel