272534-273518 subjects 273066-300712

Gem ideas
272808 [dangerwillro] I have a few ideas I'd like to see the Gem tool. Please correct me if

Re: Please anyone help me!!
272867 [alex.shulgin] On Oct 6, 9:48 am, Vellingiri Arul <hariharan....@rediffmail.com>
272893 [shevegen@li ] That is just one individual among a group of thousands.
272899 [kazaam@ol co] It describes exactly what is needed for sockets. Also reading the doc could be helpfull but take care because some of the samples are broken:http://www.ruby-doc.org/stdlib/libdoc/socket/rdoc/index.html
272908 [mailing.mr@g] Check archives, this guy is creating new threads with every problem he
272909 [waleed.harbi] ...

popen in non-blocking mode
272872 [urizev@gm il] I want to execute a program which prompts for commads from standard
+ 272885 [ara.t.howard] IO.popen cmd, 'r+' do |pipe|
| 272949 [dan-ml@da 42] Except that doesn't work. If the subprocess doesn't flush its output,
| + 272961 [ara.t.howard] not directly, although setting the STDOUT.sync=true *before* running
| + 389137 [ruby-forum.c] this worked for me but is kind of lame
|   389139 [shortcutter@] Daniel's point is that you can do what you want in the Ruby script: it
+ 272886 [ara.t.howard] search the archives - it has a fatally flawed impl.
| 272890 [micathom@gm ] Thank you very much for the pointer.
+ 272889 [ara.t.howard] actually that will only help on *nix.  dunno if that helps the OP or
+ 272974 [nobu@ru y- a] Use PTY.
  273157 [urizev@gm il] What is PTY?
  273174 [ara.t.howard] ruby included a library for manipulating them.

Can I do this perl code the same in ruby?
272894 [kazaam@ol co] my $slct = IO::Select->new($server);
+ 272914 [ara.t.howard] nil
| 272986 [kazaam@ol co] Thanks for pointing me to this but the main problem at the moment is, that rubys select compaired to perls can't handle sockets but just arrays!?
| 272989 [logancapaldo] Arrays of _what_ do you think? Maybe array's of sockets? Actually
| 273006 [kazaam@ol co] Yes you have been right, also if this looks terrible now because:  myselec = IO.select([server]) fills myselec with [[socket]] so with 2 Arrays I have to extract with myselec[0][0]...somehow perl looks more intuitive in this case.
| + 273005 [kazaam@ol co] $SIG{CHLD} = sub { while (wait() > 0) {} };
| + 273169 [logancapaldo] to_read, to_write, erroed = IO.select([server])
+ 273137 [shortcutter@] As long as you are only copying between one pair of descriptors, you
  273183 [kazaam@ol co] ./httpsocket.rb:23:in `readline': end of file reached (EOFError)
  273192 [shortcutter@] What exactly do you mean by that?  If you create them in a sub process
  273202 [kazaam@ol co] #!/usr/bin/env ruby
  273221 [shortcutter@] The variable is called $VERBOSE.
  273230 [vjoel@pa h. ] Heh, the former is actually the example from webrick in the ruby
  273329 [kazaam@ol co] thx I will do so! I always used $Verbose and never noticed any problems. I always got warnings but I'm gonna trust you with it :)

Using Ruby on a generic ISP
272897 [summercoolne] I wonder how Ruby can be used on a generic ISP right now?
272902 [lists@su ve ] If the ISP doesn't have Ruby on their server, there's not very much you
272947 [dangerwillro] Not necessarily, as long as they allow you to compile /install

File association problems?
272901 [schmode93@ya] The other day, ruby was working fine for me. Then i was messing around
272976 [globyy3000@h] You need to remove that file association and re-implement the ruby

Ternary Usage
272904 [lists@gr gw ] New to Ruby. Having trouble with ternary statements.
+ 272905 [m.fellinger@] The ternary operator is not used very often, Ruby offers a different
| 272907 [lists@gr gw ] Ah, OK. Strange structure. (rhetorical Q:) Why read through all the
| + 272910 [cilibrar@gm ] condition && ifitstruedothis()
| + 272913 [ news@ja .f ] Ruby, unlike some (most?) languages, *always* requires an end for its if
|   272917 [lists@gr gw ] Thanks for piping up and saying "don't use that." I agree :-)
|   + 272921 [ news@ja .f ] Many, and I'd highly recommend the book.  But Ruby's a young language, and
|   | 272929 [lists@gr gw ] Cool, I'll get the book. I'm overseeing a Rails project, so I need to
|   | 272950 [dangerwillro] The Ruby Way is an excellent book for experienced programmers to get
|   | 272953 [ news@ja .f ] I know entire stores that carry nothing but outdated computer books.
|   | 272955 [jwkenne@at g] (Looking at my months-old book for GIMP 2.4....)
|   + 272923 [dblack@ru yp] There wouldn't be much point in having it if it didn't :-) It's a
+ 272906 [fxn@ha hr f.] That operator is called "ternary" because it needs 3 operands

Image libraries for Ruby?
272933 [phrexianreap] I'm trying to write out a script to help me sort out a bunch (more than
+ 272934 [ruby@ph li .] If they are all JPEG's that will work.  If not, google around and you'll
+ 272943 [ihatespam@ho] What's wrong with ImageMagick?  It'll do what you need...
  273059 [listbox@ju i] On 7-okt-2007, at 1:20, Just Another Victim of the Ambient Morality
  273116 [phrexianreap] I didn't want to use ImageMagick because it did a bit more than I wanted

Inserting records on a migration question
272941 [drgenejones@] I am trying to create a user_types table and insert two rows into it.
272942 [drgenejones@] Its ok, just realised I hadn't created the model first.
273251 [Rob@Ag le on] ...

The old File.rename not working again. . . .
272952 [pbailey@bn .] This always throws me. I keep getting "permission denied" messages when
272975 [nobu@ru y- a] Maybe on Windows?
+ 272999 [djberg96@gm ] Why would he need to open the file at all?
| 273000 [sepp2k@go gl] Because he's checking the first line of the file, not the filename.
| 273004 [djberg96@gm ] On Oct 7, 7:30 am, Sebastian Hungerecker <sep...@googlemail.com>
+ 273008 [pbailey@bn .] Yes, I'm on Windows. And, yes, it makes sense that it won't let me do it
  273012 [dolgun@ex it] opens the file, gets the first line, closes the file, and checks the
  273014 [pbailey@bn .] I want to rename the file(s), and, that's what's not working. I'm
  273025 [sepp2k@go gl] The code posted above gives you permission errors? Or your original code gives
  273032 [ news@ja .f ] Actually, the code above should give him
  273073 [pbailey@bn .] Yes, Jay, that worked! And, I beg your pardon, Nobuyoshi, because, I
  + 273074 [pbailey@bn .] "casual use of a block" not "black." Sorry.
  + 273075 [ news@ja .f ] Me too!  I've only been doing Ruby for a few years, and then only for play
  | + 273081 [phlip2005@gm] A FAQ on the C++ mailing list is "shouldn't C++ learn from Java and add a
  | + 273190 [pbailey@bn .] Well, I'd love to be able to give advice eventually in this forum, to
  + 273084 [dolgun@ex it] f = File.new(file)
    273219 [overlord@gm ] This is not C or Python, Ruby needs an end.
    273249 [w_a_x_man@ya] I think that should be
    273269 [overlord@gm ] Yeah, I correct one error and repeat another.
    273278 [w_a_x_man@ya] That's a violation of common sense.  '%!PS-Adobe' isn't going
    + 273280 [dblack@ru yp] For some reasons, I like #length for strings and #size for arrays.
    + 273282 [ news@ja .f ] But magic numbers suck.
      273359 [djberg96@gm ] That would only be true if vendors randomly and unexpectedly changed
      273362 [ news@ja .f ] No, not the magic(5) kind of magic number... :)  I don't think "%!PS-Adobe"

Hiding source code
272954 [mksm.sama@gm] I have written an app in Ruby for my company and I was the only one
+ 272956 [chippersbox@] Interpreted languages and shells (PHP, Python, Ruby, Perl, Bash, ZSH
| 272957 [chippersbox@] I should also mention, that using setuid on the ruby executable could
| 272964 [mksm.sama@gm] The setuid idea seems nice to me. Yes, it might uncover some security
| 272966 [chippersbox@] It seems that using setuid removes '.' from $LOAD_PATH. If you add
| 273171 [logancapaldo] As soon as you push '.' it's game over.
+ 272967 [yermej@gm il] I guess that's not really a Ruby question, but I have an idea...
| 272971 [dangerwillro] If you can't trust your worker, who can you trust?
| 272983 [chrisgame@ex] Yes, and going round the houses to hide the source doesn't exactly
+ 272972 [celtic@sa ry] I have a feeling there were more inbetween. Have a look to see what we
+ 273051 [REMOVE-CAPSb] If you don't want the source code to be visible you might consider a
+ 273341 [shaiguitar@g] i may have overlooked something but what is wrong with using chmod?
  273361 [logancapaldo] Ruby scripts are not ELF/Mach-O/PE/"whatever your system uses"
  + 273428 [dangerwillro] Well, the permissions settings need to include the UID of the process
  + 273438 [martindemell] Haven't tried this myself, but rubyscript2exe might work with chmod -r
    + 273451 [matiasbrutti] ...
    + 273457 [vjoel@pa h. ] rubyscript2exe unpacks to a tmp dir, and then loads the files more or

Multitasking and collecting results
272973 [lists@gr gw ] (new to ruby)
+ 272978 [lists@gr gw ] Oh wait, they're in order because that's the order I have them inserted
| 272991 [dolgun@ex it] Try the following to see some random order in the results. The threads
+ 272992 [no@sp m. le ] Ruby threads are a good thing - I wouldn't disparage them - but beware

plotting points on a map api
272977 [globyy3000@h] I want to plot points on a map of the united states based on what
272980 [trevor@um .e] ...

#sort_by and #sort_obj
272982 [drbrain@se m] I haven't seen this technique in the wild before.
+ 272987 [transfire@gm] Nice. In fact, it seems this could dethrone <=> as the primary method
| + 273011 [dblack@ru yp] I think Eric intends it to return a kind of sort key, not to actually
| | 273031 [transfire@gm] I realize. But clearly a standard definition of <=> would be based on
| + 273085 [drbrain@se m] My primary goal was reducing the number of method calls and objects
|   273150 [shortcutter@] I'm afraid the performance issue is not that easy: I can imagine where
|   273203 [drbrain@se m] Profiling indicated a significant amount of time was spent in #<=>
|   273212 [rick.denatal] First of all it's not my benchmark, it comes directly from the ri doc
|   273228 [drbrain@se m] Array#sort doesn't call Fixnum#<=> when comparing fixnums, even if
+ 272990 [dblack@ru yp] Maybe #sort_key.
| 273027 [apeiros@gm .] String#nat_cmp_key to use sort_by.
+ 273041 [ara.t.howard] i prefer #order, #order_by since the concept is extends to much more
| 273043 [cilibrar@gm ] its a great idea and i have been using it for years in sql by the
| 273088 [drbrain@se m] I like order_key too.
+ 273055 [vjoel@pa h. ] Since this is more efficient than #sort, maybe the implementation of
  273060 [rick.denatal] $ qri sort_by
  + 273062 [vjoel@pa h. ] Quite right, #sort should stay as it is, and #sort_by should only be
  + 273201 [drbrain@se m] I'm actually impressed #sort_by does that well.  Array#sort cheats.

Is using attr_accessor for class variables possible?
272993 [gabe@dr gf y] I know that attr_accessor works for accessing instance variables, but
272994 [dblack@ru yp] @@var = 1
+ 272996 [gabe@dr gf y] Good point, I mean access the class variable from outside the class
+ 272997 [lists@be tr ] class D < C ; end
  273009 [dblack@ru yp] That's the point of attr_accessor: to give easy access to per-object
  273016 [lists@be tr ] class C

[ANN] Find
272995 [lists@be tr ] the Ruby built-in Find module lacks a lot of features the
273179 [ara.t.howard] [cfadmin@yacht cfadmin]$ find /mnt/yacht0/data/night_files/|wc -l

Re: Find
273001 [djberg96@gm ] Regards,
273058 [tpo2@so rc p] Time to merge stuff into Ruby proper if so many (...) people see the need
+ 273105 [bigboss64@ip] As long as it doesn't get more bigger and fatter then GNU Find is....
+ 273106 [djberg96@gm ] On Oct 7, 3:17 pm, Tomas Pospisek's Mailing Lists <t...@sourcepole.ch>
  273153 [GGarramuno@a] Both seem complementary.  Bertram has sorting built-in and is not
  273156 [lists@be tr ] Argh!

Exec format error when installing Globalize Rails
273007 [ohaleck@po z] I must admit I am a complete noob in Rails. I need to develop an
273021 [dangerwillro] First tip, this is a very Rails specific question, best for the Rails
273135 [ohaleck@po z] On Oct 7, 5:58 pm, John Joyce <dangerwillrobinsondan...@gmail.com>
273136 [mo_mail@on h] RoR group at http://groups.google.com/group/rubyonrails-talk?hl=en

newbie... be gentle
273020 [beatrice_mar] I am trying to access the US Postal Service web tool for tracking. I am
+ 273026 [kazaam@ol co] #!/usr/bin/env ruby
+ 273029 [dolgun@ex it] For one thing, that's a 'get' request, which means all the data you are
  273254 [michael.bevi] ...

Supressing RDoc links
273028 [jamesmead44@] ...
273049 [drbrain@se m] Currently it is not possible.
273141 [jamesmead44@] ...

Fwd: Ruby Quiz #142 Submission
273034 [james@gr yp ] ...

Delegation vs. Duck Typing (was Re: The Case for Multiple-Inheritance)
273042 [james@gr yp ] Sure, I'll try.
273064 [jperkins@sn ] Thanks very much for taking the time to elaborate! There seems to be
273072 [james@gr yp ] Use delegator when you want to forward the entire interface of an

Ruby TKentry
273048 [schmode93@ya] So, i have been programming for about a month or so and i decided to try
+ 273054 [pstickne@gm ] When you do GUI programming you move away from a sequentially
+ 273107 [m_goldberg@a] A TkEntry widget will store the input (the text the user enters) in
  273971 [schmode93@ya] Alright i see now. But for example when it outputs a value, it outputs
  273976 [m_goldberg@a] This is not clear to me, so i can't see how to help. Can you explain

Obfuscator for  Ruby/RoR
273052 [testmyeclips] I need to make my code unreadable, in Java(j2me) i used some
+ 273065 [dangerwillro] Just keep using Java. It will be hard to read!
+ 273068 [ news@ja .f ] The good news: This was discussed extensively in this forum
| 273104 [bigboss64@ip] Good post Jay Levitt.
+ 273140 [alfred.anzlo] Why in the world are you using Ruby?
| 273142 [mo_mail@on h] Or, if you really want to mix and match, migrate some "critical"
+ 273270 [ryand-ruby@z] an OSX (rubycocoa) production app. We decided to put a $2500 license
| + 273308 [dangerwillro] Is that serious? At that price, it would be worth it to just write it
| | + 273316 [znmeb@ce ma ] No, he asked if *Igor* was serious. :)
| | + 273328 [alex@bl ck e] Something tells me that $2500 is cheaper than the time you'd need to do
| | + 273331 [drbrain@se m] Yes, we're serious.  If you plan on making money off of software,
| | | 273332 [cliffrowley@] ...
| | | 273470 [lloyd@2l ve ] What if you were to make all classes, methods, and variables more or the
| | + 273382 [mortee.lists] The price isn't the really interesting point here - if lack of this kind
| |   + 273386 [ara.t.howard] if you are using libraries it's extremely likely that the license of
| |   | 273389 [dangerwillro] +10 ara!
| |   + 273403 [drbrain@se m] Why would you obfuscate external libraries?  You only need to
| |     + 273408 [mortee.lists] I'm not sure how your software works, and whether it's possible to
| |     | 273467 [ryand-ruby@z] I can't vouch for your code, but it took me less than 15 minutes to
| |     | 273501 [mortee.lists] Well, OK. I haven't tried the software myself, obviously, so I'm not
| |     + 273410 [dangerwillro] Still, I ask, why obfuscate at all? If it is for security reasons,
| |       + 273448 [znmeb@ce ma ] Not necessarily ... you get paid for delivering value, not for how you
| |       | 273503 [caduceass@gm] Some people think it's all about how it's delivered (which I happen to
| |       | + 273507 [mortee.lists] It's pretty simple, as has already been mentioned: to raise the bar. If
| |       | | 273510 [caduceass@gm] I'm not sure.  I just care about self-interest getting out of control.
| |       | | 273534 [dangerwillro] I don't know. It's no more reasonable than people who are freaked out
| |       | + 273533 [znmeb@ce ma ] Personally I think meta-programming and DSLs are over-rated. As frequent
| |       |   273926 [caduceass@gm] Not sure yet myself, but I pretty much agree.
| |       |   273931 [shevegen@li ] 42
| |       + 273526 [dangerwillro] bingo!
| + 273346 [win@wi ce t.] Have you done performance profiling on the compiled executables? Any
|   273385 [drbrain@se m] Its roughly the same due to use of rb_funcall().
+ 273432 [charles.nutt] The JRuby compiler can compile to Java bytecode and still run as normal;
  273538 [alexey.verkh] You don't make it sound as cool as it is... or as scary as it is,
  273574 [charles.nutt] Well thanks for that :) It is pretty cool...hopefully people will start

where's rake?
273053 [dolgun@ex it] $ gem help
273056 [rick.denatal] Normally, unless you've custom installed gems to put things in your
273080 [dolgun@ex it] Thanks, that did the trick. :)
273089 [drbrain@se m] It shouldn't any more.  See [ruby-talk:272784].
273094 [dolgun@ex it] The most recent version: 0.9.4.
273143 [drbrain@se m] In 0.9.4 the maximum number of gems allowed to be out of date is a

considering writing a book on Ruby/Rails?
273057 [REMOVE-CAPSb] If anyone here is considering writing a book on Ruby or Rails I'd like
+ 273063 [phlip2005@gm] Such a book should then provide a warning label "Don't just skip straight to
| + 273069 [dangerwillro] No way. It only seems that way. because most books cater to people
| | + 273078 [REMOVE-CAPSb] Nope. It's book #7 and it's supposed to be a fairly advanced book.
| | + 273079 [znmeb@ce ma ] Agreed ... then again, there are some other good books that don't even
| |   + 273083 [perrin@ap th] Actually, as a first step in that direction a "common useful libraries"
| |   | + 273086 [peter@pe er ] ...
| |   | | 273091 [perrin@ap th] Nice!  I didn't know it existed.  Thank you.
| |   | | 273095 [al_batuul@ya] ...
| |   | + 273090 [znmeb@ce ma ] I can do "gem list --remote" and get a listing of the gems and brief
| |   | | + 273108 [jeremymcanal] Since we're all throwing book titles around, you might be interested
| |   | | + 273419 [dangerwillro] Honestly, I don't care what anybody thinks about book ideas or
| |   | + 273111 [james.britt@] There exists a book that describes an assortment of gems.  It think the
| |   |   273206 [perrin@ap th] Agreed -- and I'd like to see more of that sort of thing going on.  In
| |   + 273209 [ruby@ph li .] One problem with these though is that they change pretty fast don't they?
| |     + 273226 [REMOVE-CAPSb] Excellent point. I think that would be the time to make something more
| |     + 273227 [jeremymcanal] That's the beauty of self publishing; for example, with the Humble
| + 273077 [REMOVE-CAPSb] Sadly, you're probably spot on...but funny still.
+ 273096 [pergesu@gm i] Funny you should mention that.  I'm actually working on a book
| + 273099 [ news@ja .f ] Next you'll suggest that all the other books delete their installation
| | + 273101 [pergesu@gm i] Fantastic idea!  And since they'll have to print new, updated
| | + 273117 [znmeb@ce ma ] How about a chapter on how to *uninstall* Ruby and Rails? Here's how you
| + 273112 [james.britt@] What's sad is that I can't tell if this is satire or not.
| | 273114 [pergesu@gm i] Yes.
| + 273119 [REMOVE-CAPSb] Sadly, I'd rather buy your book if I needed it than to pay for the info
|   273124 [ news@ja .f ] Sure.  The problem is the use case of someone who's been wanted to play
|   + 273127 [dangerwillro] This is EXACTLY the scenario that supports boosting page counts with
|   | 273225 [REMOVE-CAPSb] I'm not certain I follow your point here entirely(I can't tell if you're
|   + 273131 [znmeb@ce ma ] cygwin ... slowly I turned ... step by step ... inch by inch ...
|   + 273222 [REMOVE-CAPSb] My first question would be "why the hell can't the idiot just look
|     + 273231 [ news@ja .f ] Excellent point.  Books should consider "online appendices" more often for
|     | 273233 [shevegen@li ] "Please, please, please do not do us the disservice of putting a
|     | + 273238 [phlip2005@gm] Oh joy - all the stuff that's _most_ likely to change before the book
|     | | 273284 [wayneeseguin] ...
|     | + 273295 [znmeb@ce ma ] The SWIG documentation is definitely non-trivial. :)
|     + 273297 [znmeb@ce ma ] # emerge rails
|       + 273306 [dangerwillro] let's see on the Mac alone, there is also a one-click installer,
|       + 273315 [REMOVE-CAPSb] It would be great if that's all there was to it. According to someone
|       + 273339 [ news@ja .f ] I recently tried to help a summer intern install (or rather update) his
|       + 273407 [perrin@ap th] 1. cd /usr/ports/www/rubygem-rails; make install clean
+ 273113 [brad@br de i] +1 here. And I'm putting my money where my mouth is. You'll have to wait
  273216 [REMOVE-CAPSb] Yeah, and I'll likely buy the book just so I can support someone who