403027-404377 subjects 403447-404529

Variable empty or not
403211 [lists@ru y- ] I am doing some evaluating on a variable,
+ 403215 [ryan@ra to m] nil != ""
+ 403218 [lists@ru y- ] Thank's Ryan it worked perfectly with "" . I will adjust my code to not

commutative operations
403224 [uzleepito@gm] How would you solve the issue below?  I'm looking for an elegant
403225 [jgabrielygal] specifically the part about type coercion and operator overloading.

Handling library versions
403228 [lists@ru y- ] I am trying to implement a library that provides an unified way to
+ 403230 [fluido@fl id] One of the advantages of object orientation is inheritance - ideal in
+ 403240 [lists@ru y- ] Dear Carlo,
  403241 [fluido@fl id] Ruby has inherited from Perl the aspect of providing many many ways to
  403242 [toraritte@gm] in capistrano they used a hash to map methods for compatibility issues

Embedding Ruby in C - linking
403231 [lists@ru y- ] I'm not sure, whether this is the right forum for my question. I'm sorry

[ANN] ruby2ruby 2.0.2 Released
403233 [ryand-ruby@z] ruby2ruby version 2.0.2 has been released!

[ANN] hoe 3.4.1 Released
403234 [ryand-ruby@z] hoe version 3.4.1 has been released!

[ANN] loofah-activerecord 1.1.0 Released
403235 [mike.dalessi] loofah-activerecord version 1.1.0 has been released!

[ANN] Ruby 1.9.3 patchlevel 374
403236 [usa@ga ba ec] Now Ruby 1.9.3-p374 is released.

Adding file directory automatically
403244 [lists@ru y- ] I have a bit of code that will add an amount to an array and then print
+ 403245 [jgabrielygal] I'm not sure what problems you are having exactly, File.open can
+ 403246 [lists@ru y- ] Yeah I have a File.open function opening, a file called david.txt. In
+ 403247 [lists@ru y- ] #!/media/Apache/ruby/bin/ruby
| 403249 [alexg@ru ge ] If I understand your question correctly (and I'm not 100% sure I do!),
| 403251 [hassan.schro] +1 to that. This whole thing is so painfully un-Rubyish. And this --
| 403255 [me@da id wd ] Be gentle guys. There was a time we didn=92t know this either.
+ 403274 [lists@ru y- ] Yeah Its for a uni prodject and I have never used Ruby before so its a
| 403276 [alexg@ru ge ] IMO, as part of a learning process, generating hand written html is
+ 403277 [lists@ru y- ] Yeah thanks Alex for all your help!
| 403283 [alexg@ru ge ] I think there is a fundamental misunderstanding of the idea behind my
+ 403280 [lists@ru y- ] Just a quick update have the whole thing put together using an else if
+ 403284 [lists@ru y- ] WOW! I did this to begin with then thought I was doing it wrong! How
+ 403285 [lists@ru y- ] For some reason, it doesnt think that item has been filled from the
+ 403288 [lists@ru y- ] "files[item" isn't valid. "files[item]" would be valid code...
+ 403290 [lists@ru y- ] Yeah sorry its been a long day of coding today.
+ 403291 [lists@ru y- ] Right ran the code saying that item is not a hash . Then inspecting the
+ 403292 [lists@ru y- ] Possibly.
+ 403293 [lists@ru y- ] With regard to the enormous sequence of puts, you might want to look
+ 403295 [lists@ru y- ] So confused!
+ 403296 [lists@ru y- ] All fixed!
+ 403297 [lists@ru y- ] That's not really an ideal solution, you should probably trace the
+ 403299 [lists@ru y- ] I think its because I was setting it to an array without realising. I
+ 403308 [lists@ru y- ] Another alternative would be

Code Reviews
403250 [wbrisett@at ] As a solo Ruby programmer and one who is still on the learning curve, I wanted
+ 403252 [lists@ru y- ] Post the code to http://chopapp.com/ and then post the link here. You
| 403253 [cliff.rosson] How is this different from a gist post?
| 403254 [jonanscheffl] It has a red button.
+ 403256 [ryand-ruby@z] nted=20
+ 403258 [schang@wx .n] I should recommend to read  (and study) the book "Refactoring" written
+ 403259 [schang@wx .n] I forgot to mention you should read the Ruby version of that book.
+ 403261 [lists@ru y- ] Pull request on github.com or bitbucket.org would be the perfect way of

[ANN] RubyInstaller 1.9.3-p374 released
403263 [luislavena@g] In combination with the rest of the RubyInstaller team, I'm very

Background threads and Process.daemon
403264 [benweint@gm ] I'm seeing some unexpected behavior with background threads and
403265 [benweint@gm ] Ah, I believe I've found the issue. Process.daemon calls daemon(3), which

Increase Default TimeOut in WATIR
403267 [lists@ru y- ] I have been sing WATiR for quite a time. Right now I m working with a
403289 [lists@ru y- ] @client = Selenium::WebDriver::Remote::Http::Default.new

Module including other module.
403269 [dummey@gm il] Simplified Code: https://gist.github.com/4563204
+ 403275 [lists@ru y- ] hmmm...
| 403287 [dummey@gm il] I've updated the gist a bit to reflect what you found about moving the
+ 403302 [lists@ru y- ] not sure i understood correctly, but this works -
+ 403307 [fxn@ha hr f.] I asked about this to Matz in the past and it works that way basically as a
  403309 [dummey@gm il] Ahh, that makes sense! Thanks Xavier!

[ANN] gettext 2.3.7
403270 [yoshihara@cl] In 2013-01-11 (last week), we released gettext gem 2.3.7.

[ANN] kgio 2.8.0 - kinder, gentler I/O for Ruby + Unix
403271 [normalperson] kgio provides non-blocking I/O methods for Ruby without raising

[ANN] Rainbows! 4.4.3 - Rack HTTP server for the sleepy
403272 [normalperson] Rainbows! is an HTTP server for sleepy Rack applications.  It is based on

Training Courses Ruby + Selenium
403273 [lists@ru y- ] I am looking for training courses in Ruby and Selenium, does anyone have

converting Unix time to Ruby time
403278 [lists@ru y- ] 1325376000
403279 [fxn@ha hr f.] Just curious.
403282 [lists@ru y- ] Yes -- it's part of the GreenButton energy reporting standard.  If
403298 [lists@ru y- ] DateTime.strptime(1325376000.to_s,'%s')

How backtracking works in Ruby?
403281 [lists@ru y- ] What i am going to ask is very basic thing I know. But,as a newbie to
403680 [echristopher] This freely-available chapter from _Mastering regular expressions_
403717 [lists@ru y- ] Can anyone help me to understand the concept with some codes? Code
403756 [shortcutter@] Look into the regexp engines implementation.  You won't easily see how
403792 [art@ar ta lo] On 1 Feb 2013, at 2:53 AM, Robert Klemme <shortcutter@googlemail.com> =

Search a value from nested hash
403286 [lists@ru y- ] i need some guide to complete my task
403325 [shortcutter@] Can you please give a complete example?  In the outermost Hash there

Re: [RubyInstaller] Re: [ANN] RubyInstaller 1.9.3-p374 released
403294 [luislavena@g] Windows 8 finally corrected some APIs that Ruby used to workaround. Just th=

How do I make this repeat itself?
403300 [lists@ru y- ] So, I'm trying to make a simple calculator (I'm new, and I got help from
403301 [ryan@ra to m] Wrap the whole thing in a while loop (in this case, the while condition
403303 [lists@ru y- ] Thanks.

403304 [lists@ru y- ] 1. i am using fck editor in my application.
403306 [mikaa123@gm ] You should probably try not to save it in html in the database.
403321 [shortcutter@] Because?

[ANN] io_splice 4.2.0 - zero-copy pipe I/O for Linux and Ruby
403305 [normalperson] The splice family of Linux system calls can transfer data between file

Re: Code Review + Feedback Request
403310 [kartik.kotta] I would appreciate getting feedback/suggestions (best practices) on my

Any rubyists from Kuwait
403311 [neotamizhan@] This is Siddharth, an Indian working in Kuwait. Though my day job is in C#,

[ANN] kramdown 0.14.2 released
403314 [t_leitner@gm] ## About kramdown

2Q: Getting first 4 elements from array and calling class methods directly
403315 [atma@co va e] I have written a quick n dirty code to display the first 4 RSS entries =
+ 403316 [sandor.szuec] => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
| + 403323 [atma@co va e] Thanks,
| + 403324 [shortcutter@] ntries' object array?
+ 403359 [josh.cheek@g] I prefer bracket notation because it works anywhere in an array

match a value from hash which is inside array
403317 [lists@ru y- ] if  result.has_key?("Value)
+ 403320 [lists@ru y- ] array.each{|entry| p "found the result" if entry.include?("Value-8")}
+ 403322 [shortcutter@] No, it most likely won't.  Partly because there is a syntax error

help with queue-tip
403318 [mustafa@al u] ...

question about string concatenation
403326 [lists@ru y- ] s = "[" 9.to_s "]"  # error
+ 403327 [rubytalk2dav] Looks like you're trying to "autoconcatenate" three strings.  (If that
| 403329 [lists@ru y- ] That makes sense. I'll accept that on 'faith' until I gain a deeper
| 403330 [shortcutter@] s = "[#{9}]"
+ 403328 [calvin.bornh] the thing you are puzzled about happens because you did not tell Ruby
+ 403336 [botpena@gm i] just make your expression string friendly, eg
  + 403337 [shortcutter@] You do not need .to_s inside string interpolation.  But what is the
  | 403339 [botpena@gm i] sorry for the confusion, robert.  i just wanted to show how to combine auto
  | 403343 [shortcutter@] But the point of string interpolation is that the expression does
  | 403344 [botpena@gm i] oops, mea culpa =)
  + 403875 [lists@ru y- ] Nice thread it is. `+1` to you.

Newbie prompt help
403331 [lists@ru y- ] I am new to programing, and especially new to Ruby.
+ 403332 [nspryspartan] Well I'm not a Mac user but that means the shell is working? That's the
+ 403333 [josh.cheek@g] of Ruby has set the prompt differently in irb), BUT I do know it isn't a
+ 403334 [windwiny.ubt] which irb
+ 403335 [sbagdat@gm i] You can use *irb --prompt default* instead of only irb
| 403338 [sntshkmr60@g] On Linux this happens when I pass --simple-prompt to irb
+ 403349 [atma@co va e] Best thing is to install ruby-1.9.3. The default ruby is deprecated under macosx.

Enumerator usage
403350 [lists@ru y- ] 3.times { |i| puts(i) }  # ok
+ 403352 [fluido@fl id] Ruby documentation is well-made. Make good use of it!
| 403355 [lists@ru y- ] Let me respond to this part of your reply first, to get it out of the
| 403357 [fluido@fl id] I should know... Back in 1978, during my last year at high school, I
+ 403353 [af17g11@gm i] else'.
+ 403356 [shortcutter@] Yes, because there is no method "n".  The block makes it parse as a method call.
| + 403358 [lists@ru y- ] That puts it in perspective. Out with the old idioms, in with the new;
| + 403362 [lists@ru y- ] add_two = 2.method(:+)
+ 403363 [gwtmp01@ma .] On Jan 21, 2013, at 2:20 PM, David Richards <lists@ruby-forum.com> =
| 403368 [lists@ru y- ] But it is possible to create a block programmatically during runtime by
+ 403694 [lists@ru y- ] Nice and helpful it is.

Weird send behavior in 1.9
403351 [lists@ru y- ] Hey Guys,
403354 [shortcutter@] Not a Rails expert but I think there is a bug in your code: you do not

script gets executed multiple times by cron
403364 [atma@co va e] I'm running this script https://gist.github.com/4591053 on a freebsd =
+ 403365 [matt@te hn r] Try putting something in the minutes field.
+ 403376 [tamouse.list] This is telling cron to run the job every minute in the 4th hour. See
  403378 [atma@co va e] I've read two quick guides, I thought I figured but apparently I got it =

Using CSV file as an Excel file using Ruby
403367 [lists@ru y- ] i have written q code to read an excel file and copy that range of data
403370 [sto.mar@we .] Nobody can help you when you do not tell us *how* you have tried

[SEC][ANN] Rack 1.5.0, a modular Ruby webserver interface
403371 [jftucker@gm ] Today we are proud to announce the release of Rack 1.5.0.
+ 403372 [jftucker@gm ] ...
+ 403374 [normalperson] <tt>rack.version</tt>:: The Array [1,1], representing this version of Rack.

[ANN} JRuby Hackfest Berlin on February 2
403373 [flo@an er gr] the eurucamp team, along with the Ruby Berlin e.V. will run a series of =

Re: RubyFrontier errors
403375 [lists@ru y- ] I used UserLand Frontier years ago to set up a web site. Going back
+ 403380 [lists@ru y- ] I've installed xcode command line tools and Ruby 1.9.3
+ 403387 [ryand-ruby@z] Please file a ticket with the project website/author.

Getting error "getaddrinfo: No such host is known. (Socke tError)" with mechanize gem
403377 [lists@ru y- ] require 'mechanize'
403379 [shortcutter@] Maybe it's the DNS setup on the company machine or how Ruby interacts
403381 [lists@ru y- ] The link is opened and workable on my each browser - 'IE-9','firefox'
+ 403384 [shortcutter@] Nokogiri will not open remote connections.  It's just for parsing XML,
| 403386 [lists@ru y- ] I didn't get you. cloud you explain the syntax or give me a sample code
+ 403389 [botpena@gm i] check if you're behind a proxy
  403395 [lists@ru y- ] Yes,We are using `Proxy`. Is the proxy only reason for that error? how I
  403435 [lists@ru y- ] Is there anyway I can eliminate all the above errors and can work with
  403438 [lists@ru y- ] If your browser works you can use webdriver with the browser and its

[ANN] GORUCO 2013 CFP Announced
403383 [beholdthepan] *GORUCO 2013: Call for Proposals

[ANN] hoe 3.5.0 Released
403388 [ryand-ruby@z] hoe version 3.5.0 has been released!

[ANN] ZenTest 4.8.4 Released
403390 [ryand-ruby@z] ZenTest version 4.8.4 has been released!

[ANN] test-unit 2.5.4
403391 [okimoto@cl a] test-unit 2.5.4 has been released.

[ANN] flog 3.2.2 Released
403392 [ryand-ruby@z] flog version 3.2.2 has been released!

[ANN] minitest 4.5.0 Released
403393 [ryand-ruby@z] minitest version 4.5.0 has been released!

error /script/server
403400 [lists@ru y- ] one open source application i deploying in linux shared hosting. while i
+ 403403 [lists@ru y- ] Are you going to give us the error message?
+ 403404 [lists@ru y- ] no sir i mean that that is the error message while installing...

Can't connect to securied host by ssl certificate
403405 [lists@ru y- ] I must connect with some server which need SSL certificates, but I am
403417 [lists@ru y- ] I am also having the same issues with 'mechanize' ruby-gem. But I tried

order of parameters and arguments
403409 [lists@ru y- ] Can someone pls explain why in the following example that *c is left
+ 403410 [ryand-ruby@z] def f(a, b=1, *c); end
+ 403415 [shortcutter@] There is pattern matching going on.  (This was introduced in Ruby

Resources for ActiveRecords
403412 [lists@ru y- ] I am new to ruby and wanted to learn more in-depth about active records
403413 [fluido@fl id] Active records are part of Rails. This list is dedicated to the
403414 [lists@ru y- ] Thanks Carlo,

Devkit not recognised
403419 [jrs.idx@nt w] ...
403518 [lists@ru y- ] You need to compile your Ruby code before you attempt to utilize it for

Crontabbing a Ruby script inside a screen
403420 [its.code.in.] this live stream 24/7. But it tends to core dump every once in a while, and
403425 [shortcutter@] I am not 100% sure what you want to achieve.  But it seems to me that
403426 [its.code.in.] My God, Robert, this is brilliant :D

Reading and looping through Excel
403423 [lists@ru y- ] I have a question regarding reading excel files and looping through the
+ 403424 [lists@ru y- ] You can use Ruby1.9.3 standard library for that - "win32ole" and "CSV" .
+ 403429 [lists@ru y- ] Here's something to get you started, connecting to excel... after that
| + 403432 [lists@ru y- ] what the command 'unless excel.visible' does? And why 'wb. close(0)'
| | 403436 [lists@ru y- ] excel = WIN32OLE.connect('excel.application')
| + 403440 [wbrisett@at ] I see some value in something like this for a couple of my scripts. However,
+ 403442 [lists@ru y- ] Does this look like what you need (bottom of the page)?
| 403443 [wbrisett@at ] Thanks. That may work. I'll just have to query for the OS and have one routine
| 403454 [thedixie@gm ] I've done something similar using the spreadsheet gem, it's easy to open a workbook and iterate over the rows extracting what you want
| 403469 [neotamizhan@] +1 on the spreadsheet gem. It makes excel file reading such a trivial task.
| 403765 [wbrisett@at ] ...
+ 403483 [lists@ru y- ] Thank you for all suggestions! and sorry for late reply!
| 403485 [lists@ru y- ] wbs.cells(rows,2).value = 'DONE'
+ 403507 [lists@ru y- ] try replacing
+ 403766 [lists@ru y- ] support for newer formats is the reason I moved to win32ole.
  403767 [wbrisett@at ] Thanks Joel!

[ANN] Ruby-GNOME2 1.2.0
403428 [kou@co mi ng] The Ruby-GNOME2 project released Ruby-GNOME2 1.2.0.

How to refresh a page on browser using selenium-webdriver.
403434 [lists@ru y- ] driver.get "https://example.com/"
+ 403437 [lists@ru y- ] driver.get driver.url
| 403439 [lists@ru y- ] Yes,But the username will never come,unless the intermediate page not
+ 403441 [lists@ru y- ] driver.url is the current url, so it effectively refreshes the page.

Processes and forks
403444 [lists@ru y- ] elegant solution for.
+ 403451 [fluido@fl id] Sorry for the delay!
| 403461 [shortcutter@] I don't think there is a signal at all because system just blocks
+ 403452 [lists@ru y- ] many thanks for the detailed reply, much appreciated as you have given
  403453 [fluido@fl id] Glad to have been of help!

How to DRY this up?
403445 [tamouse.list] I have some API calls I'm making, all with the following sort of
+ 403446 [jgabrielygal] def call_with_retries obj, method, *args, retries=2
| 403450 [shortcutter@] })
| 403466 [tamouse.list] Thanks, robert -- I very much like your version.
| 403470 [tamouse.list] And that's how I ended up writing it. The more I look at this, the
+ 403448 [uzleepito@gm] You can create a class that represents the api connection and use