379116-380187

378906-379554 subjects 379334-380249

^ mechanize and Content Encoding Error
379116 [l17339 gmail] I'm trying to get some files from a webpage using Mechanize. Something

^ FlexMock v. Mocha
379120 [alex blackke] There are a couple of bits of functionality I rather like in Mocha, but
+ 379219 [b.candler po] Then use Mocha :-)
+ 379227 [alex blackke] Yeah, it's looking like a good option right now. For some reason I had

^ RubyWMQ and differences between MQ Series versions
379121 [jonatasdp gm] problem because the cmqc.h file doesn't exist.

^ gemspec: How to install a Ruby extension into GEM/lib/SOME_DIR/ rather than GEM/lib/
379124 [ibc aliax.ne] spec.name =3D "xxx-handler"
379129 [ibc aliax.ne] Solved. Using "create_makefile(dir/name)" does the work (thanks to Luis Lav=

^ Documenting multi-file C extensions
379125 [nmbooker gma] I'm having some trouble getting rdoc to recognise my module structure

^ rjb install error
379126 [dannyel88 ya] $ sudo JAVA_HOME=/usr/lib/jvm/java-6-openjdk gem install rjb
+ 379176 [dannyel88 ya] help pls...
+ 379208 [justincollin] This kind of error almost always means you are missing some development

^ Trying to install pg on 32bit Snow Leopard 10.6
379131 [sixtimesnine] I'm trying to install the "pg" gem on 32-bit snow leopard and I'm
+ 379132 [sixtimesnine] find_executable: checking for pg_config... -------------------- yes
| + 379222 [b.candler po] Strange, looks like this conftest forgot to #include the header or
| + 379317 [ged FaerieMU] Your PostgreSQL client library is x86_64, not i386. The "file was built =
+ 379133 [daniel.gayta] Enjoy!
| 379136 [sixtimesnine] On Feb 28, 9:32=A0am, Daniel Gayt=E1n <daniel.gaytan.n...@gmail.com>
+ 379156 [brian ledswo] I'm assuming you downloaded and and installed the PostgreSQL client?
+ 379243 [pedrolito la] The solution is to simply export the correct $PATH.

^ erb example from comp.lang.ruby fails
379138 [RichardDummy] I copied code from http://www.ruby-doc.org/stdlib-1.8.6/ (erb package
+ 379141 [cmdjackryan ] /1617782
| 379152 [RichardDummy] On Feb 28, 2:20=A0pm, Phillip Gawlowski <cmdjackr...@googlemail.com>
| 379153 [RichardDummy] On Feb 28, 6:01=A0pm, RichardOnRails
| 379154 [cmdjackryan ] Alas, I don't. It seems to be a quirk of ERb, or at least I haven't
+ 379142 [sean.ohalpin] /1617782
  379155 [RichardDummy] g/1617782
  379165 [sean.ohalpin] If trim_mode is passed a String containing one or more of the

^ Display Dir contents
379140 [paul hollyer] I am automating a few processes in my office - creating customer files
+ 379143 [jeremy bopp.] system("start C:/path/to/interesting/directory")
+ 379144 [sutniuq gmx.] Something like this (untested)?
  379145 [kalmanh gmai] No need for funky escaping. Just use single-quotes instead
  379146 [cmdjackryan ] system "explorer C:/your/folder/path"
  379151 [paul hollyer] Thanks to everyone who replied - it's just what I need. I hadn't seen

^ Comining Arrays
379147 [paul.sholtz ] It's a routine from a simple crypto algo, where I'm basically combining
+ 379149 [mentionuse g] I think what you want is Enumerable#zip.
+ 379150 [groups hjdiv] Sounds like you want zip.
  379159 [RichardDummy] Hey David,
  379160 [sduncan weta] ruby-1.9.2-p0 > %w( a b c )
  379161 [sduncan weta] And just to be sure, with 1.8.7 ...
  379163 [RichardDummy] Thanks.  My mind stopped this the thought that %w creates strings out
  379191 [sduncan weta] No need to apologise! I had to check myself =]
  379250 [RichardDummy] Thanks, Sam.  It's nice to see a gracious response!

^ How to retrieve the html read only properties of radio button
379162 [lalsinghanit] This Statement would give me the properties which are in read-write mode

^ question: threads behaviour
379166 [rblists gmai] As ruby threads are so called green threads, what's the behaviour when
+ 379168 [me kmwhite.n] I'm new to threading, but from what I've been able to find, if the
+ 379169 [normalperson] They're only green threads on Ruby 1.8, 1.9 uses native threads.
  + 379186 [shortcutter ] Where do you take that from?  AFAIK internally Ruby 1.8.* uses non
  | 379192 [normalperson] Yes, I meant "blocking" from a user-visible perspective, not from a
  | 379198 [shortcutter ] OK, but earlier you said that file system IO can block the entire
  | 379199 [normalperson] Filesystem IO (regular files) doesn't return EAGAIN (at least not on
  | 379224 [shortcutter ] pe
  | 379248 [normalperson] From http://www.kernel.org/doc/man-pages/online/pages/man2/read.2.html#NOTES
  + 379249 [Ruby GoogleM] That's not true. The vast majority of Ruby 1.8 implementations use
    379302 [shortcutter ] Really?  Which are those?
    379394 [Ruby GoogleM] * Rubinius
    379400 [headius head] Some JVMs started out with M:N threading (which I think is what you
    379465 [shortcutter ] It would also seem inefficient from the point of view that the OS does

^ [ANN] posix_mq 1.0.0 - kinder, gentler message queues
379167 [normalperson] POSIX message queues allow local processes to exchange data in the form

^ [ANN] io_splice 3.0.0 - kinder, gentler Linux zero-copy
379171 [normalperson] The splice family of Linux system calls can transfer data between file
379291 [groups inbox] This sounds really cool. Bookmarked!

^ Pattern matching French accented characters
379173 [thomas.luede] I am writing a French conjugation testing script, and a significant
+ 379195 [bbxx789_05ss] If you are not familiar with unicode, and you want to match utf-8
| 379197 [bbxx789_05ss] Uhhmm...you don't need to require 'jcode' to make regexes match
| 379211 [bbxx789_05ss] 1) Unicode assigns an integer to every letter in every alphabet in the
+ 379245 [tluedeke exc] Thanks, guys.  I'll take a shot in that direction.

^ telnet 1.9.1
379184 [gasparmrb gm] In the version of Ruby 1.8.7 this code works as expected
379207 [justincollin] Try 1.9.2. Worked fine for me there (with a different host, of course).
379233 [gasparmrb gm] Thanks!

^ Semantics of 1.9.2 Set
379189 [john.g.norma] I'm looking at the doc for the 1.9.2 Set class, which says (http://
379357 [colinb2r goo] I was hoping someone who had a detailed knowledge of Set and Hash
379358 [mentionuse g] I would agree that the documentation should not mention any order, as that's

^ exec using sh -c or directly running the command, depending on the system
379190 [xavier.noell] I'm stuck in a situation I don't understand and I'm looking for clues
+ 379210 [albertschlef] Ruby tells the shell to execute the command (that's why you see "sh -c")
| 379226 [xavier.noell] Thanks for your explanations, but this is along the lines of what I
| 379228 [shortcutter ] t !
| 379229 [xavier.noell] $ ruby --version
+ 379230 [b.candler po] Looks like there was a change in Ruby, where perhaps it now does an
  379231 [xavier.noell] That's what I noticed with quoting, but I never managed to take
  379232 [shortcutter ] You can always explicitly invoke the shell.

^ ANN: Sequel 3.21.0 Released
379196 [code jeremye] Sequel is a lightweight database access toolkit for Ruby.

^ Re: htpasswd
379201 [phil electri] require 'webrick/httpauth/basicauth'
379221 [phil electri] In fact, looking at webrick/httpauth/basicauth.rb it seems all you need

^ [ANN] rubygems-update 1.6.0 Released
379204 [drbrain segm] rubygems-update version 1.6.0 has been released!

^ "ri 'Array.[]'" fails
379205 [matt tidbits] /Library/Ruby/Gems/1.8/gems/rdoc-3.5.3/lib/rdoc/ri/driver.rb:1001:in
379213 [drbrain segm] You should file a bug if you think this is a bug in RDoc.

^ Older versions of Ruby
379206 [infi_u yahoo] I am a total newbie with regard to Ruby.  I am finding that the only
+ 379209 [developer al] I don't know what the package repositories have in Oracle Enterprise Linux, but you can always download 1.8.7 from the Ruby language site and compile it to your liking. (Ruby is written in C.)
| 379215 [chris chrisk] This problem goes away if you use Ruby Version Manager (rvm).  Wayne Seguin
+ 379220 [b.candler po] Where did you look?
+ 379331 [infi_u yahoo] Thank you all for your replies.  Unfortunaly, RVM is not an option for

^ [ANN] net-http-persistent 1.6 Released
379212 [drbrain segm] net-http-persistent version 1.6 has been released!

^ Module question
379216 [jp.billaud g] Hey,
379217 [ryand-ruby z] Kinda...

^ RubyODBC error codes when using prepared statements
379234 [dcordeiro gm] I'm using Ruby ODBC (with unixodbc and Postgresql).
379242 [dcordeiro gm] After some debugging, I found that I was trying to reuse a prepared

^ some unrecognized syntax error
379235 [sweensonti g] test.rb:1: syntax error, unexpected kDEF, expecting $end
+ 379236 [shortcutter ] 0000000  72  65  71  75  69  72  65  20  27  63  68  65  63  6b  65  72
+ 379237 [sweensonti g] root@localhost# dos2unix test.rb
| 379238 [shortcutter ] What does od tell you now?
| 379240 [peterhickman] Mmm, on 1.8.7 your code works with no problem. Have you tried  ruby -c
+ 379239 [sweensonti g] Ah, seems to be understood, I need mac2unix :)
+ 379241 [sweensonti g] problem solved, thank you, robert!
  379255 [echristopher] I've noticed recently that I can run Ruby files with DOS or Unix line
  379263 [jeremy bopp.] You didn't mention exactly what error you received when trying to run

^ [ANN] Cinch 1.1.2 released
379244 [dominikh for] Cinch 1.1.2 has been released!

^ array of valid arguments in optparse
379246 [ragrawal gma] I am trying to use optparse to parse an argument into an array and check
379251 [b.candler po] Well, the spaces will cause the shell to split it; the user will

^ Re: define_method(): why is the method unable to see $1?
379247 [bbxx789_05ss] Aren't local variables also local to the scope where they are set?  In

^ Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'
379252 [jakub.flaska] require 'active_record'

^ how to have socket server always listen but also initiate a connection
379253 [nephish gmai] Hey all.

^ Finding all empty directories in a subversion checkout
379254 [markus fisch] I tried to write a script to find all empty directories in a subversion
+ 379256 [hyagni gmail] case ... is the same as follows.
+ 379258 [mentionuse g] Instead of mapping values to nil and using compact, you can simply use
  379257 [mentionuse g] And of course I forgot the .sort :)
  379284 [sandor.szuec] 2..-1 is not correct. It's mostly correct, but what if valid files with=20=

^ What is inject doing here?
379259 [caduceass gm] Why does this not do what I expect?
+ 379260 [adgar carbon] The first two elements of the range are the first two elements to be =
+ 379277 [mentionuse g] Why is this done using inject? s is never used in the block, but since `p a`
  379308 [adgar carbon] I'm pretty sure he's just trying to understand inject's behavior on =
  379311 [mentionuse g] I forgot about that! :) I caught that one recently courtesy of JEG2.

^ How can i get the first letter of this string
379261 [minhduct4 gm] letter of this string: "=C3=A1 is the first letter".
+ 379262 [bbxx789_05ss] You can use the /u flag for a regex to signal utf-8 matching...but you
| 379266 [thiagown gma] irb(main):023:0> bacon="chunky"
| + 379267 [adgar carbon] That won't work on Ruby 1.9, as bacon[0] will return the first actual =
| + 379276 [mentionuse g] This will not work on Ruby 1.8, because the character involved is a two-byt=
+ 379273 [minhduct4 gm] thanks for your  help!
| + 379275 [tdihp hotmai] DQpISSwgdGhlcmUgbWlnaHQgYmUgbm8gZWFzeSB3YXkgdG8gd29yayB0aGlzIGFyb3VuZC50YWtl
| + 379328 [bbxx789_05ss] # encoding:utf-8
+ 379330 [minhduct4 gm] thanks for all!
  379333 [bbxx789_05ss] Wow...that's strange: when I run my example, no log file is created.  I

^ play music
379264 [junkone1 gma] i want to pass the frequency and play and record in ruby. how can i do
379265 [thiagown gma] How about a good cup of google?

^ Anything like Array.contains? method
379268 [paul.sholtz ] Is there a method in the Ruby array object that gives anything like a
+ 379269 [jos catnook.] Array.include?
+ 379270 [hyagni gmail] How about include?
  + 379271 [samykaruppa ] Returns the index of the first object in *self* such that is =3D=3D to *obj=
  + 379272 [paul.sholtz ] Yes, that's want I wanted.. :-)

^ mixin a module with initialize
379274 [tdihp hotmai] I want to mixin a class, overwrite the initialize method, but I still want to call the original initialize, how can I do this as simple as possible?
379283 [wagner.andre] In your module, you'll need to override the module's "self.included" hook.

^ How to stop a file from being required
379279 [usmanhhussai] Dir["features/whitelabel/step_definitions/*.rb"].each {|file| require
+ 379280 [mentionuse g] The name of the loaded feature is added to the array in $". A feature will
+ 379281 [anurag08priy] Does not require do that already? It loads the file only once unlike load.
  379282 [steve stevek] The only place this gets tricky is if you load a file from two different
  379294 [usmanhhussai] the problem is... we do not know where the file is first getting
  379296 [groups inbox] Avdi Grimm

^ Extracting the shortest string from an array
379285 [ibc aliax.ne] array =3D ["qwe", "qwerty"]
+ 379286 [rahegge gmai] array.min{|a,b| a.size <=> b.size }
| 379290 [jeremy bopp.] -Jeremy
| 379305 [pmckibbin gm] Very true
+ 379287 [th tp1.rub.d] arr.sort_by(&:length)[0]
| 379301 [shortcutter ] Inefficient as it creates a new array.  Better do
| 379312 [josh.cheek g] They're also O( n lg n ) where the correct solution, using min, is O(n)
| 379346 [shortcutter ] How do you know that it's O(n * log n)?  A reasonable implementation
| 379347 [josh.cheek g] Right. This was my point: using min is O(n), using sort is O(n lg n)
| 379353 [shortcutter ] OK, now I get what you mean.  You were referring to the sorts.  That
+ 379288 [pmckibbin gm] You could use
  379289 [ibc aliax.ne] Thanks to all :)

^ open4 stdin.close required?
379293 [brendan.grai] This is probably a stupid question, but I'm using open4 and I am

^ pretty printing Ruby code
379295 [nospam domai] I wonder, what are your solutions for pretty printing Ruby code,
+ 379297 [richard.conr] IIRC this is an area where most editors and IDEs excel at. Netbeans is what
+ 380155 [vbosch gmail] I use Latex with the listings package.

^ RubyForge ssh authentication change
379298 [tom infoethe] FYI, I've changed RubyForge's sshd setup so that now it requires a =

^ How to assign an element to a hash only if its value is not nil?
379299 [thomas thoma] hash = {}
+ 379300 [groups hjdiv] There is an alternate way.  Whether it is more beautiful or not is for you to
+ 379303 [adgar carbon] If you don't mind also overwriting the value if the value is false as =
| 379307 [gwtmp01 mac.] well as if the value is nil,
| 379309 [adgar carbon] Whoa, whoops, completely misread that. Early morning e-mail, disregard.
+ 379304 [blowmage gma] You could assign the all values and then remove the just the nil
| 379310 [shortcutter ] Oh, this is so ugly.  And also potentially inefficient since the hash
| 379314 [blowmage gma] our =3D> =A04, :five =3D>
| 379345 [shortcutter ] four =3D> =A04, :five =3D>
| 379354 [blowmage gma] I'm sure there are cases where removing values from a hash is appropriate.
| 379355 [colinb2r goo] Yes, but I think one of Robert Klemme's points was why put values into
| 379360 [blowmage gma] My assumption from the OP's question was that he wanted to populate a
+ 379306 [gwtmp01 mac.] I tend to use #nil? and 'unless' sparingly and using them together like =

^ Readline insists in ordering the returned array
379313 [ibc aliax.ne] "ddd", "bbb", "aaa", "ccc" and I want they to be shown in *that* order

^ How to make copies of array that do not impact on the original?
379315 [fluffy_bunny] I'm trying to make a sudoku solver that uses genetic algorithms in Ruby.
+ 379316 [ibc aliax.ne] a=3D ["qwe", "asd"]
+ 379332 [pmckibbin gm] Wouldn't it be better to have arrays of boards rather than copies with
+ 379344 [shadowfirebi] Not sure if this is helpful or not, but if it were me I'd make a Board class.  One of the methods would be the code to populate itself with random numbers.  You can then store all instances in an array.

^ slice! invalid byte sequence in UTF-8
379319 [leisikkeram ] if RUBY_VERSION =~ /1.9/
+ 379320 [ibc aliax.ne] puts main_page.inspect
| 379321 [leisikkeram ] Thanks for yours answer.
| 379322 [ibc aliax.ne] Sure, but does it print a "strange" symbol in your screen?
+ 379323 [leisikkeram ] <title>Biura nieruchomo\xB6ci | Agencje nieruchomo\xB6ci</title>
| 379324 [ibc aliax.ne] Maybe such page is not encoded in UTF8.
+ 379325 [leisikkeram ] It's encoding is iso-8859-2
+ 379329 [bbxx789_05ss] Encoding.default_external = Encoding::UTF_8
+ 379343 [leisikkeram ] I forgot about checking encoding.
+ 379371 [leisikkeram ] Problem is solved. My IDE causing this problem.

^ Re: float precision
379326 [flethuseo gm] This doesn't seem to work for certain numbers though... is there a way

^ extconf.rb spitting out SH Makefile on windows?
379327 [mreiland1978] Title says it all, I'm running ruby extconf.rb in a visual studio 2008
+ 379335 [echristopher] Since no one's chimed in yet, I thought I would just post to say you'd
| 379352 [sutniuq gmx.] I'd wonder if it was possible with Visual Studio anyway--All recent
+ 379373 [luislavena g] What version of Ruby are you using?
+ 379823 [mreiland1978] I ended up moving everything to the mingw toolchain, but I don't
| 379824 [luislavena g] I'm saying that using Ruby build with MinGW is not possible to compile
+ 379855 [mreiland1978] It sounds to me like it has more to do with some of Ruby's design
  379883 [luislavena g] Yes and no, see what I've mentioned about CRT mismatch.
  379968 [mreiland1978] Which is a technical challenge, not an insurmountable hurdle.  See
  379987 [cmdjackryan ] What Luis meant to say is that Ruby is open source. You are free to
  380013 [mreiland1978] mingw is not bundled with either Ruby Windows installer, or the rubygems
  + 380019 [luislavena g] Incorrect.
  + 380021 [jon.forums g] Get your facts right.
  + 380023 [cmdjackryan ] Step for is unnecessary, as has been pointed out.
    380094 [mreiland1978] Phillip, until you stop with the strawmen, I'm going to ignore you from
    + 380104 [luislavena g] Please, wiki is open, introduce your edits to make it more easy to
    + 380113 [jon.forums g] When you talk about Ruby, practically speaking, you implicitly talk
      380187 [mreiland1978] Which is fine, but I was asked what I thought should be changed.  It
threads.html
top