181912-366789

181695-193308 subjects 182100-186126

save file
181912 [michaelaugus] my form
181957 [james@gr yp ] <%= form_tag({:action => "upload", :id => @property}, :multipart =>
+ 182070 [michaelaugus] yes that's correct , thanks
+ 183613 [eric.python@] I have the same problem.

Ruby Consulting work @ Where2GetIt.com
181913 [jonscarbroug] If you do Ruby programming and would like to take on a consulting job
181910 [julian.kamil] Jon, I'm interested in helping.  Please take a look at my resume here

undefined method `read' for
181917 [michaelaugus] I got an error undefined method `read' for, why ?
181916 [mreed@th re ] I'm guessing that whatever @params['image_file'] is doesn't have a read method.
181915 [michaelaugus] works better but still have error

What am I missing with this closure example?
181921 [sam.s.kong@g] Since my last question about
+ 181906 [hitesh.jasan] Like konsu states, you have two different closures.  Here's a little
| 181972 [sam.s.kong@g] Aha~
+ 181918 [mreed@th re ] The assignment "x = 0" gets executed every time you call f, creating a new x
+ 181919 [konsu@ho ma ] f("two") creates a lambda that sees 'x' as it was at the time of its
+ 181934 [mike@st k. a] Each time you call f you get a different x, so the lambda's x are

upload a picture save it on hdd
181924 [michaelaugus] how to uplaod the picture and save it in the folder

Rio: which is the slow one?
181926 [lispamateur@] caps = []
+ 181971 [meinrad.rech] ...
+ 181997 [chneukirchen] One line read to memory at a time.
+ 182024 [james@gr yp ] Here you are rolling your own split.
| 182669 [rio4ruby@ru ] This is a false comparison. The speedy code will not properly parse
| 182716 [lispamateur@] I didn't claim they are equivalent in principle; but for the purpose at
+ 182983 [rio4ruby@ru ] Good Question. The first problem is that you are using a general
  182985 [james@gr yp ] See FasterCSV.  ;)

Your Favorite One Liner
181927 [nugend@gm il] Give out your favorite one liner, what it does, and when you use it.
+ 181940 [ara.t.howard] hashify = lambda{ |*hashes| hashes.inject(accum={}){|accum,hash| accum.update hash} }
+ 181960 [james@gr yp ] This was originally posted by Erik Terpstra, with some editing from
| 181983 [w_a_x_man@ya] This doesn't properly handle whitespace between words.
| 181985 [w_a_x_man@ya] str =
+ 182103 [farrel.lifso] I did this while messing around at work one afternoon. Pretty sure it
| 182104 [farrel.lifso] Whoops here it is....
| 182138 [w_a_x_man@ya] 1 isn't a prime number.
| 182166 [jeff@sc wa c] mv primes.rb non_composite_natural_numbers.rb
| 182297 [steven@lu os] [1, [2, 3, 5,...]]
+ 182189 [horndude77@g] Since there's a prime one-liner (sort of) here's a fibonacci one-liner

Hash.from_zipped_array
181931 [farrel.lifso] [1,2,3].zip([2,4,6])
181943 [ara.t.howard] animal, sound = %w[dog cat bird], %w[woof meow cheep]
+ 182096 [farrel.lifso] Is there anything they haven't thought of in the API? They still keep
+ 182115 [dblack@wo bl] A good opportunity for my annual plug for the flattenx extension :-)
  + 182123 [james@gr yp ] It's not too hard to allow nested Arrays in Hash construction even
  | 182130 [dblack@wo bl] Hash[*arr.flatten_once]
  | 182170 [matz@ru y- a] I'm not sure above is the best solution, but anyway giving #flatten a
  | 182174 [dblack@wo bl] Actually the flattenx extension has both: flatten_once and flatten(n)
  + 182141 [chneukirchen] Try to get that into 2.0, at least flatten_once. *please*.
    182164 [ara.t.howard] agreed.  however i'd strongly go with an api like
    182179 [vjoel@pa h. ] Is that the sound of one API clapping? ;)

Waking ruby thread on external event
181938 [billk@ct .c ] I have Ruby embedded into a multithreaded C++ app.  It's easy for
+ 181941 [zdennis@mk e] Can't you do this the other way around as well.... write C/C++ extension for ruby which stores
| 181964 [billk@ct .c ] All ruby threads run on a single OS thread, and the ruby
+ 181959 [vjoel@pa h. ] Can the ruby thread just Thread.sleep, and wait for the C++ code to call
  181975 [billk@ct .c ] Hmm...
  181980 [vjoel@pa h. ] Not necessarily such a problem. rb_thread_wakeup() doesn't muck around

[ANN] St. Louis Ruby Dinner confirmation ** new time: 6:00pm **
181939 [curt.hibbs@g] ...
182249 [dave@pr gp o] Just to let you know that the last session of the afternoon doesn't

Re: Confused about "private"??
181951 [matz@ru y- a] Unlike Smalltalk, Ruby has methods to be called like functions in
182026 [info@jo na e] Matz,

[ANN] March Meeting of the Phoenix Ruby Users Group
181952 [james_b@ne r] The Phoenix Ruby Users Group will hold its monthly meeting on March 13,

returning more than one value
181973 [minkoo.seo@g] irb(main):001:0> def foo
181999 [interfecus@g] 1, 2 is not a valid expression using ruby syntax. Use something like

ASP.NET 2.0 vs Ruby On Rails
181978 [mghaoui@gm i] I've spent the past few weeks desperately looking for good comparisons
+ 181987 [mtrier@gm il] First, you'd probably get better response from the Rails list.
| + 182102 [w_a_x_man@ya] There's no such word as 'noone'.  Instead, 'no one', 'nobody', or
| | 182501 [fprimus@ux .] noone can quite begin to guess
| | 182504 [pbattley@gm ] Isn't pedantry fun?! ;-)
| | 182644 [fprimus@ux .] It sure is, I was just being lazy and did know of the reference.  I
| + 182217 [demmer12@fa ] You've got to be kidding about VS.NET being the best IDE there is
|   182236 [ruby@an hr p] } You've got to be kidding about VS.NET being the best IDE there is
|   182238 [uncledruby@g] ...
+ 182009 [ruby@an hr p] } I've spent the past few weeks desperately looking for good comparisons
+ 182146 [raims@do .c ] Take a look at the posts of this blog - http://www.softiesonrails.com/

_No_ Ruby Weekly News 20th - 26th February 2006
181981 [timsuth@ih g] 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@gm ] ...
182073 [charlie@ca t] ...

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@ya o] require "open-uri"

Regex replacement problem---replace every n-th
182000 [junk5@mi ro ] I have the string '1 20 3 400 5 60 7 800 9 0 ' and need to replace
+ 182003 [rossrt@ro co] str =  "1 20 3 400 5 60 7 800 9 0 "
| + 182004 [rossrt@ro co] +	 rep = "\n"
| + 182008 [phasis68@ho ] str =  "1 20 3 400 5 60 7 800 9 0 "
+ 182010 [junk5@mi ro ] Thanks all.
+ 182012 [robin@ni or ] text = '1 20 3 400 5 60 7 800 9 0 '
+ 182015 [dave@bu t. d] '1 20 3 400 5 60 7 800 9 0 '.gsub(/(\d* \d* )/) {|s| s + "\n"}
  182020 [rossrt@ro co] 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@bu t. d] n = ""
| 182016 [rossrt@ro co] 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@al m. it ] #inject is one of the basic tools of functional programming.  That's
|   | 182052 [rossrt@ro co] Well, sorry, I didn't realise we had to use them all. I like to use it
|   + 182058 [rossrt@ro co] Inject is real easy, and very handy. It's just like 'each', except it
|     + 182060 [pertl@gm .o ] how about that?
|     | + 182066 [james@gr yp ] And we can shorten "A"[0] to ?A.
|     | + 182067 [rossrt@ro co] 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@gm .o ] 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@fo .c m] could add one method  to Integer

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

multi CPU machine
182018 [joe2@ib .c m] Thanks, Ben
+ 182023 [james@gr yp ] 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@ib .c m] Thanks Ara,
    182127 [drbrain@se m] It doesn't matter, DRb isn't client-server, its peer-to-peer wrapped

Breaking Out Of A Loop
182019 [ruby@cr zy e] I'm somewhat new to Ruby and have been playing around with some very simple
182037 [ef@al m. it ] 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@fy h] There are some historical references to a problem with compiling Ruby
182792 [daniel.amela] Sorry for the late reply.
182813 [mental@ry ia] I don't recall having any problems with pthreads, but then I haven't
182817 [pjpizza@rs e] ugly is right, but I had even more issues than those with HPUX 11v2 on
182825 [mental@ry ia] 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@ro co] 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@ne r] It's a good question.
| + 182055 [vikkous@gm i] I would *love* to see a book about ruby DSLs. After seeing a little
| + 182065 [gwtmp01@ma .] You might want to read chapter 6 of The AWK Programming Language (Aho,
| | 182069 [tom@in oe he] 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@gm il] Surely you're joking, Mr. Feynman!
+ 182119 [ptkwt@ar cn ] Not a book, but I'm starting a new blog with a series of articles on how I'm
+ 182577 [hutch@re ur ] 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@gm ] That seems strangely familiar.  Perhaps this is why?
+ 188296 [amrmalik@gm ] 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@gm il] AFAIC See, this works all right, but my question is, just to learn the
182041 [dblack@wo bl] ...
+ 182051 [krekna@gm il] This looks indeed beautiful. Hmm, let me see, I can't find the capture
| 182053 [dblack@wo bl] ...
| 192053 [krekna@gm il] A bit late, but I was reading this post again, but your code is
| 192069 [lukfugl@gm i] 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@gm i] 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@gm i] a pretty straight forward way is to just use the eval function on a
+ 182059 [dblack@wo bl] That will create a new inner scope, so if there's no variable named
+ 182090 [logancapaldo] ...

Crib/summary sheet for Ruby
182054 [andy19191@fs] Is there a 1 or 2 page summary/crib sheet available for the Ruby
+ 182057 [dblack@wo bl] for print.  (I don't think there's a print version already, but there
| 182063 [desmarm@gm i] 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@an hr p] }
+ 182091 [jim@we ri hh] 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@gr yp ] I would love this feature.  HighLine prefers termios, but it has a

Intercepting STDERR
182076 [gavin@re in ] output = `lua #{filename}`
+ 182081 [dharple@ge e] output = `command 2>&1`
| 182086 [gavin@re in ] 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@re in ] 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@re in ] 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@we ri hh] 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@lu os] [~]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@ha t] 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@ha t] 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@ha t] Thanks.  The collaboa documentation is terse and it depends upon a lot

Re: [grammarians] Subclassing Struct.new
182097 [mental@ry ia] 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@gr yp ] File.open("my_file.txt", "w") { |f| f.puts "A line in the file." }
| 366789 [cispas2000@g] How can I display the content of a folder after some time of its
+ 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@wo bl] 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@pa lo r] [snipped]
| 182219 [chadfowler@g] Don't worry.  We'll pick a venue with two doors.
+ 182113 [lukfugl@gm i] Yay! I can actually make it to Denver on my budget! Looking forward to
+ 182125 [james@gr yp ] 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
threads.html
top