I need to learn

Thanks for the response. I'm actually interested in TextMate as well.
Do you know if I can create my own auto completion snippets in TextMate.
For instance, I currently use an editor where I can assign any character
sequence to a code snippet. Then if I type the character sequence and
hit the space bar, the code snippet is entered.

You can do this with TextMate although the tab key is the key used to complete code snippets. For a particular (i.e., frequently used) snippet, dedicated shortcuts can assigned in place of tab completion if you so wish. For instance, if you highlight the two lines

foo = bar
zot ||=

and hit cntrl-shift-W, inserts the code snippet

begin
    foo = bar
    zot ||=
rescue Exception => e

end

The 'Exception' and the 'e' are place holders. Hitting tab will select them for immediate in-place editing.

I also use the auto completion a lot just for long method names; I type
one or two characters and hit the space bar, and bang, the method name
is inserted. It's very easy to add new character sequences and the
corresponding code I want attached to the character sequence. It's also
an extremely fast to have the space bar as the trigger for the auto completion.

TextMate maintains auto-completion for all the tokens you have in an edit buffer. You don't have to specify any character sequences. The escape key is the auto-completion key. You type the first few characters of a token and hit escape. If the first completion offered isn't the one you want, hit escape again. The completions are offered in most-recently-used order.

Regards, Morton

···

On Mar 12, 2007, at 4:13 AM, 7stud 7stud wrote:

Umm, no I didn't. 7Stud 7Stud did. Just for the record I do know how
to find the /usr/local directory, and those other things <G>

···

On 3/13/07, John Joyce <dangerwillrobinsondanger@gmail.com> wrote:

On Mar 13, 2007, at 3:48 PM, 7stud 7stud wrote:

> Rick Denatale wrote:
> ... unfortunately I can't even find the /usr/local directory

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

If anything, you might be a bit lost at times if you ask too many questions in the first chapter or 2 of Ruby for Rails. When he says a breadth first approach, he means it. You create a simple rails app right away, and you don't get much explanation, so if you start to tinker you will wonder why things are kind of incomplete. They are. It is an attempt to take you through the overall process all at once.
Then he breaks it down a bit more. Explaining some things, like how somethings in Rails are the way they are because of how Ruby can do things. That's true. As you get going though, you will want and should stop and get the Pickaxe book. It really is indispensible. The only bad thing is that it is not sold as a two volume set rather than as one behemoth monster that is half reference and half tutorial. It would be much easier to keep the reference half at home and take the other with you or vice-versa. (pragmatic does sell pdf versions of its books though!)

...
>One thing I liked about it: detailed installation
>instructions. Not such a big deal for windows users because of one
>click installation packages, but there are detailed installation
>instructions for Mac OS 10.4, and separate installation instructions for
>Linux. It's true there are installation instructions for Mac OS 10.4 on
>the net, but unfortunately I can't even find the /usr/local directory
>where everything is supposed to be installed. Am I supposed to create
>that directory? Who knows. I hate installation instructions like that;
>you feel lost before you can even start.

This IS one thing with Ruby for Rails doesn't cover. There are
resources to help, such as the rails web-site and the rails mailing
list. On the other hand if you really need such detailed instructions
AWDWR does a very good job of leading you step by step.

I tend to feel that the appropriate development platform for any
non-.NET and non-ColdFusion web development is a unixlike OS. For
people learning from their homes, then, either Linux or *BSD is probably
what you should be learning. Yes, it's entirely possible to learn on MS
Windows, and I'm fully aware that it's not always practical to get a new
OS up and running, but it's important enough so that if you have
reasonable opportunity to do so, you should definitely consider getting
some kind of free unix running and use that.

One reason is that in deployment Rails benefits from a unixy
environment. For instance, remote access is better protected by SFTP
than FTP, and free unices provide that capability by default whereas
with MS Windows setting up an SSH server to handle SFTP is a bit of a
chore. It's also the case that shared hosting solutions offering Rails
are, as far as I've seen thus far, all Linux and FreeBSD systems.

One of the best advantages to learning Rails on a free unix platform,
though, is installation. When I first got Agile Web Development with
Rails, I read through the section on installation -- then I ignored it,
and typed in "apt-get install rails" at the command line. Voila,
installed.

One thing I like about AWDWR 2nd ed, as opposed to Ruby for Rails is
that it covers migrations and uses them from the beginning to do
database setup and schema evolution. Ruby for Rails does this using
mysql commands. Some might like that better, but I prefer to stick
with Ruby and Rails for this. My first encounter with Rails was using
the 1st ed of AWDWR, which was before migrations, when I found out
about them later, I slapped my head like those commercials "Wow! I
could have had a V-8" (apologies to those who aren't attuned to US
commercials, V-8 is a mixed-vegetable juice).

I have the first edition, so unless you're talking about migrating web
applications from other languages/frameworks to Rails, I'm afraid I
don't know what you're talking about at first glance.

···

On Tue, Mar 13, 2007 at 10:42:12PM +0900, Rick DeNatale wrote:

On 3/13/07, 7stud 7stud <dolgun@excite.com> wrote:

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
This sig for rent: a Signify v1.14 production from http://www.debian.org/

Let's just say that irb is worth learning to use and useful to know. It can be a lot quicker than Creating a new file, changing permissions on it and executing it.

I think a lot depends on one's work habits. I have TextMate open all the time, but not Terminal. So it's quicker for me to evaluate snippets in TextMate than to open a terminal window and fire up irb. There is no need to set permissions to run code from TextMate.

You can explore side effects and snippets very quickly. You can even open a file's contents in irb. One thing is for sure, if you have Ruby on a system, you have irb.
While learning Ruby, irb is useful.
TextMate is easy enough to start using, but like all good editors there is a learning curve.

James Edward Gray II can be your friend here. First, there's his book "TextMate Power Editing for the Mac" and then there's his screencast "Ruby Unit Tests and More" (free download from iTunes Store -- search key "TextMate").

The auto completion isn't what you might expect from a full IDE like XCode or VisualWhatever.

You're right, but it works well all the same.

But it is a good quality app with a small footprint, not demanding of the system, and pretty robust.
The cool thing is the way TextMate just implements existing OS X software to do things like test run your code or validate or preview pages. It's really sort of a testament to the volume of good libraries in the Cocoa framework being used in ways they are meant to be used.
At first I wasn't sure if it was worth the price, but the more I used it, I quickly felt it was worth more.

Regards, Morton

···

On Mar 12, 2007, at 4:51 AM, John Joyce wrote:

Morton Goldberg wrote:

When I'm actually writing "serious" Ruby code, of course, I save it to a
file in my text editor (I use Vim for that). I find that irb serves as
an indispensable aid a lot of the time, however. Your mileage may vary.

Is there a way to get Vim to automatically indent code?

the tab key is the key used to
complete code snippets.
...if you highlight the two lines

foo = bar
zot ||=

and hit cntrl-shift-W, inserts the code snippet

I don't get the digit gymnastics that most text editors require you to
perform to use auto completion. Is there no way to bind the auto
completion to the space bar in TextMate? If you've never coded with
space-bar auto-completion, you haven't lived! The type of auto
completion I'm talking about seems like such a simple feature to
implement: you have a flat text file with a list of character sequences
and the corresponding code(phrase, name, whatever), and then the typing
the characters plus hitting the space bar produce the code.

Personally, I've never really liked the Xcode, MS Visual C++ style of
auto completion where a list pops up--it's just too slow to find what
you want in the list. I just started using Xcode, and I don't have
anything favorable to say about it. I can't even get it to properly line
up nested braces when using this style of braces:

void myFunc()
{

}

I mean matching up braces has to be the most basic requirement of any
IDE, but Xcode(2.4) can't do it for nested braces. Ridiculous.

Sorry to the op for the thread drift. I also want to thank everyone
else for the really insightful posts on good Ruby books and text
editors.

···

On Mar 12, 2007, at 4:13 AM, 7stud 7stud wrote:

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

Umm, no I didn't. 7Stud 7Stud did. Just for the record I do know how
to find the /usr/local directory, and those other things <G>
-- Rick DeNatale

Sorry about that. I got a little over-zealous with the cropping, in a hurry. wasn't direct at anybody in particular, at anyone thinking of web apps and Ruby and Rails as doable with no understanding of *nix.

Umm, no I didn't. 7Stud 7Stud did. Just for the record I
do know how to find the /usr/local directory, and
those other things

You won't be able to find in on Mac OS 10.4!

~$ ls -al /usr
total 0
drwxr-xr-x 9 root wheel 306 Feb 11 19:03 .
drwxrwxr-t 31 root admin 1156 Mar 12 16:20 ..
drwxr-xr-x 740 root wheel 25160 Feb 26 14:45 bin
drwxr-xr-x 230 root wheel 7820 Feb 11 19:04 include
drwxr-xr-x 273 root wheel 9282 Feb 11 19:25 lib
drwxr-xr-x 72 root wheel 2448 Feb 11 19:03 libexec
drwxr-xr-x 199 root wheel 6766 Feb 11 19:03 sbin
drwxr-xr-x 50 root wheel 1700 Feb 11 19:03 share
drwxr-xr-x 5 root wheel 170 Aug 10 2006 standalone

···

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

7stud 7stud wrote:

Morton Goldberg wrote:

When I'm actually writing "serious" Ruby code, of course, I save it to a
file in my text editor (I use Vim for that). I find that irb serves as
an indispensable aid a lot of the time, however. Your mileage may vary.

Is there a way to get Vim to automatically indent code?

I figured it out.

lol. Lookie what I found:
http://newbiedoc.sourceforge.net/tutorials/vim/personal-vim.html.en

···

On Mar 12, 2007, at 4:13 AM, 7stud 7stud wrote:

-------------
:ab abbreviation Full text, spaces are ok

What happens is when you type the abbreviation in vim, as soon as you
hit the space bar it is expanded to the full text. The abbreviation dmv
in the prior example would expand to "Department of Motor Vehicles." If
you close vim these settings are lost unless you commit them to your
.vimrc file.
-------------

Here's my new .vimrc file:

set autoindent "keeps the indenting the same when you hit
return"
syntax on "turns on syntax highlighting
ab sf someName "auto-completion sequence: type abbreviation,
hit space bar to expand

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

Morton was showing an unusual TextMate example above. Typically in TM you type a sequence and push tab. For example, try these in TM:

ea-tab
inj-tab
ase-tab

James Edward Gray II

···

On Mar 12, 2007, at 5:28 AM, 7stud 7stud wrote:

Morton Goldberg wrote:

the tab key is the key used to
complete code snippets.
...if you highlight the two lines

foo = bar
zot ||=

and hit cntrl-shift-W, inserts the code snippet

I don't get the digit gymnastics that most text editors require you to
perform to use auto completion. Is there no way to bind the auto
completion to the space bar in TextMate? If you've never coded with
space-bar auto-completion, you haven't lived! The type of auto
completion I'm talking about seems like such a simple feature to
implement: you have a flat text file with a list of character sequences
and the corresponding code(phrase, name, whatever), and then the typing
the characters plus hitting the space bar produce the code.

You're right -- it probably does depend to some extent on work habits.
For instance, I typically have several windows open, including both a
window for Vim and others for irb, command line execution, et cetera.

···

On Mon, Mar 12, 2007 at 07:20:17PM +0900, Morton Goldberg wrote:

On Mar 12, 2007, at 4:51 AM, John Joyce wrote:

>Let's just say that irb is worth learning to use and useful to
>know. It can be a lot quicker than Creating a new file, changing
>permissions on it and executing it.

I think a lot depends on one's work habits. I have TextMate open all
the time, but not Terminal. So it's quicker for me to evaluate
snippets in TextMate than to open a terminal window and fire up irb.
There is no need to set permissions to run code from TextMate.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"The measure on a man's real character is what he would do
if he knew he would never be found out." - Thomas McCauley

Umm, no I didn't. 7Stud 7Stud did. Just for the record I
do know how to find the /usr/local directory, and
those other things

You won't be able to find in on Mac OS 10.4!

You just create it if it isn't there.
Very simple.
This makes it easy to follow standard installations elsewhere as well.
It also makes it real easy to delete everything if you want/need to.
Just need to learn a little about Bash and your $PATH
be careful, the $PATH in your shell can be loaded from multiple dot files.
They are standardized. They do load in a particular order. If you have modified your $PATH already in one of the dot files, you may need to care where you modify it again.
  (again you do need some Unix skill or references if you don't have it)
  (again the reason I recommend the OReilly Unix in a Nutshell, they give a good and fast rundown on the Bash shell. The Linux in a Nutshell book is almost identical, but doesn't cover the differences among nixes)

You will also be glad to have a little MySQL (or the database of your choice) under your belt or in your library. Sorry, but there are no easy magic bullets for everything.

Let's try that again:
Here's my new .vimrc file:

set autoindent
syntax on
ab sf someName

···

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

Actually, the point I wanted to get across was that, for code snippets, the user can change from tab-invoked completion to shortcut-key invocation (or vice-versa) at will. As usual, I didn't express myself very clearly.

Regards, Morton

···

On Mar 12, 2007, at 8:32 AM, James Edward Gray II wrote:

On Mar 12, 2007, at 5:28 AM, 7stud 7stud wrote:

Morton Goldberg wrote:

the tab key is the key used to
complete code snippets.
...if you highlight the two lines

foo = bar
zot ||=

and hit cntrl-shift-W, inserts the code snippet

I don't get the digit gymnastics that most text editors require you to
perform to use auto completion. Is there no way to bind the auto
completion to the space bar in TextMate? If you've never coded with
space-bar auto-completion, you haven't lived! The type of auto
completion I'm talking about seems like such a simple feature to
implement: you have a flat text file with a list of character sequences
and the corresponding code(phrase, name, whatever), and then the typing
the characters plus hitting the space bar produce the code.

Morton was showing an unusual TextMate example above. Typically in TM you type a sequence and push tab. For example, try these in TM:

ea-tab
inj-tab
ase-tab

John Joyce wrote:

Umm, no I didn't. 7Stud 7Stud did. Just for the record I
do know how to find the /usr/local directory, and
those other things

You won't be able to find it on Mac OS 10.4!

You just create it if it isn't there.
Very simple.
This makes it easy to follow standard installations elsewhere as well.
It also makes it real easy to delete everything if you want/need to.
Just need to learn a little about Bash and your $PATH
be careful, the $PATH in your shell can be loaded from multiple dot
files.
They are standardized. They do load in a particular order. If you
have modified your $PATH already in one of the dot files, you may
need to care where you modify it again.
  (again you do need some Unix skill or references if you don't have it)
  (again the reason I recommend the OReilly Unix in a Nutshell, they
give a good and fast rundown on the Bash shell. The Linux in a
Nutshell book is almost identical, but doesn't cover the differences
among nixes)

You will also be glad to have a little MySQL (or the database of your
choice) under your belt or in your library. Sorry, but there are no
easy magic bullets for everything.

I'm about half way through the Wrox book "Beginning Unix", which has so
many omissions and errors, I would not recommend it to anyone--although
figuring out all the errors has taught me a lot. The problem I find is
that there are enough differences between Unix and OS 10.4.7, that I
never know whether a missing 'thing' in OS X should be created or
whether the Mac uses something else to do the same thing. For instance,
crond. That daemon isn't present on OS X 10.4.7. Should I start it?
No! Mac uses a new process called lauchd to control all processes in a
methodical fashion--instead of the adhoc patch on patch on patch mess
that Unix has evolved into(that from an article I found praising
launchd, which Apple made open source).

So, when I can't find /usr/local, I wonder if there is some other
directory OS 10.4.7 looks to instead. I scoured google and I can't find
ANY mention of /usr/local not being present in OS 10.4.7.

You just create it if it isn't there.
Very simple.

What permissions does it need?

···

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

7stud 7stud wrote:

John Joyce wrote:
  

Umm, no I didn't. 7Stud 7Stud did. Just for the record I
do know how to find the /usr/local directory, and
those other things
        

You won't be able to find it on Mac OS 10.4!
      

You just create it if it isn't there.
Very simple.
This makes it easy to follow standard installations elsewhere as well.
It also makes it real easy to delete everything if you want/need to.
Just need to learn a little about Bash and your $PATH
be careful, the $PATH in your shell can be loaded from multiple dot
files.
They are standardized. They do load in a particular order. If you
have modified your $PATH already in one of the dot files, you may
need to care where you modify it again.
  (again you do need some Unix skill or references if you don't have it)
  (again the reason I recommend the OReilly Unix in a Nutshell, they
give a good and fast rundown on the Bash shell. The Linux in a
Nutshell book is almost identical, but doesn't cover the differences
among nixes)

You will also be glad to have a little MySQL (or the database of your
choice) under your belt or in your library. Sorry, but there are no
easy magic bullets for everything.

I'm about half way through the Wrox book "Beginning Unix", which has so many omissions and errors, I would not recommend it to anyone--although figuring out all the errors has taught me a lot. The problem I find is that there are enough differences between Unix and OS 10.4.7, that I never know whether a missing 'thing' in OS X should be created or whether the Mac uses something else to do the same thing. For instance, crond. That daemon isn't present on OS X 10.4.7. Should I start it? No! Mac uses a new process called lauchd to control all processes in a methodical fashion--instead of the adhoc patch on patch on patch mess that Unix has evolved into(that from an article I found praising launchd, which Apple made open source).

So, when I can't find /usr/local, I wonder if there is some other directory OS 10.4.7 looks to instead. I scoured google and I can't find ANY mention of /usr/local not being present in OS 10.4.7.

You just create it if it isn't there.
Very simple.
    
What permissions does it need?

$ cd /usr
usr$ ls -l
total 0
drwxr-xr-x 8 root wheel 272 Nov 18 16:50 X11R6
drwxr-xr-x 742 root wheel 25228 Feb 17 17:25 bin
drwxr-xr-x 232 root wheel 7888 Mar 20 2006 include
drwxr-xr-x 270 root wheel 9180 Mar 6 20:13 lib
drwxr-xr-x 71 root wheel 2414 Oct 1 12:09 libexec
drwxr-xr-x 8 root wheel 272 Dec 18 2005 local
drwxr-xr-x 205 root wheel 6970 Nov 28 21:41 sbin
drwxr-xr-x 48 root wheel 1632 Mar 19 2006 share
drwxr-xr-x 3 root wheel 102 Mar 24 2005 standalone

Timothy Hunter wrote:

usr$ ls -l
drwxr-xr-x 8 root wheel 272 Dec 18 2005 local

Thanks

···

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

If you're using OS X, 10.4.9 came out today.
But more importantly, check out the HiveLogic site.
www.hivelogic.com
They've got lots of good info on installation of Ruby and Rails an so on.
Just be careful, they have multiple versions of the install tutorial, some are older than others, so if you reach the site via a link or search engine, you might just get an out-of-date version of the install.

Frustration is part of the process with learning unix and using it at the same time. What you soon discover is that it is a miracle that all this stuff (or any application) works because there are so many dependencies and things can be different from machine to machine. Then again you might start to understand why commercial software is so bloated these days... (they include everything they didn't write, but use)

John Joyce wrote:

If you're using OS X, 10.4.9 came out today.
But more importantly, check out the HiveLogic site.
www.hivelogic.com
They've got lots of good info on installation of Ruby and Rails an so
on.
Just be careful, they have multiple versions of the install tutorial,
some are older than others, so if you reach the site via a link or
search engine, you might just get an out-of-date version of the install.

Frustration is part of the process with learning unix and using it at
the same time. What you soon discover is that it is a miracle that
all this stuff (or any application) works because there are so many
dependencies and things can be different from machine to machine.
Then again you might start to understand why commercial software is
so bloated these days... (they include everything they didn't write,
but use)

Thanks, I've looked around over there.

The downloads for the new OS's are something like 3 days long for me, so
I'm not too keen on upgrading.

···

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