From: Christopher Dicely Date: 2009-04-14T00:05:19+09:00 Subject: Re: newbie confusion and dejection On Sun, Apr 12, 2009 at 9:00 PM, Reg wrote: > Over the years I have taught myself to program in C, C++, and VB to > build apps to run in WIndows, along with the scripting languages > necessary to set up a website > I have built websites using PHP, Ajax, and MySql  but am just a > hobbyist and my basic knowledge of how systems work is very patchy. > I have limited experience of linux, enough to get me by with what I > need to use SSH when necessary on my website's shared server. > > Now, for my sins,  I am trying to learn RoR. > > I have no problem following the language tutorials but I am lost when > it comes actually running a ruby app or script in windows (or anywhere > else for that matter). I had been hoping to use RoR on my website. > I can create a Rails framework on the server but decided I needed to > learn more about Ruby before I did any more work there. > > I have installed the following: > InstantRails > Cygwin > > The Ruby directory has ruby.exe which opens a command line window and > rubyw.exe which does nothing when I click it. Neither of those should normally be clicked (you could run ruby.exe and type code into the console window and then hit Ctrl-Z and it would run the code, but that's not really a good way to work!); they are the interpreter executables. They should be invoked with a command line that includes the script to execute (usually) along with other options, if needed. Whatever basic Ruby book you have should have a section on running Ruby (in Programming Ruby, its in Chapter 1, "Getting Started", under the heading "Running Ruby", which is on pp. 5-7 in the second edition.) > >  I am using the Pragmatic Programmers Guide and Simply Rails2 by > Patrick Lenz as my learning tools. Which Pramatic Programmers book are you referring to? _Programming Ruby_ ("the Pickaxe") or _Agile Web Development with Rails_? The first is good for learning Ruby, the second is good for learning Rails but does very little to teach you how to use Ruby. It sounds like you need more on getting off the ground with Ruby (and maybe more on the Windows command-line environment, which unfortunately I can't give you any pointers on, being spoiled, in a sense, from being raised in the era of DOS when there wasn't a choice besides learning the command line. > > I am wallowing about in irb and the Ruby console opened from  the > Rails control panel playing about with classes etc and learning the > syntax of the language but achieving nothing else. The console seems > to be a very limited playground when it comes to trying out things > quickly. e.g. in irb I cannot paste anything into the console. You can paste into irb the same way you paste into any console window in Windows, but note (that because Ctrl+ combinations have special meanings in the console), this isn't the same way you paste into other apps. And since the Windows Command Prompt window doesn't have a menu bar, you might not even no it had menu commands other than the normal window controls that are attached to the application icon, but it does; go to the "C:\" icon in the corner of the window, select Edit, and then Paste to paste material from the clipboard in to the console window. (Edit->Mark and then either Enter on the keyboard or Edit->Copy to copy from the console window.) >  When I learn a language I usually manage to cobble together a simple > hello world type of executable app or script and build on my mistakes > from there. but I cannot work out how to do this or get a ruby script > running. Suppose your script is saved in c:\Documents and Settings\Me\My Documents\source\ruby\helloworld.rb Open a command prompt window. It should open with c:\Documents and Settings\Me as the default path (where "Me" is your username on your windows machine.) 1. At the prompt, type cd my documents\source\ruby 2. You should now be in the right directory, so type ruby helloworld.rb 3. Your script should run. As for some questions later in the thread: There are lots of libraries (and one custom Ruby distribution, Shoes) for GUI app development in Ruby, but you are probably best getting the hang of Ruby before jumping into GUI development (though if you want to dive headfirst into that pool, Shoes is probably the easiest place to start; see www.shoooes.net, and yes, all those o's are necessary.) For IDE support, there are both Netbeans and Eclipse Ruby plugins (Netbeans Ruby plugin is available as part of the distribution); and some standalone Ruby IDE efforts. I prefer Netbeans Ruby support personally,