Empty string is true. Who here hasn't banged their head over that one?
[1,2,3].index(1)
# => 0
[1,2,3].index(4)
# => nil51–60 of 65 posts
Empty string is true. Who here hasn't banged their head over that one?
[1,2,3].index(1)
# => 0
[1,2,3].index(4)
# => nilEarlier quoted context omitted.
I can't recommend Eloquent Ruby at all: http://news.ycombinator.com/item?id=3803016
Really? Eloquent Ruby is one of the best Ruby books I've read - Russ Olsen is one of the best and most well respected technical writers out there. Design Patterns in Ruby is also excellent.
Earlier quoted context omitted.
I think the genesis if this problem is due mostly to the fact that programmers from a PHP background are used to not thinking about their server stack. That is changing though. In languages like PHP, it's possible (again, this is becoming less common) to run an ad-hoc PHP application by simply requesting the URL to the file. For example: * Drop myapp.php in to your httpd doc root * Request http://myserver.tld/myapp.p…
Are you saying Java deployment is complex? WAR files have been easiest to hot deploy for at least a decade - that too directly from your IDE with the click of a button. PHP deployment simplicity definitely beats everything - and Ruby will come last :(
It's almost like you're intentionally missing the point just so you can talk about Java infrastructure. I'm not here to throw rocks at Java. I'm a big fan of the TorqueBox project, which brings a lot of the power and flexibility enjoyed by Java devs to Ruby. "Complexity" isn't necessarily a bad word. More options means more complex, but sometimes you need those options.
I would like to get some advice from experienced Ruby hackers. Currently I am picking up Ruby through rails, which I am assuming is fairly common. I want to know the downsides to this and what people did to supplement their ruby knowledge beyond Rails. I eventually would like to write my own gems, contribute to open source, and so forth. I am absolutely not satisfied with just consuming Rails.
Uh, another good post on sharing the joy/pain of learning Ruby. Thanks for sharing. I have spent the past three weeks getting my head into Ruby (on the hopeful way to understanding Rails). With so many different languages and stacks, it makes the early stages extremely daunting for a beginner. I have found comfort in the following resources: 1) The only website I found that actually visualized how everything sits tog…
His summary of the object hierarchy of Ruby is probably more confusing than elucidating to most Ruby beginners, since he doesn't make it very clear that he's dealing with the distinction between instances and classes (which are themselves instances of Class). From the description it seems like he doesn't quite get the distinction himself, and one of the later examples is broken: "Array.new.methods - Object.methods" s…
You are wrong, classes are objects :)
1.9.3p194 :084 > Object.new.methods - Object.methods
=> []Earlier quoted context omitted.
No offence but perhaps you bought the wrong book? Eloquent Ruby is about style and design patterns, it's almost about the philosophy of Ruby code, best practises, aesthetics and the author's experiences. Books like that are fundamentally about taste and style and technique; they can't really be "wrong". You might disagree with the author and think you have a superior approach but to say that randomly googling the top…
Again the same discussion. I did not buy the wrong book. I knew exactly what I wanted Don't get me wrong, your reply is kind of abstract and philosophical. I explained why this book just failed and should not be recommended (mainly the style and really, really awkward, wacky examples) and I face abstract replies. Sometimes I think these comments and Amazon reviews are all faked by SEO/Webspam people driving the book'…
I would like to get some advice from experienced Ruby hackers. Currently I am picking up Ruby through rails, which I am assuming is fairly common. I want to know the downsides to this and what people did to supplement their ruby knowledge beyond Rails. I eventually would like to write my own gems, contribute to open source, and so forth. I am absolutely not satisfied with just consuming Rails.
I'd highly recommend The Well Grounded Rubyist by David Black http://www.manning.com/black2/ if you want a good intro to Ruby, I found it a much better intro than the Pickaxe
Earlier quoted context omitted.
I've actually found the documentation for projects in the Ruby community, on the whole, to be quite excellent. That being said, I can sympathize with the confusion getting things deployed, if only because there are so many options. The best bet for a beginning, IMHO, is to give Heroku a try when getting your first app deployed - they have some really excellent documentation. As a beginner, trying to deploying a rails…
I had difficulties getting heroku installed, even though I'm using ubuntu 10.04 LTS (as they are). It took many hours over several days, and several attempts. One problem is that their deb package doesn't specify ruby as a dependency. Another problem is that you have to examine their inlined bash install script to get to the .deb package to diagnose that. Another problem was that ubuntu's standard package repositorie…
I think you confuse your releases. Neither 1.8.7 nor 1.9.3 did break anything major. The only two releases with major breakage that should have affected you in recent years are 1.9.1 and 1.9.2.
The changes in ruby that break compatibility are listed in the release notes of every release.
> Look at Python, with 5-year support for Python 2 before breaking compatibility with Python 3. And Java, well, I've never heard of code being broken (assert could have, but never heard it happen).
Not sure what you mean about Python. Python has roughly the same policy as Ruby about API breaking changes.
The changes between Python 2.X and 3.X are also way larger than between Ruby 1.8.X and 1.9.X. Porting our code from 1.8 to 1.9 was not much work.
Earlier quoted context omitted.
I had difficulties getting heroku installed, even though I'm using ubuntu 10.04 LTS (as they are). It took many hours over several days, and several attempts. One problem is that their deb package doesn't specify ruby as a dependency. Another problem is that you have to examine their inlined bash install script to get to the .deb package to diagnose that. Another problem was that ubuntu's standard package repositorie…
> Then... all three versions of ruby that I tried (1.8, 1.9.1, 1.9.3) had changes that broke my tiny toy code. So astonishing, I'm not even mad. I think you confuse your releases. Neither 1.8.7 nor 1.9.3 did break anything major. The only two releases with major breakage that should have affected you in recent years are 1.9.1 and 1.9.2. The changes in ruby that break compatibility are listed in the release notes of e…
I'm just stating my (local) experience; I don't have a global god's-eye view of ruby. I'm not an expert in ruby; I'm just trying to get started. You seem to expect a beginner to know exactly which versions introduce a breaking change, and to read the release notes in detail - and understand them, which is difficult for someone who has not yet learnt ruby or its terminology.
When you start to have categories of breakage, as "major" or not, and defend porting code between versions as "not much work", it means you accept some breakage as normal. To me, a breaking change is one that causes code to stop working, and require extra labour. Python and Java don't do this (nor Windows, x86 or ARM).
Note that from 1.9.1 to 1.9.2 is not a major release. It's not even a point release. It's a point-point release with "major" breaking changes (according to you).
As I carefully said, this is a consequence of constant improvement (contrast with Java, c#, x86). (guessing: do you think it's partly due to the power of ruby making security harder?). The trade-off doesn't suit beginners. Note that back-compatibility is a "successful programming language problem" - no one complains if a toy language breaks. I'm just drawing attention to the downsides, because if uncorrected, in the long-term, it may lose the next generation of coders.
Look, I'm not out to attack Ruby; I like ruby. But this is a real problem. Disregarding it is a disservice to ruby.