152641-153992

152422-154877 subjects 152777-155231

Re: Job Opportunity in Redwood City, CA
152641 [john@gr vi y] If anyone local to Silicon Valley is interested in learning more about

YANQ: Nesting in YAML
152648 [basi_lio@ho ] How does one tell YAML to use an array substructure rather than a hash?
+ 152651 [lists@ka am ] require 'yaml'
| + 152654 [zdennis@mk e] {"an"=>
| | 152658 [basi_lio@ho ] Yes, I screwed up the description of the problem big time. Here's a
| | 152661 [bg-rubytalk@] irb(main):051:0> h = {"x"=>{"aa"=>[2, 3], "bb"=>["boo"]}, "y"=>{"aa"=>[5],
| | 152665 [basi_lio@ho ] Thanks much. yeah, very useful.
| + 152767 [basi_lio@ho ] Your tip to use
+ 152659 [bg-rubytalk@] This doesn't look like a hash containing an array to me.  The "ps" entries
  + 152660 [basi_lio@ho ] You're right. Please see my posting more recent posting.
  + 152662 [basi_lio@ho ] in YAML
    152663 [basi_lio@ho ] But now I cannot get at the values ["weed", "sick"]
    152674 [jamal.hansen] I think h["y"]["cc"][1]["sea"][1] would return "sick" since "sea" is a
    152771 [basi_lio@ho ] Jamal,

is there a shorter way to compare these 2 objects?
152650 [lkirsh@cs ub] I have a class called foo and I want to make it comparable so that I can
152652 [james@gr yp ] def <=>( other )
+ 152679 [bob.news@gm ] Here are some other possible implementations using #inject... :-)
| + 152681 [simon.kroege] def <=>( other )
| | 152805 [lkirsh@cs ub] Cool, I didn't realize nonzero? returned anything useful other than
| + 152806 [lkirsh@cs ub] Those solutions are definitely cool but I find James' to be more
|   152862 [bob.news@gm ] Yes definitely!  I just had some fun playing around with this. :-)
+ 152702 [james@gr yp ] I misspoke a little here.  Arrays are NOT Comparable, but the DO
+ 152804 [lkirsh@cs ub] Great, this is *exactly* what I was looking for :)

Google's Sawzall
152655 [chaotrope@jp] (abstract with pointer to PDF of full 29 page paper)
+ 152656 [lyndon.samso] ...
+ 152791 [meta@po ox c] You mean like AppleScript?
  + 152794 [gavin@re in ] FWIW, there is a JavaScript OSAX which allows you to write
  + 152809 [lyndon.samso] ...

Novice Q: What's the difference between /\s*/ and /(\s)*/?
152666 [meng.yan@gm ] I'm new to Ruby and reading 'Programming Ruby 2/e' now. I encountered
+ 152673 [w_a_x_man@ya] Without the captures, the substrings on which the string is split
| 152675 [meng.yan@gm ] Thank you, William.
+ 152676 [dooby@d1 .k ] You're not seeing the difference because of your assignments.
+ 153407 [julian@co et] I'm not sure if someone's already answered this, but...
  + 153411 [gavin@re in ] Actually, using parentheses here will not affect what is matched,
  | 153416 [gavin@re in ] "Hello".match( /^\s*(\w+)/    )  #=>  "Hello" , nil
  | 153434 [jeff.darklig] Ok, now for a clean and simple answer...
  | 153438 [dblack@wo bl] I believe that would be 10 :-)
  | + 153442 [jeff.darklig] Regarding nil values for groups
  | | 153481 [dblack@wo bl] Oh, well, yes -- if there's no match for the group.  I was taking you
  | + 153443 [decoux@mo lo] moulon% ruby -e '"The gateway is broken ? yes / no ?" =~ /(yes)|(no)/; p $1,$2'
  + 153992 [meng.yan@gm ] Thank you, Julian.

read excel data in an array, doesn't work
152667 [saudaziz@gm ] I am trying to read entire row (with as many non-null columns are
152668 [saudaziz@gm ] Found it guys, nvm.
152687 [no@sp m. le ] Please post your working version! I need to use Ruby to load values
152696 [kevin.olbric] Are you trying to dump output to an excel file, or are you trying to add
+ 152718 [saudaziz@gm ] Nah, what i am trying to do is simply read row by row in excel file and
+ 153019 [no@sp m. le ] I know I can do the CSV route, but I wanted to progressively

Split up Excel row and assign cells to variables
152669 [saudaziz@gm ] Ok guys, so far i have the following. Right now as it is, it reads in
152833 [saudaziz@gm ] nvm, it was just piece of cake!

Erb on the Herb?
152671 [lyndon.samso] ...
+ 152689 [Stephan.Kaem] This line -^ is just some other output of ERB - there are no '<%' ...
| 152691 [twifkak@co c] Not, according to the rdoc, when '%' is passed to ERB.new.
+ 152701 [james@gr yp ] Works fine here.  I pulled the code right out of your email and
  152811 [lyndon.samso] ...
  152825 [twifkak@co c] Works for me. Sorry!

gem & rdoc: How to avoid "Could not find main page name" warning when using gems?
152680 [sanobast-200] When I automatically the rdoc documentation of a gem I made, I always
152773 [chadfowler@g] Chad Fowler

Getting an array back in xmlrpc?
152706 [greg.kujawa@] I started off passing back a single SQL record to my xmlrpc client
152708 [pit@ca it in] If this works
152710 [greg.kujawa@] Digging deeper into the docs I see that xmlrpc can only handle a one

[SUMMARY] Scheduling (#42)
152707 [james@gr yp ] The problem space of scheduling is vast and complicated, but it's not too hard

#puts inside ERB
152709 [gavin@re in ] I see this has been suggested before, in [ruby-talk:126986] and [ruby-
+ 152845 [gavin@re in ] Here's my horrific hack that does it. It's particularly hacky because
| 152865 [discordantus] How about this? Still somewhat hacky, but maybe less breakable. It
| 152909 [gavin@re in ] ...
+ 152871 [lyndon.samso] ...
  152896 [gavin@re in ] It already works to have explcit _erbout.concat or _erbout.<< calls;

unless statement... why oh why?
152717 [zdennis@mk e] thr = Thread.new{}
+ 152719 [zdennis@mk e] ignore the "short-circuting" comment in reference to the or statement.
+ 152720 [brockweaver@] DeMorgan's theorem and operator precedence in ruby.
| + 152721 [patrick.fern] When you check thr directly, since thr is not nil (it is still a
| | + 152724 [brockweaver@] Sorry, to be a little more clear, the following 3 lines are all
| | | + 152728 [ruby.brian@g] I am quite shure that the above is not correct.
| | | | 152734 [brockweaver@] Thank you for correcting me, Brian.  I got a little post happy I guess. :)
| | | + 152731 [dblack@wo bl] I don't think its goal is to be shorter (apparently :-) but rather to
| | + 152726 [zdennis@mk e] Yes this lets my brain see things in a very simplistic fashion. Thank
| + 152725 [zdennis@mk e] Yep, thank you for the quick response!
| + 152736 [gavin@re in ] * Change all ANDs to ORs, and vice-versa
+ 152722 [ruby.brian@g] (not a) or (not b) <=> not (a and b)
+ 152818 [hal9000@hy e] I don't think it's a matter of short-circuiting, but

Idiomatic ruby version of this code?
152723 [brockweaver@] Showing off ruby to a coworker, and I want to emphasize how succinct yet
+ 152727 [ruby.brian@g] If it where a one time solution, I'd do something like this. Though
| + 152733 [brockweaver@] Perfect!  Thank you for your quick response.  I decided to take the
| | 152744 [pit@ca it in] Note that all the offered solutions including your original version
| | + 152746 [Daniel.Berge] def switch(old, new)
| | + 152747 [pit@ca it in] Sorry, Ben's version works if you choose a non-existing temporary ending.
| + 152745 [gavin@re in ] mappings = { '.mp3' => '.temp', '.temp' => '.mp3' }
+ 152729 [bg-rubytalk@] def switch_endings(current_ending, new_ending)
+ 152730 [Daniel.Berge] Dir["*.mp3"].each{ |file|
+ 152732 [zdennis@mk e] arr1, arr2 = Dir["*.mp3"], Dir["*.temp"]
+ 152742 [ruby-talk@wh] You could use the tertiary operator to switch file names, but the (exp
| 152743 [Daniel.Berge] gsub and backreferences?  Why take that approach when File.basename is
| 152750 [ruby-talk@wh] You understand he's trying to swap extensions, right?  (I think?)  Well,
| 152761 [Daniel.Berge] djberge@~/programming/ruby/temp-670>cat switcher.rb
| 152765 [brockweaver@] Thank you all for your replies.  I've chosen to use a cross between
+ 152800 [probertm@ac ] I know that this is kind of heretical, but in a situation like this, I'd
  153350 [pat.eyler@gm] Sorry for being late to the party (and wildly off topic for a ruby-talk thread).

First Ruby Program
152735 [Tanton.Gibbs] ...
+ 152748 [james@gr yp ] Welcome!
+ 152749 [gene.tani@gm] the best thing to smooth perl > ruby conversion is Hal Fulton's purple
+ 152753 [gene.tani@gm] i think the best thing to smooth perl > ruby conversion is the chapter
+ 152783 [meta@po ox c] I used to think the same. However, I eventually decided Ruby does the

any messaging frameworks in ruby
152737 [sunh11373@ho] Is there a messaging framework in Ruby like JMS in Java?
+ 152739 [Ara.T.Howard] check out ruby spread - it's on the raa.
+ 152741 [brianm@ap ch] I have a client (protocol really, with a ruby impl) for talking to

MySql module for windows ?
152738 [ahidalgo@be ] Where can I find the MySQL module for windows Xp?
152815 [demetriusnun] ...

Ruby Specifications
152740 [binary42@gm ] Over the past few days I've been working on implementing my own (yet
+ 152752 [acharlieblue] I don't think now is a very good time to write out a specification,
| + 152756 [josh.charles] Is there a roadmap somewhere that contains a list of planned features
| + 152760 [binary42@gm ] This might be the exact reason to use specs. Forward looking
+ 152759 [ptkwt@ar cn ] There are probably some good things that could come out of a spec-driven
| 152763 [binary42@gm ] Right. I guess some work could be done to expand those to complete
| 152764 [dion@al ae .] Who needs specs when you can just have exegenesis/apocalypse style fluffing
| + 152766 [the.mindstor] #: Dion Almaer changed the world a bit at a time by saying on  8/18/2005 9:33 PM :#
| + 152787 [ptkwt@ar cn ] I don't get it, what's the issue?  Ruby as it exists in it's current form
|   + 152829 [mailinglists] I think a language needs a formal specification.
|   | + 152870 [zimba.tm@gm ] It could be intereting to make specifications, it could show where the
|   | + 152890 [tesla.nicoli] I think this is one of the reasons that PHP is controlled mostly by Zend
|   |   152932 [Peter.Fitzgi] current
|   |   + 152943 [tesla.nicoli] Microsofts breaking of compatibilty is the reason I was looking for
|   |   + 152947 [clr7.10.rand] Isn't that where (unit) testing comes into play? So that errors like
|   |   + 152952 [josh.charles] in the case of .NET, however, the changes that are going to happen
|   |     152980 [tesla.nicoli] Yes a road map is a better way. Mostly because the specifications don't
|   + 152880 [the.mindstor] #: Phil Tomson changed the world a bit at a time by saying on  8/18/2005 11:26 PM :#
+ 152769 [dblack@wo bl] My memory is that Matz said, at one or more of the RubyConfs, that he

require question
152751 [gaston.garci] ...
+ 152755 [ruby.brian@g] Unlike with php ruby does not simple include the sourcefile at the
+ 152758 [ruby-talk@wh] Gaston, welcome to Rubydom.  We've proven that we can be funny, but now
| 152770 [gaston.garci] ...
+ 152768 [acharlieblue] That's because require doesn't import local variables from a file. They

How would I make object revision storage?
152757 [chris@am ig ] in a system in something like Og.  It would be similar to how Zope (I think)
152762 [halostatue@g] I'm not sure that this will work at this point, as running code can't
152797 [chris@am ig ] Yes, I think I confused and simplified some issues in my mind here.

Protecting commercial ruby code with public/private key encryption
152772 [lists@so rc ] I was speaking with a co-worker today about the disappointment we feel
+ 152778 [mrcode@ne ro] Things like this have been suggested before, but the basic problem is that
| 152802 [lists@so rc ] As a matter of fact, I just looked through an older thread that I had
| 152827 [mailinglists] If you ask matz for this it's no problem he can give you his
| 152954 [steven.jenki] Many security experts assert that transparency of mechanism enhances
| 152959 [mailinglists] For academics: yes.
| + 152962 [derek@de ek ] Maybe i'm reading this wrong, but it looks as though you're saying
| | 152967 [mailinglists] With such a simple stupid implementation that it can be written on
| | 153046 [meta@po ox c] In that case, public key encryption is way overkill. Just use AES, or
| + 152963 [steven.jenki] Sorry, that's just wrong. I'm not an academic, and what I know about
|   152964 [lists@so rc ] I believe all Lothar was trying to say is that on an academic level it's
|   152966 [kero@ch ll .] "protect security IP", wth is that supposed to mean?
|   152968 [mailinglists] It's not the goal to make you believe it's secure.
|   + 152982 [kero@ch ll .] Myeah, I think I misunderstood what you meant (no security IP, but just
|   + 153045 [meta@po ox c] Well, if that's your goal, you're a snake-oil company, not a security
|     153097 [kero@ch ll .] That's wat I misinterpreted at first. He isn't selling security.
+ 152779 [florgro@gm i] If your computer can run it I can see it.
| 152823 [rwoliver2@gm] ...
| 152844 [florgro@gm i] I don't see why we would need to obfuscate source code on the server
| 152848 [rwoliver2@gm] ...
+ 152826 [lyndon.samso] ...
+ 152937 [derek@de ek ] If the code is encrypted, how are you going to decrypt it?
| 152948 [lists@so rc ] You're absolutely right...I did flub that in my description, didn't I?  I
| 152951 [josh.charles] The mono project allows you to create machine executable code by
+ 153009 [rhkramer@gm ] I'm not sure if you're talking about a specific type of encryption, but most
| 153013 [steven.jenki] Correct.
| 153027 [rhkramer@gm ] Thanks for the amplifications/corrections!
+ 153020 [druid.bpg@gm] You can use Exerb (http://exerb.sourceforge.jp/index.en.html) fow
| 153050 [lymans@gm il] (Unless it has changed recently) Please understand that if you open an
+ 153038 [tesla.nicoli] I use zend encoder now and again when I have a good idea and I don't

Python vs Ruby!
152776 [joevandyk@gm] Which is better, Python or Ruby?
+ 152824 [twifkak@co c] Joe,
+ 152828 [jcribbs@tw i] Yesterday I had to give a short presentation to the big boss about Ruby
| + 152831 [Ara.T.Howard] thanks alot - very interesting.
| + 152911 [bret@pe ti h] Could you show us an example of this? I'm sure i should be using blocks
| | 152923 [cribbsj@oa w] Ok, here is a somewhat simplified code example.  Let's say you have a
| | 152930 [khaines@en g] I *heart* that sort of query syntax.  You'll see much the same thing in the
| | + 152958 [igouy@ya oo ] Good ole Smalltalk :-)
| | + 152985 [twifkak@co c] def select
| |   153032 [jcribbs@tw i] Well, it's like I said in my original post, this was an example of a
| + 153076 [rcs@bg ar .n] You must be kidding! It is Python that has had the object oriented stuff
| | 153077 [rcs@bg ar .n] My bad (it's late).
| + 153081 [the.mindstor] #: Jamey Cribbs changed the world a bit at a time by saying on  8/19/2005 3:18 AM :#
|   153083 [jcribbs@tw i] I think I mentioned Python's lambda a paragraph or two above the one you
|   + 153084 [the.mindstor] #: Jamey Cribbs changed the world a bit at a time by saying on  8/21/2005 4:48 AM :#
|   + 153085 [jcribbs@tw i] Oops!  I should have said, "because a Python lambda can only have an
|     153109 [adrianh@qu e] Of course Python might not have lambda's much longer. See <http://
+ 152832 [bg-rubytalk@] (checks the mailing list)
| 152841 [james_b@ne r] I find this somewhat baffling.  I'm aware that Matz was influenced by
| + 152847 [joevandyk@gm] The style is different, sure, but a lot of the Perl shortcuts ($0, $$,
| + 152863 [khaines@en g] I came to Ruby from many years of Perl zealotry, and one of the things that
| | 152874 [jim@we ri hh] Same here.  After using Perl for a number of years I was trying to move to a
| | 152879 [lucsky@ma .c] According to my experience, it's because Python is just insanely
| + 152936 [snowzone5@ho] imho, this completely alienates newbies from the language.
| | + 152996 [james_b@ne r] Absolutely.  Over time, one hopes to acquire good taste in coding style
| | | + 153000 [jeff.darklig] or
| | | + 153022 [chrisgame@ex] Is that what they teach in schools these days? What happened to
| | | | + 153025 [kero@ch ll .] He makes a prototype, good engineering practice.
| | | | | 153044 [james_b@ne r] And "run right" can mean all sorts of things depending on the
| | | | + 153036 [khaines@en g] That is software engineering when one has a list of business requirements, and
| | | | | 153080 [the.mindstor] #: Kirk Haines changed the world a bit at a time by saying on  8/20/2005 4:06 PM :#
| | | | + 153040 [twifkak@co c] They taught software practice when you went to school? I learned from
| | | | | 153041 [khaines@en g] I didn't say it was.  But the consideration of beauty is secondary.  Sometimes
| | | | + 153043 [james_b@ne r] Well, school never taught me to refactor, period.  But "software
| | | | + 153066 [corey.ssf.la] Well, in "hardware engineering", the first thing is probably a
| | | + 153073 [meta@po ox c] Unfortunately, beauty is difficult to retrofit.
| | + 153008 [w_a_x_man@ya] Is something like this difficult in Python?
| + 153051 [adrianh@qu e] As somebody who used/uses Perl a great deal I found Ruby felt very
+ 152834 [james@gr yp ] James Edward Gray II
+ 152836 [james_b@ne r] What makes Rails so appealing is that it is *not* bleeding edge.  Rails
+ 152864 [gene.tani@gm] Besides SWIG, py has several mature well-documented libraries for
| 152867 [simon.kroege] At least for someone who never coded Perl, the mere existance
| + 152878 [halostatue@g] I've been programming in Ruby for a while now, and I only know the
| | + 152884 [jim@we ri hh] I will tend to use $: for one-off scripts because I can never remember if it
| | | 152886 [simon.kroege] examples?
| | + 152910 [khaines@en g] Austin, if you use the object interface for dealing with regular expressions,
| |   152924 [halostatue@g] I know. That's why you won't see $1 .. $9 in my code. ;)
| |   + 152926 [dblack@wo bl] Let's be fair, though.  It's $1 to $n :-)
| |   | 152935 [matt@te hn r] In the interest of m18n, shouldn't that be USD1 to USDn?
| |   + 152928 [khaines@en g] Hah.  Sorry.  After I sent the message it occured to me that I probably
| + 152939 [snowzone5@ho] $!, $_ $0 are my favorites.
+ 153809 [joevandyk@gm] Well, good news.  While Ruby's not on the companywide "approved" list
threads.html
top