301899-354036

301731-303506 subjects 302076-303929

Contionnal sum
301899 [pedrolito@la] I am wondering if it is possible to create a conditionnal sum.
+ 301908 [cmdjackryan@] Should be.
+ 301910 [fxn@ha hr f.] # untested
| 301916 [kbloom@gm il] Enumerable#sum is also in facets.
| 301926 [pedrolito@la] Thank you all for your messages. Yes it is a piece of code I am using in
+ 301914 [overlord@gm ] @total_amount = @orders.inject(0) do | sum, order |

Re: The Book Of Ruby - Free eBook
301909 [huw@da kn on] Just to clarify the 'level'... while it starts right at the beginning

Re: Watir: How to return a Watir::IE object for an existing
301911 [charley.bake] require 'watir'

Ruby 1.9 compatibility and performance
301918 [ruby@dj .n t] I have pretty much committed to Ruby for several projects - and two
+ 301927 [cmdjackryan@] Ruby 1.9 is a testbed of sorts for the eventual Ruby 2.0, and not
| 301929 [rick.denatal] Actually, not quite true.
+ 302177 [ryand-ruby@z] It is certainly slow and bloated if you do a full parse. If you switch
  302301 [james@gr yp ] Interesting.  Can you talk a little about why you prefer using regexen
  302340 [ryand-ruby@z] 1) damn fast.
  302341 [james@gr yp ] Yeah, I think those are great points.

[SUMMARY] The Turing Machine (#162)
301919 [matthew.moss] While waiting for 48 hours to pass, several examples of Turing Machine

Re: The Turing Machine (#162)
301936 [alpha.chen@g] Thanks for the writeup!
301942 [matthew.moss] No... the intent was that blanks be removed from the ends, but
+ 301944 [alpha.chen@g] Oops, my mistake! Goes to show how well I can read the spec...
+ 302043 [robert.dober] Great Quiz, I was offline but solved it anyway!

Matz: can we have rescue/else/ensure available in all blocks?
301937 [coderrr.cont] I recently posted a Ruby 1.9 wishlist (http://groups.google.com/group/
+ 301943 [matz@ru y- a] can be considered as
| 301945 [coderrr.cont] ...
+ 301947 [dev-null@pm ] If you write code that looks like that, maybe you should give Java a
  301949 [coderrr.cont] ...
  + 301967 [mneumann@nt ] from you
  | 302083 [coderrr.cont] ...
  + 301990 [dev-null@pm ] I'm certainly not convinced.  Maybe you could post a more real world
    302089 [coderrr.cont] ...
    + 302090 [coderrr.cont] ...
    + 302094 [dev-null@pm ] Ah, now I know why.  I ran this on ~/ and it only showed lines in a
      302108 [coderrr.cont] btw, that script _will_ give some false positives when there are other

Create an empty file of certain size
301938 [seo@mk yn mi] I need to create an empty (or at least garbage) file of a certain size.
301939 [ara.t.howard] fd.truncate( 2 ** 20 )
301940 [seo@mk yn mi] Thanks that's great, didn't know about that method!
301960 [shortcutter@] If it does not work on your platform, you can speed up your solution
301962 [phasis@gm il] size = 2**30

PickAxe tutorial (was What is the bes Ruby's book for beginners?)
301941 [dave@pr gp o] This is a topic that's been vexing me a lot in the last few weeks.
+ 301946 [alec@ar ro s] Thomas <dave@pragprog.com> writes
| 301983 [twscannell@g] Dave,
| 301993 [dave@pr gp o] These are good points. The PickAxe was never intended to teach
+ 301981 [doodpants@ma] I vote for keeping it the way it was in 1st. and 2nd. ed., with
+ 302802 [afmcc@bt nt ] Sorry to come to this late. I was fine with the OO stuff and I think
  302828 [shevegen@li ] I recommend the Pickaxe book.

Differing output for function moved from ruby 1.8 to 1.9
301948 [john.d.perki] Sup, fools?
301950 [john.d.perki] Here's an idea: a migration script that detects when and where a
301951 [cmdjackryan@] Maybe *the* chance to get your 15 minutes of fame, and deepen your
301952 [john.d.perki] I think a no-brainer prerequisite to this script would be 2.0 actually

A Couple of Questions Regarding Ruby Style
301953 [_mwryder@wo ] While working on my rational class I came up with a couple of questions
+ 301955 [cmdjackryan@] clearer.
+ 301956 [cmshea@gm il] On May 15, 10:52 pm, "Michael W. Ryder" <_mwry...@worldnet.att.net>
  302053 [_mwryder@wo ] I am really confused now!  Integer('0xa') = 10 but '0xa'.to_i = 0.  So
  302171 [gwtmp01@ma .] Float literals must have digits to the left of
  302239 [_mwryder@wo ] That I figured out a while ago.  My comment was that x = .25 is not

[ANN] rutema 0.7.0 Released
301968 [damphyr@fr e] rutema version 0.7.0 has been released!

Ruby gem newbie question
301969 [moose56@gm i] I am trying to create a ruby gem and I have a slight problem finding a
301972 [moose56@gm i] Ok, I found a fix. I am not sure if this is the correct way but it seems

Bug or feature?
301970 [igvt@ma l. u] Can anybody explain to me what does it mean?
301971 [shortcutter@] I guess it's because of the intermediate arrays that are created for
302274 [igvt@ma l. u] There isn't such a problem in 1.9.0.

iterate Array
301973 [sijo@ma xi n] I have created an array like
301974 [cdemyanovich] Using each is the most common way to iterate an array. Is there
301976 [sijo@ma xi n] I have a doubt regrding .collect That is why I asked tht.Is there any
301982 [shortcutter@] xxx.collect! {|n| n}

Responding to xmlhttp requests.
301978 [kyleaschmitt] Well I did something silly: I confused xmlrpc and xmlhttprequests, and

Problem in using structure in ruby
301980 [abhishek.v@t] I m new to ruby so kindly forgive for small mistakes. I m trying to

Ruby for web without rails
301985 [di3go.bernar] I dont really like frameworks, i tryed to work with rails and i didnt
+ 301986 [avdi@av i. r] Rack makes it possible to write scripts in a CGI style without caring
+ 301989 [jeremymcanal] Ruby in Practice (http://manning.com/mcanally/)
+ 302006 [cmdjackryan@] Well, there is mod_ruby (showing its age, though), there's fastcgi and
+ 302011 [ara.t.howard] just use rails/ramaze/merb and put everything in the view.  merb and
+ 302055 [eleanor@ga e] It's far from efficient, but there's a Camping presentation in my
| 302097 [di3go.bernar] I forgot camping, gonna give it a try, ive look the freatures, seams
+ 302128 [vidar.hoksta] Rack is a great place to start. My blog (http://www.hokstad.com/blog)
+ 302167 [albertschlef] Just for the record: there isn't really a serious project that uses
  302180 [di3go.bernar] yea, i dont know, maybe im traumatized with some big frameworks, i fell
  302182 [nefigah@gm i] No, that's like using a CMS to make your site. Using a framework is like

Email data
301987 [tim.wolak@gm] I have gathered data in my ruby script and would like to insert the data

[QUIZ] Obfuscated Email
301992 [matthew.moss] ...
+ 302134 [dangerwillro] Pretty interesting idea. The only catch is, anybody can run it
+ 302207 [list.push@gm] Here is my solution.
+ 302210 [mikael@ho lu] This is my first submission to a quiz, so excuse me if I mess up the =20
| + 302212 [sandro.pagan] ...
| + 302214 [cmdjackryan@] Only in what you can write and want to post.
+ 302225 [marcelo.maga] Interesting,
+ 302249 [steverhahn@h] ...
+ 302268 [mikael@ho lu] a,b=%Q=Z,O^NPO\r4_PV\\PI\x15^-\x0\v=,email=%\%%%c\%115%%# Mikael
+ 302282 [list.push@gm] Is this solution OK?
+ 302294 [mikael@ho lu] I'm bored;
+ 302328 [jgabrielygal] This is my solution. I just converted each letter in my email address

newbie questions
301994 [jason.lillyw] I feel like we need a Forum called, "Ruby Newbie" for people like me. Is
+ 301999 [caduceass@gm] or...
| 302030 [jason.lillyw] I found some issues with the above proposed solutions that I wanted to
| + 302056 [caduceass@gm] Yep.  You are correct.  Sorry 'bout that.
| + 302059 [flo@an er gr] To give you a more elaborate answer on why "nil" is printed... Lets
|   302070 [jason.lillyw] Perfect. Thank you both!
+ 302012 [adam.shelly@] This one usually works fine.
  302016 [jason.lillyw] Thank you! Yes, very helpful.

Pulling a class from a ruby file
301997 [hey_a_ray@ho] I have a single ruby file, consisting of a class definition, and some
302010 [avdi@av i. r] No.
302156 [vjoel@pa h. ] def external
302162 [mark@mw ld n] This is cool, but is it any different than
302164 [vjoel@pa h. ] Oh, that would too and maybe even be better, if your condition is just a

Ruby classes and << Syntax
302008 [c.schiessl@g] I have written a simple snippet of code and would appreciate any help
302013 [caduceass@gm] You are defining a class method and not a class instance method.  Do this...
302014 [c.schiessl@g] class <<Person
302129 [twscannell@g] class <<Person

How to use MySQL instead of sqlite3
302017 [achun@u. as ] The current release of Ruby on Rails uses sqlite3 as its default database.
+ 302019 [rimantas@gm ] For existing projects you should chage database.yml, for new projects
+ 302020 [cmdjackryan@] rubyonrails.com/community

Monkey Patching (definition)?
302028 [c.schiessl@g] class ExampleClass
+ 302035 [jameskilton@] That's really just open classes. The term Monkey Patching comes into
+ 302040 [cmdjackryan@] Yes and no. Monkey patching it is called, if one ignores potential side
| + 302047 [robert.dober] Sorry Philip to disagree slightly, re-opening a Core class is not
| | 302052 [flo@an er gr] Actually, I disagree with both definitions. I don't consider opening
| | + 302062 [robert.dober] Nor do I, as Philip was kindly giving the link to the recent
| | + 302066 [avdi@av i. r] I think this is one of the best definitions I've seen.  It should be
| + 302058 [micathom@gm ] ...
|   302080 [caduceass@gm] class C
|   302103 [micathom@gm ] In a class-based OO language with open classes like ruby, I'd actually
+ 302050 [justincollin] I would suggest open classes, re-opening classes, and creating the so
+ 302074 [rick.denatal] Actually, this code never reopens the definition of ExampleClass.

Speaking of free books
302033 [cmdjackryan@] Are there any plans to release Programming Ruby 2nd Edition as a free
302037 [dave@pr gp o] To be honest, I haven't thought that far ahead.
302042 [cmdjackryan@] Yeah, I read your little rant on the changes to Ruby 1.9 on your blog.
302071 [rick.denatal] There are some advantages to you to buy directly from the Prags.  For
302073 [cmdjackryan@] That is a good point. Though I fail to see why I should register a book.
302075 [rick.denatal] In order to get notified of updates and errata.  And if you have the
302088 [cmdjackryan@] Yeah, but I can do that manually, too. Though, automation is nice, I agree.

Not quite getting it.
302034 [roger.alsing] I'm trying to get whats Ruby is all about.
+ 302036 [roger.alsing] Before I get killed, I ment static typed..
+ 302039 [dave@pr gp o] I kinda think that this is the basis of programming in any language...
+ 302041 [jameskilton@] Very oft brought up question, and valid in some points.
+ 302044 [cmdjackryan@] Well, if it walks like a duck, and it talks like a duck, it probably is
+ 302057 [flo@an er gr] Actually, how do you guarantee those semantics in a statically typed
| 302077 [keithrbennet] Florian, your example is not a fair one; it illustrates an intentional
| + 302087 [caduceass@gm] I tend to think that using a RDBMS for data integrity with an overlay
| + 302091 [flo@an er gr] Actually, you don't have to go that far :). I know, the example is a
+ 302079 [ara.t.howard] then you will need a tall box.
| 302092 [flo@an er gr] Pragmatic Programming ;).
| 302109 [roger.alsing] So is it common practise to do it like this?
| + 302110 [nefigah@gm i] I wouldn't really say it's "common practice" in Ruby to do a bunch of
| | 302205 [rick.denatal] Good advice.
| | 302211 [roger.alsing] This kind of mindset is just asking for things to go wrong..
| | 302216 [rick.denatal] The type checking in the popular strongly typed languages like Java
| | 302220 [roger.alsing] Yes absolutely, static typed languages have a problem finding logical
| | 302226 [roger.alsing] Also, I'm not here to run a war about static VS dynamic typing.
| | 302229 [cmdjackryan@] In a sane way: Once the potential gets realized, the code gets adjusted.
| | 302235 [roger.alsing] Absolutely, I'm all with you on that one.
| | + 302270 [nefigah@gm i] I'm not sure what to say beyond what has been said.
| | + 302273 [cmdjackryan@] Call me naive, but I think that developers are able to read
| + 302115 [flo@an er gr] Yes, ActiveRecord checks for the type of Associations. I would not call
|   302119 [shevegen@li ] I am not a good ruby coder but the code I saw, and my own code as well,
|   302131 [keithrbennet] An interesting example of an intentional violation of method semantics
|   302168 [JAMES.T.MCLA] ...
+ 302219 [huw@da kn on] You can still have decent IntelliSense with Ruby. Take a look ;-)
+ 302834 [paddy3118@go] <<Snip>>

Class methods in modules
302038 [AdrianLloydS] This maybe a pretty obvious question - but I decided to ask anyway.
302049 [flo@an er gr] Class Methods of Modules are local to the module.
302072 [rick.denatal] Or for a module, which adds both class and instance methods, the
302160 [c.schiessl@g] Interesting - so class methods in modules don't make any sense at all?
302204 [rick.denatal] Well, since Modules aren't classes, they can't have class methods per

Re: Obfuscated Email
302045 [john.d.perki] Google catches my spam for me.
+ 302048 [robert.dober] Optimism is the root of all evil ;) and BTW do you really want to keep
| 302054 [john.d.perki] Dude! It's not like they do it by hand or something. They have 15-
| + 302063 [robert.dober] I do not approve of that kind of language and therefore do not read
| | 302069 [john.d.perki] Yeah, wait whilst I rephrase everything I write to conform to what I
| | 302111 [robert.dober] You got me right here. That's exactly what I was expecting, but I
| | 302130 [john.d.perki] 'frightening'.tr('fr',' l').gsub('ing', ' up')
| | 302132 [robert.dober] Seems you are a nice guy ;)
| + 302065 [cmdjackryan@] 48h grace period, in which the Quiz gets discussed (if necessary) or
|   302169 [matthew.moss] That may be my fault... I neglected to add the standard Ruby Quiz
|   302247 [matthew.moss] Y'know... I debated with myself whether I should have run this quiz.
|   302250 [mikael@ho lu] Apropos, is it customary to let a detailed breakdown accompany your
|   302260 [matthew.moss] It's fine either way... Most quizzes aren't going to be obfuscations
|   302262 [cmshea@gm il] Here's mine.  I avoided unpack and gsub and zip so that I could write
|   302346 [APNelson.L@g] x = [65, 110, 100, 114, 101, 119]
|   302441 [come.news@fr] "ERoPHFwYCxUTGyIeHxQLFVwWDRQ=
|   302478 [adam.shelly@] My sig follows.
|   302531 [matthew.moss] I want you guys to know that I have read all fifteen entries... Some
|   + 302534 [matthew.moss] And, of course, you now see that my brain hurts from reading Mikael's
|   | 302535 [matthew.moss] Arg... I meant %%\%c%%%%\%%[0]  or even  %%\%c%%?%
|   | 302544 [cmdjackryan@] I've seen a C 'Hello World' program using such a technique.
|   + 302681 [mikael@ho lu] After reading the summary, I realize I might have gone a bit over-=20
+ 302067 [matthew.moss] On May 16, 2:25 pm, DJ Jazzy Linefeed <john.d.perk...@gmail.com>
  302068 [cmdjackryan@] I get Russian spam. At least I think it is spam. ;)
  + 302084 [caduceass@gm] I have nightmares thinking some foreign power is sending me obfuscated
  + 302098 [matthew.moss] My primary meaning is that if your signature is stored in sig.rb, I
    302099 [john.d.perki] 1.8 or 1.9?
    + 302100 [billk@ct .c ] 1.Dude!
    + 302101 [matthew.moss] Generally, I'm running 1.8.6, but fully expect that someone will toss

[ANN] MiniExiftool 0.6.0 released
302046 [janfri.rubyf] MiniExiftool version 0.6.0 released!

Where in the world is Shugo Maeda?
302051 [ged@Fa ri MU] I've recently been trying to contact the maintainer of mod_ruby, Shugo
302176 [ryand-ruby@z] I'd start by writing core instead of talk. You'll trawl a richer pond.

[ANN] Radiant 0.6.7 "Mordant" Release
302061 [seancribbs@g] Radiant 0.6.7 "Mordant" resolves several security holes and includes

ruby 1.9 hates you and me and the encodings we rode in on so just get  used to it.
302064 [john.d.perki] def prep_file(path)
+ 302365 [matz@ru y- a] Regular expression operation does not work fine on broken strings.  It
| + 302408 [john.d.perki] It makes no sense, Matz.
| | 302425 [matz@ru y- a] Since today's OSes do not provide encoding information for files, you
| | 302426 [znmeb@ce ma ] I ran across this in Perl last week on a Windows machine. It seems the
| + 353765 [pfharlock@gm] Thanks for the suggestion of using ascii-8bit.  This solved my problem.
| + 353766 [albertschlef] So String#gsub always use the regexp engine (even if the pattern is a
+ 302370 [bbxx789_05ss] Just shut your eyes and hum the mantra, "Ruby doesn't get in your way.
+ 302429 [caduceass@gm] I love it.  Another person that wants a babel fish.  The irony is in
+ 353767 [b.candler@po] Yep. Ruby 1.9 will raise exceptions in all sorts of odd places,
  + 353768 [eregontp@gm ] 2009/12/27 Brian Candler <b.candler@pobox.com>
  | 353807 [b.candler@po] I don't know what you mean. If Dir.[] tells you that the file name is
  | + 353830 [eregontp@gm ] 2009/12/28 Brian Candler <b.candler@pobox.com>
  | + 353919 [eregontp@gm ] 2009/12/28 Brian Candler <b.candler@pobox.com>
  + 353777 [emiddleton@b] If you don't arbitrarily set the encoding, when will this be a problem?
  + 353868 [billk@ct .c ] Could you summarize what you feel the key difference of
    + 353871 [emiddleton@b] Taking a UTF-8 approach is easier to implement because you enforce all
    | 353945 [pfharlock@gm] I would like to chime in here and point out that sometimes you really
    | 353952 [emiddleton@b] I guess the problem is that if you do this no libraries will make an
    + 353980 [b.candler@po] As far as I can tell, both have two distinct data structures. One
      354001 [tony@me io .] To play devil's advocate here, Japanese users do routinely have to deal with
      354009 [b.candler@po] Sure; and maybe they even want to process these formats without a
      354036 [eregontp@gm ] I think you're quite a little pessimist here :)
threads.html
top