265273-280424

265100-268253 subjects 265509-271056

^ Emulating a Groovy feature?
265273 [lists source] Guys,
+ 265274 [fwmailinglis] charset="US-ASCII"
+ 265275 [fxn hashref.] class NilClass
| 265277 [celtic sairy] The only problem I can see here is that it's not quite optional.
| 265280 [fxn hashref.] Yeah, that's the basic technique.
+ 265276 [dave burt.id] irb(main):001:0> def nil.method_missing(*_) end
+ 265283 [apeiros gmx.] Good to see that I'm not alone on this :)
+ 265478 [shortcutter ] Try this in IRB
  265479 [shortcutter ] x = foo.bar.baz rescue nil
  280151 [cutter38 gma] Interesting thread....glad someone else has hit this need.
  + 280158 [jameskilton ] You don't need begin unless you want to catch just a section of code. Single
  + 280167 [shortcutter ] The value of the expression is replaced by the value of the expression
    280168 [fedzor gmail] Begin-Rescue-End blocks tend to slow things down significantly - does
    280295 [lkmlists luk] Sebastian Delmont did some benchmarking on this last year.
    280388 [charles.nutt] It slows down JRuby a bit more than Ruby 1.8, unfortunately, because of
    280389 [charles.nutt] Actually, it just occurred to me that this is entirely a factor of local
    280424 [lists source] You mean the one line rescue syntax mentioned before? Interesting, I

^ Named Constructor Idiom in Ruby?
265284 [celtic sairy] I'm almost certain there's a good way to do this, but I seem to have
+ 265285 [apeiros gmx.] # somewhat contrieved example
+ 265286 [stefano.croc] You need to make the new class method of class A private. Then, you implement
| + 265288 [celtic sairy] Exactly what I needed, both Stefan and Stefano! Thanks very much. :)
| + 265477 [shortcutter ] irb(main):020:0> a1 = A.special_method_1
+ 265481 [dan fluentra] You have some good answers, but here is yet another way that is quite

^ How do you post SMS messages on a website?
265292 [rsylvesterl-] I am developing a website with Ruby that will integrate SMS messaging.
+ 265299 [kovaltaras g] Try http://zong.com
+ 265590 [dido.sevilla] What country are you in, and what is the scope (e.g. local, regional,national, international, or global) of the SMS messages you want to beable to receive? A large amount of messages is still a vague term. Upto about a thousand messages a day (mobile originated, with noresponse in return) may still be doable with a GSM modem coupled toKannel (http://www.kannel.org). For traffic volumes larger than this,or if you want to send SMS messages out, either in response or as amobile terminated service (e.g. to send updates to certain users), orif you want your service to be international or global in scope youwill need a real SMS gateway.

^ YAML and NArray
265294 [martin snowp] In the past week, I've been exploring a little problem that by
265396 [martin snowp] And this is what I get for posting something other than the exact code

^ Execute ruby commands in a program
265301 [h4z3 the-c0r] Ok so lets say i have a program, And within the program i call a command
+ 265311 [wade.christo] Um, this sounds like 'irb'.  Depending on what OS you're on and how
+ 265317 [martin snowp] I have a bit of trouble understanding what it is you want to have
  265320 [h4z3 the-c0r] Sorry its quite hard to explain, Its not IRB, because i want to actually
  265323 [dangerwillro] look up eval
  265326 [h4z3 the-c0r] Thanks, i looked it up and coded something pretty much the same except
  265388 [overlord gmx] What did you expect it to print?

^ Is this the perfect regex for validating first & last names?
265303 [promos burch] Perhaps a fairly bold statement, coming from a novice regex'er.   :)
+ 265307 [urban betton] Are you really sure you want to ask a PHP question in a Ruby forum? I
+ 265316 [martin snowp] I don't know PHP regular expressions, but a bit of googling suggests
+ 265319 [alec arlross] <promos@burchwoodusa.com> writes
+ 265357 [aledonne.lis] Most assumptions about names turn out to be wrong.

^ Re: Is this the perfect regex for validating first & last na
265304 [promos burch] Well, shucks.  I missed the hyphenated last name condition.  Hillary
265302 [promos burch] Posted via http://www.ruby-forum.com/.
265306 [promos burch] Well, so much for testing my own code.   "zá" fails.  All the diacritics
265310 [promos burch] Actually, it's a regex question.   Lots of regex questions and answers
265312 [apeiros gmx.] Just that ereg* is not pcre. There is no equivalent in ruby to the ereg*
265314 [promos burch] Ok then.  I'll find the proper resource.   Thanks.
265365 [promos burch] HA HA.   Seeing as there are so few, I think I'll copy those names into
265371 [dangerwillro] www.regexlib.com

^ [ANN] assert_hpricot
265305 [phlipcpp yah] Here's a blog entry on how to use Why's Hpricot library inside assertions,

^ [ANN] launchy 0.2.1 Released
265327 [jeremy hineg] launchy version 0.2.1 has been released.

^ Adding to an array question
265328 [coreyhaines ] I need to add a string to the end of an array count number of times. I
+ 265361 [apeiros gmx.] def add_person(name, count=1) # I assume adding once as a default is
| 265398 [coreyhaines ] Thanks for the tips, Stefan. I like your tip on doing .dup, as well.
+ 265454 [mlanza comca] count.times {@bucket << name }

^ Download Calvin+Hobbes Script
265330 [curi curi.us] The top link on del.icio.us is a site with all the Calvin + Hobbes
+ 265343 [james.britt ] No, first consider the people hosting the content you're snarfing.
| 265346 [curi curi.us] It's a good thing I posted. I will remember to put a sleep next time.
| 265349 [curi curi.us] Oh. How much sleep is best? One second per image would add an hour to
| 265354 [james.britt ] 60*60*24 might work.
| 265360 [jnj thecoope] I'm no expert, but it seems to me that Mr. Britt makes a
| 265372 [dangerwillro] A. They're probably hosting Calvin & Hobbes strips illegally, so they
| + 265373 [phlip2005 gm] The ultimate punchline: Calvin has just destroyed Susie D's snowman, and
| + 265375 [ben bleythin] They certainly are, and I know from past experience (supporting a site
+ 265382 [jaimeiniesta] it, sure it is an interesting script. I thought about doing a simpler

^ Re: launchy 0.2.1 Released
265331 [transfire gm] On Aug 18, 12:12 pm, Jeremy Hinegardner <jer...@hinegardner.org>
265442 [jeremy hineg] Yes, probably in hindsight a bad name.  Naming things appropriately is one

^ Ruby's equivalent to Java's "interface"
265337 [steve trippe] Please forgive this rather naive question, but it's a query that's
265341 [dvohra09 yah] Steve,
+ 265364 [o.renaud lap] I disagree : the equivalent of java's interface is implicit interface. That
| 265369 [kbloom gmail] You get two differences when you do this: one is that
+ 265370 [dkarapetyan ] Ruby modules also allow implementation details and I'm not sure if this is
  265474 [shortcutter ] You can only define constants in a Java interface, no methods.  A Ruby
  265487 [mikkel helen] I second that...

^ Printing variable names
265345 [bulliver bad] foo = [s0, s1, s2, s3, s4, s5, s6, s7]
265347 [h4z3 the-c0r] Wouldn't it be more logical to use a hash?
265348 [bulliver bad] Perhaps, but the order of the variables is significant. I was thinking I might
265351 [bulliver bad] @registers = [:zero, :at, :v0, :v1, :a0, :a1, :a2, :a3,

^ splitting Array - DRY
265376 [josselin wan] I am presently splitting an array on 4 successives periods of time , is
265377 [apeiros gmx.] class ClassOfAd
265468 [josselin wan] thanks Stefan, I realize that, too frequently, I am programming Ruby as
+ 265470 [shortcutter ] Basically you need a more generalized version of partition. Maybe
| 265753 [josselin wan] Thanks Robert... I'll put it in my Personal Ruby Cookbook, that's DRYissimo !
+ 265471 [significants] the Ruby Cookbook (ISBN: 0-596-52369-6) is really great, as it's
  265785 [kaldrenon gm] I have this book too, and I haven't really delved into it, but I can

^ Symbol as array index error
265378 [nick314 gmai] charset="big5"
265380 [robert.dober] It would be helpfull to tell us where in the code the error occurred.
265393 [nick314 gmai] This is the error message.
265540 [nick314 gmai] This is the error message.

^ Detecting duplicates in an array, anything in the standard library ?
265381 [thibaut.barr] Just wondering if there is something simple already built in the std
+ 265392 [ari aribrown] Couldn't you also just do a union with itself?
| 265394 [dblack rubyp] This message is in MIME format.  The first part should be readable text,
| 265395 [ari aribrown] The only reason I'll accept that
+ 265415 [w_a_x_man ya] Here's a modification of a technique used by
| + 265416 [thibaut.barr] Thanks for all your replies!
| + 265418 [transfire gm] Does everyone agree that #dups is the best name for this? I recently
|   265422 [w_a_x_man ya] +1
+ 265432 [shortcutter ] Actually you are not deleting duplicates as far as I can see.  Here's
| 265431 [shortcutter ] Did I say it's too late?  Man, I should've worn my glasses...
| 265493 [thomas.mackl] or...
| + 265503 [shortcutter ] It does, but as far as I can see OP wanted exactly the duplicates back.
| | 265521 [gabe dragffy] I'm a n00b, sorry if I'm poking nose in. Couldn't the op do something
| | 265524 [dblack rubyp] [1,2,3,2,4,5,5,6]   => [2,5]
| + 265525 [gabe dragffy] [1,2,2,3].uniq
+ 265594 [botp delmont] #     inject({}) {|h,v| h[v]=h[v].to_i+1; h}.reject{|k,v| v==1}.keys

^ Re: Detecting duplicates in an array, anything in the standa
265385 [ed.odanow wo] No! :-)) - I tried it only using Arrays...
265387 [dblack rubyp] This message is in MIME format.  The first part should be readable text,
265389 [ed.odanow wo] The problem is, that he wants all non unique elements. Unfortunately the
265390 [dblack rubyp] This message is in MIME format.  The first part should be readable text,

^ Getting MySQL column comment metadata?
265397 [mlanza comca] How do I go about getting the "Comments" metadata--the one I type via
+ 265399 [mikeisgreat ] I'm not sure what you are asking, so I will take a guess...
+ 265405 [kbloom gmail] This doesn't appear to be implemented directily in MySQL's C API.
  265438 [mlanza comca] Thanks for the help.  This is useful but I would like to use a library
  265453 [mlanza comca] The column I was referring to appears in the attached screenshot.  Far

^ Kevin Howe?
265400 [transfire gm] Last call for Kevin Howe. Hello?
265410 [ari aribrown] You ping...
265411 [transfire gm] LOL :-)
265439 [robert.dober] The man is lost in outer space and you are laughing????

^ Re: how to read a ruby symbol from C ?
265404 [yvon.thorava] rb_id2name( SYM2ID( a key T_SYMBOL from a RHASH ))
265443 [nobu ruby-la] That portion you mentioned is correct.  So something is wrong
265485 [yvon.thorava] OK, i'll look again at that...

^ Float addition problem / Processor bug?
265406 [dinkel pimpr] === START ===
+ 265408 [shortcutter ] The second one.  This is a standard rounding issue.  The short
| 265412 [dinkel pimpr] I kind of knew it ;-) - but still thank you Robert for confirming!
| 265414 [apeiros gmx.] That's no "ruby" problem. You have to understand what floats are (and
| 265419 [dinkel pimpr] I know that this is no Ruby-specific problem and I can live with it in a
| 265425 [apeiros gmx.] If you have an idea on how to do that, I'm sure the core developers
| 265434 [znmeb cesmai] 1. As far as the "principle of least surprise" is concerned, the fact
+ 265413 [matt tidbits] <http://docs.sun.com/source/806-3568/ncg_goldberg.html>

^ 'Rite'
265417 [transfire gm] So has the name 'Rite' for Ruby 2.0 officially gone the way of the
+ 265424 [gmurray clou] be wary, the Dodo comes!
+ 265465 [matz ruby-la] Rite is a code name for my _next_ implementation.  Since YARV came in,
+ 265466 [martindemell] There's always webrite

^ Converting %2F back to /
265420 [dipesh_bathe] I have a string which contains url. The forward slash in it represented
265423 [dougal.s gma] def url_decode(s)
265428 [shortcutter ] irb(main):001:0> require 'uri'
265430 [dougal.s gma] It had to be there somewhere, thanks for pointing it out! :o)

^ Video playback library?
265421 [johnreiter g] I've recently begun learning ruby (coming from a mainly java world), and
+ 265426 [dangerwillro] VLC is a nice cross-platform app, open source, made in C.
| 265433 [ruby-lang da] And can be remotely controlled programmaticly via its telnet
| 265456 [johnreiter g] That might be something worth looking into.  Thanks!
| 265464 [dangerwillro] VLC (videolan.org) is very cool, quite good.
+ 265427 [phlipcpp yah] Just a guess; the format of the future is a video rendered as a Flash
  + 265429 [dangerwillro] Yep. You could have bindings/API of some sort like the way RMAgick
  + 265455 [johnreiter g] Unfortunately, Flash isn't going to be an option for this particular

^ Library for investigating database schemas?
265437 [mlanza comca] I'm wondering what libraries are available for accessing the most
+ 265452 [mlanza comca] I think I've uncovered some ways to do this.  If there's a better way,
+ 265887 [no spam.plea] As you found, ActiveRecord already fetches column names. The extra

^ Unmarshal object with PHP
265440 [drogus gmail] Is there any implamentation of something like Marshal.dump in PHP? Or
+ 265441 [peter peterc] What you need to figure out (or what you might need to tell us) is if you
+ 265451 [drbrain segm] Poor workers blame their tools. Good workers build better tools. The
| 265494 [drogus gmail] Thanks for replies :)
| 265545 [drbrain segm] That's probably optimal.  Porting Ruby's marshal format to PHP is
+ 265467 [shortcutter ] Kind regards

^ [ANN] RubyConf 2007: proposal deadline extended
265445 [dblack rubyp] We've extended the deadline for presentation proposals for RubyConf
265446 [dblack rubyp] RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)

^ MS VC++ Toolkit 2003?
265447 [TimHunter nc] I've just purchased a new Intel-based iMac and installed Windows XP
265461 [djberg96 gma] VC++ 8 should work fine. I've built Ruby successfully with it. The only
265463 [halostatue g] There are some tricks others (Nobu or NaHi, IIRC) have suggested to
265580 [TimHunter nc] Well, now I confess to being a  bit confused. Just how do I make a new
265644 [halostatue g] For that, you need either (a) Visual Studio 6 or (b) mingw. There are

^ how can I open a local file?
265448 [wzfg singtel] how can I get the path of a local file, so that I can open and read the
265458 [bulliver bad] I guess you may want to browse the CGI docs. [0], [1]. If that doesn't help

^ Show defining file for methods?
265449 [mlanza comca] I don't think this is built in, but maybe I'm wrong.  I was wondering
265504 [ruby anthrop] With a certain amount of work and hooking of Module::method_added,
265533 [mlanza comca] When I have a little more time I'll look into doing what you suggest.

^ Ruby on the iPhone
265457 [sleight42 gm] Anyone else out there realized that Ruby has been compiled for and now
+ 265459 [drbrain segm] Nearly this same message was posted two weeks ago.
| 265483 [sleight42 gm] Sorry for the repost then.
+ 265460 [eastmedianyc] Unfortunately it doesn't have most standard libraries or rubygems, which

^ ZenTest autotest problem on Windows XP
265480 [nicolas.rimb] I have a problem using autotest on Windows XP. When launching
+ 265621 [AEtzold gmx.] Dear Nicolas,
+ 265709 [jan.svitok g] I don't think it's a good idea to install ruby in a directory with
+ 265712 [gthiesfeld g] Try this in your .autotest file
  265713 [gthiesfeld g] Sorry, I hit send before I was done.  Just wrapping the ruby method in

^ Current rubygems require idiom
265488 [Bil.Kleb NAS] I currently have,
+ 265489 [transfire gm] $ export RUBYOPT=rubygems
| 265491 [Bil.Kleb NAS] This is for an executable packaged in a gem, i.e.,
| 265516 [halostatue g] If that's the case, don't bother doing anything special. Just require
+ 265492 [djberg96 gma] In environments where I have multiple Ruby installations, where some use
| 265508 [dan-ml dan42] Er, that can't possibly work since LoadError isn't a subclass of
| 265517 [djberg96 gma] Yeah, yeah, it should have been "rescue LoadError nil".
| + 265522 [dblack rubyp] I don't think the error specification thing works with the one-line
| + 265523 [tim.pease gm] I've found this little snippet to be useful for loading other people's gems ...
+ 265515 [ben bleythin] begin
| 265526 [apeiros gmx.] Why not just a corrected version of an earlier statement?
| 265534 [ben bleythin] Two reasons: first, my option only requires rubygems if it is necessary
+ 265536 [ara.t.howard] i personally use
| 265553 [drbrain segm] No need to comment anything out, just use ruby -I to override
+ 265556 [drbrain segm] This is correct and will work.

^ Ruby performance degraded on custom kernel
265495 [henke mac.se] I have a rather odd question regarding ruby's performance on a system
265500 [znmeb cesmai] Well ... I'm not sure off the top of my head what it could be, but if
265511 [henke mac.se] Thanks for your response.

^ regex not gsubbing for me.
265498 [pbailey bna.] Can someone please explain to me why this simple regex substitution
+ 265499 [alex blackke] It works for me...
+ 265501 [apeiros gmx.] Your operation changes the string object in memory. Not the file. You
| 265502 [pbailey bna.] Thanks. Yeh, I'm doing that actually. Obviously, this is just a snipped
+ 265505 [shortcutter ] Not sure whether that may be related but I'd use (.*?) instead of
  265506 [pbailey bna.] Robert-
  265541 [overlord gmx] Take a look at REXML, it parses XML way better than regular expressions.
  265542 [pbailey bna.] Thanks, Simon. Yes, I see that it's actually part of Ruby out of the
threads.html
top