181981-192078

181791-193308 subjects 182172-186126

^ _No_ Ruby Weekly News 20th - 26th February 2006
181981 [timsuth ihug] Sorry, no RWN this week. Here are some interesting links to keep you occupied

^ [Newbie] Getting data from html-ish like crap.
181991 [spam_monkey ] I wanted to learn something, and choosed ruby,
182061 [jgbailey gma] First, don't use Net::HTTP. Require 'open-uri' at the top and you can
182073 [charlie cast] Here's some sample code you might enjoy.  It's a random chuck norris

^ interesting ruby-vtk wrapping issue
181992 [pseudoman4 y] I'm currently writing my diploma thesis and I'm going to use ruby-vtk

^ embedding ruby-vtk within c++
181993 [pseudoman4 y] interesting ruby-vtk wrapping issueHello everyboy

^ Re: Getting data from html-ish like crap.
181996 [w_a_x_man ya] r.body does not contain "Quatrina".
182074 [ghalsey yaho] require "open-uri"

^ Regex replacement problem---replace every n-th
182000 [junk5 micros] I have the string '1 20 3 400 5 60 7 800 9 0 ' and need to replace
+ 182003 [rossrt rosco] str =  "1 20 3 400 5 60 7 800 9 0 "
| + 182004 [rossrt rosco] +	 rep = "\n"
| + 182008 [phasis68 hot] str =  "1 20 3 400 5 60 7 800 9 0 "
+ 182010 [junk5 micros] Thanks all.
+ 182012 [robin nibor.] text = '1 20 3 400 5 60 7 800 9 0 '
+ 182015 [dave burt.id] '1 20 3 400 5 60 7 800 9 0 '.gsub(/(\d* \d* )/) {|s| s + "\n"}
  182020 [rossrt rosco] Well, that'll teach me not to try and do stuff before my all-important

^ Indexing system - ruby newbie
182007 [adam.groves ] I'm trying to write a class which converts a number into letters like
+ 182014 [dave burt.id] n = ""
| 182016 [rossrt rosco] This isn't as good as Dave's (it's potentially *lots* slower for a
| + 182021 [adam.groves ] Hey thanks guys. I'm really enjoying learning ruby - especially because
| + 182036 [adam.groves ] Dear Ross,
|   + 182042 [ef alum.mit.] #inject is one of the basic tools of functional programming.  That's
|   | 182052 [rossrt rosco] Well, sorry, I didn't realise we had to use them all. I like to use it
|   + 182058 [rossrt rosco] Inject is real easy, and very handy. It's just like 'each', except it
|     + 182060 [pertl gmx.or] how about that?
|     | + 182066 [james graypr] And we can shorten "A"[0] to ?A.
|     | + 182067 [rossrt rosco] n = 27
|     |   182075 [adam.shelly ] Here's one that uses succ to do the dirty work, but doesn't complicate
|     |   182145 [logancapaldo] % cat indexer.rb
|     |   182327 [aledonne.lis] A different approach from others in this thread... no memoization, no
|     |   182340 [logancapaldo] Thank you, I was trying hard to work out a way to use to_s(26) and
|     + 182064 [pertl gmx.or] tab = ["_", ("A".."Z").to_a].flatten
+ 182195 [w_a_x_man ya] def letter( n )
+ 182426 [malteNOSPAM ] Only after reading the other posts, I realized you want Y, Z, AA, AB, AC
  183027 [ Rob foo.com] could add one method  to Integer

^ mr_guid install question on SuSE Linux?
182013 [info johnale] I am not sure this is the best place for this question, it might better

^ multi CPU machine
182018 [joe2 ibn.com] Thanks, Ben
+ 182023 [james graypr] Not really, no.  It's coming though, eventually...
+ 182038 [ara.t.howard] sure.  just use multiple processes.  with drb this is easier and safer than
  + 182044 [james.herdma] I thought Ruby threads all ran within the same process, which are
  | + 182045 [james.herdma] The grandparent to my post mentioned DRb, or "Distributed Ruby".
  | + 182046 [james.herdma] The grandparent to my post mentioned DRb, or "Distributed Ruby".
  + 182062 [joe2 ibn.com] Thanks Ara,
    182127 [drbrain segm] It doesn't matter, DRb isn't client-server, its peer-to-peer wrapped

^ Breaking Out Of A Loop
182019 [ruby crazyte] I'm somewhat new to Ruby and have been playing around with some very simple
182037 [ef alum.mit.] You have a race condition.  "s == 'close'" is getting evaluated before

^ Checkstyle and code formatting
182028 [anthony.eliz] Is there any sort of Checkstyle/code formatting tool for Ruby? I'm

^ pthreads on HPUX
182029 [benjohn fysh] There are some historical references to a problem with compiling Ruby
182792 [daniel.amela] Sorry for the late reply.
182813 [mental rydia] I don't recall having any problems with pthreads, but then I haven't
182817 [pjpizza rsie] ugly is right, but I had even more issues than those with HPUX 11v2 on
182825 [mental rydia] Well, that part's not anyone's fault really.  ucontext_t is very

^ ruby modules and classes
182030 [efuzzyone ne] When I try the code below I get an error. Why is it so? Am I misunderstanding
182034 [rossrt rosco] module Debug
182237 [efuzzyone ne] Thanks for your reply.

^ Can Anyone Recommend A Good DSL Book?
182033 [smountcastle] I apologize if this has been asked on this list before (I did a quick
+ 182047 [james_b neur] It's a good question.
| + 182055 [vikkous gmai] I would *love* to see a book about ruby DSLs. After seeing a little
| + 182065 [gwtmp01 mac.] You might want to read chapter 6 of The AWK Programming Language (Aho,
| | 182069 [tom infoethe] Along the same lines, the O'Reilly Lex and Yacc book (by John Levine and
| | 182114 [smountcastle] Gary and Tom,
| + 188163 [lester ix.ne] one too many negatives in that last sentence! (I hope!!!)
|   188170 [gilesb gmail] Surely you're joking, Mr. Feynman!
+ 182119 [ptkwt aracne] Not a book, but I'm starting a new blog with a series of articles on how I'm
+ 182577 [hutch recurs] I don't know of anything specific. Some of the lisp books, for
+ 182579 [kiaroskuro g] While it's not a DSL book, Domain Driven Design by Evans is going to
| 188162 [david.bailey] Good stuff.  Covers all of the basics, and has clear examples of the
| 188178 [agorilla gma] That seems strangely familiar.  Perhaps this is why?
+ 188296 [amrmalik gma] Its not Ruby related, but you might want to look at "Starting Forth" and

^ Gtk::TreeView, Libglade and Ruby
182035 [michael.lesn] I have created a small testcase for working with a TreeView which I

^ code snippet: can it be done better/shorter?
182039 [krekna gmail] AFAIC See, this works all right, but my question is, just to learn the
182041 [dblack wobbl] This message is in MIME format.  The first part should be readable text,
+ 182051 [krekna gmail] This looks indeed beautiful. Hmm, let me see, I can't find the capture
| 182053 [dblack wobbl] This message is in MIME format.  The first part should be readable text,
| 192053 [krekna gmail] A bit late, but I was reading this post again, but your code is
| 192069 [lukfugl gmai] The value "Unknown" will not be assigned to from, but it doesn't need
| 192074 [robert.dober] Which is unfortunately not true because of  possible side effects, in
| 192078 [lukfugl gmai] True. I should have said "essentially equivalent". :) For those
+ 192070 [shortcutter ] Usually using a RX in a constant is less efficient and in this case

^ Create named objects
182040 [Roland.Schmi] name = "input"
182056 [kgoblin gmai] a pretty straight forward way is to just use the eval function on a
+ 182059 [dblack wobbl] That will create a new inner scope, so if there's no variable named
+ 182090 [logancapaldo] charset=US-ASCII;

^ Crib/summary sheet for Ruby
182054 [andy19191 fs] Is there a 1 or 2 page summary/crib sheet available for the Ruby
+ 182057 [dblack wobbl] for print.  (I don't think there's a print version already, but there
| 182063 [desmarm gmai] I think that PDF::Writer includes something like this in the demos that
+ 182089 [gene.tani gm] ...
  182107 [dev.random g] ...

^ RubyGems issues
182071 [NOatkinwSPAM] - Why do I have to confirm each _required_ dependency?  What chance
+ 182072 [ruby anthrop] }
+ 182091 [jim weirichh] Quite good if you've installed some software as non-gems.  That being
  182094 [NOatkinwSPAM] Maybe there could be a distinction between required dependencies and
  182095 [james graypr] I would love this feature.  HighLine prefers termios, but it has a

^ Intercepting STDERR
182076 [gavin refine] output = `lua #{filename}`
+ 182081 [dharple gene] output = `command 2>&1`
| 182086 [gavin refine] That'll do for now, thanks! :)
| 182093 [logancapaldo] You may want to check out IO.popen and IO.popen3 (or is it popen2? I
+ 182085 [ara.t.howard] success
  182218 [gavin refine] That's awesome, ara. Unfortunately, I need to write something that will
  182221 [ara.t.howard] absolutely.  basically what you're after is open3 - it's in the stdlib and
  182534 [gavin refine] Thanks so much, Ara. That's almost perfect, except that the exitstatus
  182545 [ara.t.howard] pid = fork{

^ Ruby Path
182077 [Joiey.Seeley] My ruby applications have suddenly stopped running on my PC.  It looks
182084 [jim weirichh] Libraries in the gem directories need to use the RubyGems runtime to
182133 [Joiey.Seeley] Jim,
182184 [r.mark.volkm] How do you put two options in RUBTOPT?  What's the delimiter?
182208 [ml.chibbs gm] If you want to put multiple options in RUBYOPT then you must use the

^ hash generate
182078 [michaelaugus] I need to generate a hash like
182192 [steven lumos] [~]0% ruby -rdigest/md5 -rbase64 -e '5.times {Base64.b64encode(Digest::MD5.digest(rand.to_s))}'

^ RAA is down [1-Mar-2006]
182088 [Daniel.Berge] Bad Gateway

^ Ruby based Project Control application?
182092 [byrnejb hart] I am looking for an open-source, web-based, project control,
182108 [bauer.mail g] I havent used it yet, but you can check out: http://collaboa.org/
182121 [byrnejb hart] I cannot get collaboa to install.  I am using subversion 1.3.0 and
182200 [bauer.mail g] Yea, I've never installed it personally, but I know it works, a friend
182283 [byrnejb hart] Thanks.  The collaboa documentation is terse and it depends upon a lot

^ Re: [grammarians] Subclassing Struct.new
182097 [mental rydia] I don't agree about whitespace in this case -- I think it's fine

^ show all files from a folder
182098 [michaelaugus] I can not find nothing about files in google,
+ 182105 [james graypr] File.open("my_file.txt", "w") { |f| f.puts "A line in the file." }
+ 182106 [jared.RMOVE_] Check out Dir and File
+ 182109 [tomwilcoxen ] my_dir = Dir["C:/workspaces/Source/**/*.rb"]   # collect all the
+ 182122 [michaelaugus] thank you all of you for help :)

^ [ANN] RubyConf 2006, October 20-22, Denver!
182099 [dblack wobbl] Dear Rubyists,
+ 182101 [ara.t.howard] yay!  guess i'll make it this year ;-)
| 182112 [chadfowler g] Make it?!  You'll be working the door! ;)
| 182163 [pabs pablotr] [snipped]
| 182219 [chadfowler g] Don't worry.  We'll pick a venue with two doors.
+ 182113 [lukfugl gmai] Yay! I can actually make it to Denver on my budget! Looking forward to
+ 182125 [james graypr] My parents will be so thrilled you have given me an excuse to go see
+ 182203 [gregory.t.br] I've been meaning to get back to Colorado sooner or later.  Guess it's

^ utime: still with bug?
182100 [aaa.a99 dfgh] with ruby 1.8.4 on Windows XP, there seems still to be an error of 1
+ 182124 [Daniel.Berge] I think the bug is actually in Window's utime() implementation, based on
+ 182206 [ocean m2.ccs] Sorry, this is regression I introduced when fixed another bug of stat(2) on WinNT.
  182223 [axel.friedri] Thank You! (I'm looking forward to get the "right" utime.)

^ drb Applications
182111 [reto-ruby-ta] Can anybody recommend an open source software which uses drb? It would
182126 [cribbsj oakw] I use drb in KirbyBase (http://netpromi.com/kirbybase_ruby.html) to
182129 [ara.t.howard] ruby queue use a local drb server to do fork/exec jobs in another process.

^ Confusion Over Keyword Arguments
182116 [   no no.com] Ruby 2.0 will include new syntax for hash literals: {a:3, b:4}. However,
+ 182118 [logancapaldo] Ruby doesn't have keyword arguments at all. When you call a method
| 182128 [   no no.com] Keyword arguments aren't hashes.
+ 182144 [cohen.jeff g] I am personally not in favor of allowing the : character instead of =>.
| + 182147 [mental rydia] Assignments are legal in most places that => is; would you want to
| | 182151 [cohen.jeff g] h = { 'a' => 5, 'b' => 6 }
| | + 182154 [dblack wobbl] No one said *illegal* assignments were allowed :-)
| | | 182159 [cohen.jeff g] Phhhewwwwww - Man, has it been a long day.  Sorry for the brainfreeze.
| | + 182162 [mental rydia] Legal, not equivalent.
| + 182150 [dblack wobbl] I don't think it's extra.  I would hate to have to parse -- visually
|   182155 [cohen.jeff g] start_hockey_game(:home_team = "Chicago", :away_team = "Detroit")
+ 182175 [matz ruby-la] No, on the virtual implementation (only inside of my brain), they are
  + 182181 [none none.ne] We are running out of characters, could we instead switch to
  | 182183 [matz ruby-la] Too late.  Perl6 took that place.
  | 182187 [mike stok.ca] Does Perl 6 exist yet?  (Yes I know Pugs exists, but Perl 6 seems to
  + 182186 [ news jay.fm] If the keyword has to be unadorned, and this has to be done solely through
  | 182220 [adam.shelly ] How about using Pascal for inspiration? Keep both the : folks and the
  | 182264 [Daniel.Berge] That can be made to work, with the understanding that '=' in a method
  | + 182266 [ara.t.howard] but is
  | | + 182267 [Daniel.Berge] Second one.
  | | | 182271 [ara.t.howard] but that's a problem no?  number two is the same as this
  | | | 182277 [Daniel.Berge] No, then they become positional.  That's the same as foo 2, 5.
  | | + 182272 [dblack wobbl] You may have to bite the bullet and dust off your parentheses keys :-)
  | |   182280 [cohen.jeff g] I completely agree.  I kind of like the current technique of using an
  | + 182268 [james graypr] assert_instance_of(Name, (name = Name.new( (first = "James"), (last =
  | | 182269 [Daniel.Berge] Or, maybe we should just stick with "=>" as a keyword operator, and
  | + 182281 [matz ruby-la] I'm not sure if we _can_.  yacc is a tough guy to fight with.
  | | 182291 [Daniel.Berge] Error.  There's no 'foo' parameter.  Passing a literal hash would require {}.
  | | + 182295 [matz ruby-la] I'm not sure what you meant by "literal hash".  Do you mean foo:3 is
  | | | 182299 [Daniel.Berge] Oops - I didn't notice you had declared it "*c" instead of "c".  My blog entry
  | | | 182328 [none none.ne] I presume both this and the section before, Matz means
  | | + 182332 [none none.ne] defined in
  | |   182336 [Daniel.Berge] Yes, I think this is one of the reasons we started leaning towards using
  | |   182342 [none none.ne] Both problems should be fixed by mandating that there
  | + 182290 [srinivas.j s] This has reference to the discussion in the article below.
  + 182215 [transfire gm] I don't think anything works like ':' does --it has a divisor quality.

^ case/when question
182131 [cremes.devli] I was intrigued by the post that _why put up a few days/weeks ago
+ 182134 [james graypr] Method definitions, unlike blocks, are not closures and do not have
+ 182135 [cremes.devli] Responding to my own email...
| 182140 [dblack wobbl] Sort of :-)  Actually @r1 is an instance variable, not a class
+ 182136 [dblack wobbl] You've defined r1 and r2 outside of the scope of the method definition

^ Where to put ruby.h?
182137 [byrnejb hart] I install ruby via a binary rpm, however I have a requirement to provide
182157 [drbrain segm] ruby -rrbconfig -e 'puts Config::CONFIG["archdir"]'
182214 [byrnejb hart] Thank you.
182246 [byrnejb hart] After the light went on I installed the ruby-devel-1.8.4-1.c4.i386.rpm

^ Nuby - NEW case/when question
182149 [cremes.devli] I have a new question regarding _why's post [1].
182168 [dave.burt gm] In the comment, he's talking about something different, not case/when

^ DSL blog
182152 [ptkwt aracne] I've started to blog about re-visioning my RHDL DSL.  I'll post about how I've
+ 182178 [Bil.Kleb NAS] Yes; Thanks,
+ 182182 [jim weirichh] I like it.  Can't wait for more entries.

^ [SOLUTION] Current Temperature (#68)
182156 [email55555 g] My one-line solution.

^ Newby question: Is += atomic for integers?
182158 [richard.j.co] Can the following program produce counts that are wrong?
+ 182160 [drbrain segm] $ parse_tree_show -f
+ 182222 [minkoo.seo g] Yes.
  + 182232 [bob.news gmx] I strongly support that!  Always do proper synchronization even if a non
  + 182323 [mental rydia] And following from that, use as little shared state as possible

^ create folder ok delete not
182165 [michaelaugus] it works
182167 [michaelaugus] sorry never mind its so stupid I think I am tired

^ Re: Current Temperature (#68)
182169 [semmons99 gm] Semi-colons, that is so cheating. :-)
182229 [dave.m email] require("open-uri") && puts((ARGV.size !=1) ? "Usage: #$0 <zip code>": ("The
182326 [cohen.jeff g] Or loss of profit to the original publisher.
182338 [chneukirchen] Now, let's consider screen-scraping really is "quoting".  With proper
182343 [cohen.jeff g] Um, I don't know about that, actually.  You have to make sure you're not
182345 [chneukirchen] Let's sue Technorati! And Google Feeds!
threads.html
top