18 Jul, 2009, Chris Bailey wrote in the 61st comment:
Votes: 0
The idea wasn't to make the most efficient program, I was just trying to illustrate some useful things to you. Creating your own classes and methods,
using +=/-= instead of var = var -1, loops using downto, attr_reader/writer/accessor for accessing internal variables, instance variables etc. I could make
the program a 1 liner if I wanted too. :P
18 Jul, 2009, Chris Bailey wrote in the 62nd comment:
Votes: 0
Well, it doesn't want to fit into one line because of stupid word wrapping :P
99.downto(0){|i|puts((i>0)?"#{i} bottles of beer on the wall,#{i} bottles of beer. Take one down, pass it around,#{i-1} bottles of beer on the wall.":"No more beer!")}
18 Jul, 2009, Igabod wrote in the 63rd comment:
Votes: 0
lol ok, point well taken. My mistake. Though the reason I went with count = count -1 is cause for some reason count -= 1 was registering as an error. Though I did try that when I was tired as hell and couldn't sleep so I might have mistyped something…

I just tried it again and yeah I must have mistyped it cause it works…

As for creating my own classes and methods. Methods are being discussed in the next chapter of the tutorial I'm using so I'll probably be getting into that soon. And classes are in the chapter after that so that is still a little advanced for me.

I'm moving slowly through this tutorial so that I can be sure I have the first steps down solidly before moving on to the next ones. I made a mistake when learning C, I didn't follow any sort of structured learning pattern. I didn't even learn the names of things for a couple years. All I did to learn C was download the low4 codebase and read it line by line file by file repeatedly till it made some sort of sense. Then I started actually changing small things. This isn't a very good learning method from my experience and I want to try and learn ruby the semi-right way. I'm not a good C programmer, but with a little structured learning, maybe I can be a good Ruby programmer. With the help of everybody here of course.
18 Jul, 2009, Chris Bailey wrote in the 64th comment:
Votes: 0
You are right, learning it step by step is a very good way to do it. Good luck, just remember we are here if you have any questions. When you finish that tutorial you might to check out rubylearning.com as it offers a FREE online course, instructed by Satish Talim and his several assistants. I went through the course once and became (for a short period) an assistant teacher so I know they are all great people to work with. =)
18 Jul, 2009, Igabod wrote in the 65th comment:
Votes: 0
Thanks, I'll definitely check that out.
18 Jul, 2009, flumpy wrote in the 66th comment:
Votes: 0
Chris Bailey said:
There is not a lack of Ruby IDE's as far as I know.


There's no lack, theres just no good/stable/free ides for 'dows, they're all pretty dire AFAIAC. I didn't know about the lack of nix support tbh. Guess they wany ppl to buy expensive macs. God knows why…

Chris Bailey said:
SciTe makes a good "lite" editor in windows, and there is always NetBeans. Most of your favorite IDE's have plugins or whatever to handle Ruby, and they do it well.


I've not tried SciTe but will give it a go. I suppose I've been spoiled by the likes of Eclipse, and that does have a ruby environment called Aptana Studios. However, it is utter utter rubbish atm, as it has so many bugs it is untrue. Netbeans sucks. If you're an Eclipse monkey, Netbeans feels like using a 10lb lump hammer to screw in a lightbulb. Plus, I disagree - neither NB nor Eclipse do Ruby very well. Maybe in 2 - 3 years yes. But to use commercially day to day? No way. [edit: I must also admit ppl have been raving about IntelliJ, but I think its commercial? no way the bods in the dept will fork out for it]

Chris Bailey said:
Personally I use Gedit with several plugins like the file pane browser, syntax highlighting, line numbers, shortcuts, bracket matching and line highlighting(There are probably more that I'm forgetting). It makes for an extremely light weight but full featured IDE that is highly customizable.


I will have a look at GEdit. But I shouldn't have to do this sort of thing!! Surely someone can come out with a Ruby specific plugin for eclipse or a standlone, eclipse standard IDE that does not suck ffs. If I start using text editors it feels like I've slipped back 10 years to the bad old days :(
18 Jul, 2009, Tyche wrote in the 67th comment:
Votes: 0
David Haley said:
As a general remark, high-level languages are often a lot of fun to work with at first; people compare the experience to "feeling free", "flying", etc. The nice thing about Ruby and Python in particular is that you have a huge standard library to solve many common tasks. Lua is in many ways a simpler and more elegant language, while being just as powerful, but is somewhat less appropriate for somebody who just wants to write general stuff because it doesn't come with "batteries included". Lua is more appropriate as a language to build domain-specific languages with, for example. I wouldn't want to put too much of a downer on all this enthusiasm, but I still have my doubts about the suitability of languages like this for writing very large systems.


Just some general remarks of my own…
I'm not into language or operating system advocacy. I have my own preferences and I don't particularly care enough about what others are using enough to pay attention to it.

In any event we already did the large, vary large, huge, enormous thing, and I concluded that it was…well…stupid. I'm a programming empiricist. We come up with models and we test them. If one is too lazy to define a model and test it, I don't think there is any point in arguing.
18 Jul, 2009, Igabod wrote in the 68th comment:
Votes: 0
just another question, is there some way for me to compile a single ruby file so that I can see what the errors are when I have some? I know it shows what the error is when I run the program and it hits a bad spot, but the window closes immediately upon an error. I'm using SciTE and the ruby program for windows.
18 Jul, 2009, flumpy wrote in the 69th comment:
Votes: 0
Tyche said:
In any event we already did the large, vary large, huge, enormous thing, and I concluded that it was…well…stupid.


We did too. The result does indeed suck old whore t*ts..

unfortunately our dept. head is a plank, and didn't listen to almost everyone who knows anything (you know, the ppl he pays to know)

ho hum
18 Jul, 2009, Idealiad wrote in the 70th comment:
Votes: 0
Igabod said:
just another question, is there some way for me to compile a single ruby file so that I can see what the errors are when I have some? I know it shows what the error is when I run the program and it hits a bad spot, but the window closes immediately upon an error. I'm using SciTE and the ruby program for windows.


Are you executing the file from within SciTE? Usually SciTE directs output to the the output pane regardless of whether the program's window opens. Like this:


20 Jul, 2009, Igabod wrote in the 71st comment:
Votes: 0
no I am executing it by double-clicking it in it's save location. I'll try running it through SciTE. Thanks.
20 Jul, 2009, Igabod wrote in the 72nd comment:
Votes: 0
Is there some special way to run it through SciTE? I have the output pane showing and nothing is showing up in there. I looked at all the options in each of the menu's but saw nothing that said anything that resembled "run". I'd appreciate someone pointing my ignorance out in this.
20 Jul, 2009, Idealiad wrote in the 73rd comment:
Votes: 0
No problem, it took me some time too to figure this out.

The place you want to start is the SciTE Toolsmenu. You'll see options for Compile, Build, Go, Stop Executing…you can add more but start with those.

If those options are unavailable they'll be greyed out.

To make them available:

  • first look in your ruby.properties file, probably located in your SciTE installation directory. Scroll to the end of the file and you should see something like this:

    if PLAT_WIN
    command.go.*.rb=ruby $(FileNameExt)
    command.go.subsystem.*.rb=1
    command.go.*.rbw=rubyw $(FileNameExt)
    command.go.subsystem.*.rbw=1
    command.help.*.rb=$(CurrentWord)!c:\apps\ruby\ProgrammingRuby.chm
    command.help.subsystem.*.rb=4

    if PLAT_GTK
    command.go.*.rb=ruby $(FileNameExt)

    command.name.1.*.rb=Check Syntax
    command.1.*.rb=ruby -cw $(FileNameExt)

    command.name.2.*.rb=Code Profiler
    command.2.*.rb=ruby -r profile $(FileNameExt)



    PLAT_GTK is if you're on linux (usually), and PLAT_WIN of course is for windows. Looking more closely at PLAT_WIN:

    if PLAT_WIN
    command.go.*.rb=ruby $(FileNameExt)
    command.go.subsystem.*.rb=1
    command.go.*.rbw=rubyw $(FileNameExt)
    command.go.subsystem.*.rbw=1
    command.help.*.rb=$(CurrentWord)!c:\apps\ruby\ProgrammingRuby.chm
    command.help.subsystem.*.rb=4


    There you see one of the Tool options, Go. You don't need compile or build naturally because Ruby is interpreted and not compiled.


  • Make sure Ruby is on your PATH…probably easiest way to set this is through the Control Panel/System Properties dialog, choose the Advanced tab, then Environment Variables, then look for Path in environment variables. Edit this and make it look like the other variables in the PATH string. You want it to point to your Ruby directory.


  • If all is working you should be able to hit F5 while in SciTE and launch your program. Note that setting command.go.subsystem to '1' puts you in Windowed mode…check the subsystem options in SciTE help, I think 0 is console mode.


  • You can add more options to Tools for different things…sometimes you can set up a syntax check or something like that depending on the language.


Let me know if there's a problem with that.
20 Jul, 2009, David Haley wrote in the 74th comment:
Votes: 0
Meh, Chris messed up the thread formatting with his silly one-liner. :rolleyes:
20 Jul, 2009, Idealiad wrote in the 75th comment:
Votes: 0
I know, I feel like I'm on the Mudconnector.
20 Jul, 2009, Chris Bailey wrote in the 76th comment:
Votes: 0
David Haley said:
Meh, Chris messed up the thread formatting with his silly one-liner. :rolleyes:


Seriously, that guy is such a douchebag. Who needs a one line 99 bottles of beer song anyways? Chris Bailey ftl.
20 Jul, 2009, Ssolvarain wrote in the 77th comment:
Votes: 0
Don't say that :(


(@mudconnect comment. C. Baily is a dork, as far as I'm concerned. I gave him a wedgie in elementary school.)
20 Jul, 2009, Chris Bailey wrote in the 78th comment:
Votes: 0
Oh man, I remember that too. I will never forgive you, those were my favorite underpants! :P
21 Jul, 2009, Ssolvarain wrote in the 79th comment:
Votes: 0
They did make a nice hat, though…
60.0/79