318371-324212 subjects 318762-319982

^ alphanumeric data clean up
318565 [clsnyder gma] Case ID,DATE,SERIAL,NAME,Gender,Code1,Code2
+ 318568 [cdemyanovich] FasterCSV [ http://fastercsv.rubyforge.org/ ] should help you tokenize data
+ 318569 [james graypr] $ cat in.csv
+ 318587 [w_a_x_man ya] DATA.each_line{|line|
  318755 [clsnyder gma] Those work perfectly

^ Open a MS Excel file from within Ruby
318570 [RichardDummy] I'm writing a small Ruby pgm to demonstrate that FasterCVS is a good
+ 318572 [AEtzold gmx.] Dear Richard,
| 318876 [james.herdma] QmFyZiEgIEF2b2lkIE9MRSBsaWtlIHRoZSBwbGFndWUuICBXaGVuIHlvdSdyZSBoYW5kbGluZyBs
+ 318711 [chris.hulan ] On Oct 25, 1:20=A0pm, RichardOnRails
  318858 [RichardDummy] Thanks for your responses.  I had some success,  but was unable to get
  318859 [botp delmont] ...=20

^ CSV to XML
318573 [scappa gmail] Great forum, been a reader for a long time. My first post comes as a
318575 [james graypr] $ cat for_xml.csv

^ regular expressions and conditionals
318576 [iwasinnamukn] I'm writting a little program to convert some source files to html.
+ 318583 [vikkous gmai] f = File.new("myfile", "r")
| 318600 [shortcutter ] Even better is
+ 318596 [b.candler po] while line = f.gets

^ question about method call
318577 [chen_li3 yah] I copy a working script from the website. I wonder if method "create"
318667 [shortcutter ] And, what did your tests show?
318672 [chen_li3 yah] It is working. But I am confused: why does app, an instance of
318690 [shortcutter ] Read your code again.
318706 [chen_li3 yah] Reading from the codes  it looks  app receive a message from
318710 [shortcutter ] You are right: I am the one who needs more coffee or sleep. :-}  I do
318956 [chen_li3 yah] I post my question at fxruby-users@rubyforge.org. Based on the feedback

^ Extracting information from "john-2222-8888@domain.com"
318578 [small.busine] I'm wondering how you'd extract information from an email address like
+ 318579 [matt moss.na] @player_id, @game_id = email.match(/.+-(\d+)-(\d
| 318581 [small.busine] That works perfectly. Thank you, Matthew!!
+ 318585 [w_a_x_man ya] player,game = "john-2222-8888@domain.com".split(/[-@]/)[1,2]

^ Hash Lookup Problem
318580 [pedrazzi gma] I am writing a blackjack simulator.  I have classes like Dealer,
318588 [transfire gm] =3D>

^ How to invoke Windows program with a Ruby command
318592 [RichardDummy] \Micros~3\Micros~2.lnk
+ 318599 [mo_mail ongh] Took me a while to get this working.
+ 318748 [dejan.dimic ] On Oct 26, 5:23=A0am, RichardOnRails
+ 318775 [rogerpack200] Might be able to use system("start filename_here")

^ Mac OS X Leopard - Ruby is 3X faster with disable-pthreads
318594 [tennisbum200] I have a fast mac pro computer.
318633 [ezmobius gma] As long as you aren't using tk at all then you have no issue to watch
318635 [znmeb cesmai] You can also recompile "tcl" and "tk" with "pthreads" disabled. I =20

^ Hash.merge_add! extension - how does this code look?
318601 [greg.hauptma] I wanted a way to be able to "add" values to a Hash such that it keeps the
+ 318603 [dblack rubyp] That's not a good name for it, because there's no non-bang merge_add
+ 318605 [transfire gm] On Oct 26, 7:20=A0am, "Greg Hauptmann" <greg.hauptmann.r...@gmail.com>
+ 318632 [apeiros gmx.] Reading your problem and code I think you missed that Hash#merge
  + 318637 [transfire gm] Nice. I didn't know it could take a block either. Has that been there
  + 318644 [greg.hauptma] thanks for highlighting this!  Is the quickest way to normalise to Array via
    318655 [apeiros gmx.] If you're building up the hash yourself then I'd use the following
    318656 [greg.hauptma] I just noticed the code suggested might have a problem when the
    318756 [greg.hauptma] thanks all for feedback to date - here's my latest take
    318761 [transfire gm] On Oct 27, 8:42=A0pm, "Greg Hauptmann" <greg.hauptmann.r...@gmail.com>
    318770 [greg.hauptma] interesting - is it really Ruby approach to let things 'break' during
    + 318777 [b.candler po] Generally speaking, yes it is.
    | + 318787 [transfire gm] Nice explanation.
    | | 318788 [b.candler po] That's the standard Hash#invert, and as you demonstrate, it loses
    | + 318790 [dblack rubyp] class Hash
    | + 318792 [b.candler po] self[k] = Array(self[k]) + Array(v)
    |   318922 [greg.hauptma] thanks for the great feedback guys - will take all this on board
    + 318789 [dblack rubyp] Not really. The first message actually gives you more information

^ QtRuby: system tray
318602 [la.bizzz gma] I need an ability to hide my Qt-based app in tray and unhide it back :)
318617 [kbloom gmail] It's all about the QSystemTrayIcon class. Use the #hide and #show methods
318623 [la.bizzz gma] t = Qt::SystemTrayIcon.new
318624 [stefano.croc] t.setIcon(Qt::Icon.new('icon.png'))
318625 [la.bizzz gma] Thank you, Stefano!

^ Init attributes and set value
318610 [phoenix olec] Hey all,
318612 [shortcutter ] I'd use nil as the marker for uninitialized.  This happens to be the
318613 [phoenix olec] Hey,
318614 [mguterl gmai] I'm sure Robert helped answer your question and I know this isn't the

^ Problems with Pcacp Library
318618 [protos.nu gm] I want to work with the pcap library, and I installed libpcap and pcap
318714 [driodeiros g] Do you have any interface available that the library can use to sniff from?

^ Two Variables to One Definition?
318620 [nonstickglue] Is it possible to send two different variables to one definition and
+ 318621 [nonstickglue] Sorry, I just figured it out.
| 318626 [shortcutter ] If you do the same test against the same collection it is cleaner to
+ 318631 [apeiros gmx.] Since you already got the solution to your original question I'll show

^ [SUMMARY] Long Division (#180)
318627 [matt moss.na] Apologies for the delay with this quiz's summary. Here ya go.

^ Iconv problem - not handling \r correctly
318634 [rainyglade c] I have an XML file that I need to process.  I'm working in the Windows
318646 [phasis gmail] MjAwOC8xMC8yNyBMb3Vpc2UgUmFpbnMgPHJhaW55Z2xhZGVAY29tY2FzdC5uZXQ+Ogo+IEkgaGF2
318663 [rainyglade c] file = File.new("sta_utf16.xml", "wb")

^ XDG v0.4.0 released
318636 [admin tigero] = XDG 0.4 hits the streets!

^ Named arguments gem
318643 [macarui gmai] require 'named_arguments'
+ 318723 [djberg96 gma] undefined method `named_args_for' for Example:Class (NoMethodError)
| 318752 [macarui gmai] When you require the gem it adds the method #named_args_for to any
| + 318763 [macarui gmai] 0.5.1
| + 318764 [djberg96 gma] Yes, of course.
|   318766 [macarui gmai] I don't know why it doesn't work. Do the specs fail?
|   318768 [macarui gmai] Right I think I know whats wrong.
|   318880 [djberg96 gma] m/maca/namedarguments/tree/master/
|   318895 [macarui gmai] Yeah, I think I will change the gem name to avoid confusion, about the
|   318900 [djberg96 gma] .com/maca/namedarguments/tree/master/
|   318904 [macarui gmai] I don't think that notation is actually posible, I guess that is not
+ 318802 [rogerpack200] How fascinating that your and my project would arrive at almost the same
  318814 [macarui gmai] Yeah, both solutions look similar. I had a very specific need where I

^ ncurses-ruby bugs
318645 [sentinel.200] Sorry for posting here. I mailed the email in the code 3 weeks back but

^ connection error in webrick server
318649 [xeddr yahoo.] I did a simple server in ruby using webrick as shown in the
318650 [shortcutter ] What error message did you see?  Are there firewalls in between?  Did
318653 [xeddr yahoo.] This was the error message..
318658 [shortcutter ] Hm...  Is the hosting system a Windows non server version?  That could
318746 [xeddr yahoo.] I tested it both on a Windows non-server and server versions but the
318772 [shortcutter ] Did you check connection state with netstat?  It may be that socket

^ changing the gems version for ruby1.9 (in Ubuntu)
318652 [evan.burchar] I need a newer version of gems visible to my ruby1.9 installation.

^ Access module's anonymous parent
318657 [contact rhnh] I want the following eval to output "Foo called", without having a named
318660 [b.candler po] Is this what you're looking for?
318742 [contact rhnh] I would have liked to keep the more familiar class syntax without
318773 [pit.capitain] Xavier, I don't know why you want to have an anonymous module with a
318774 [contact rhnh] Hot loading of code. I'm being a bit anal about it, also I'm just

^ save object reference in db?
318664 [jamal soueid] I want to ask if it's possible to save object reference in database for
318668 [shortcutter ] No, not directly.  How should that work?
318676 [b.candler po] Well, technically it *is* possible to save object references - see
318691 [shortcutter ] Hey, normally *I* am supposed to be the nitpick!  What's the point in

^ undefined method 'uid' for nil::NilClass when running gem
318674 [swearingendw] Just updated to gem 1.3.0 on XP.
318693 [l.peduto gma] ...

^ Days in a year
318675 [pal palbergs] How do I get number of days in a year?
+ 318678 [b.candler po] Enter "number of days in a year" into Google and you'll get some useful
+ 318679 [hjrocha gmai] int __isleap <javascript:searchRef('__isleap')>(int
+ 318680 [caduceass gm] You can use the date library...
  318704 [pal palbergs] So there's nothing like this (Rails)
  + 318705 [mguterl gmai] T24gTW9uLCBPY3QgMjcsIDIwMDggYXQgMToyMCBQTSwgUMOlbCBCZXJnc3Ryw7ZtIDxwYWxAcGFs
  + 318781 [pal palbergs] A stupid question in the first place. I've done like this; I check if
    318782 [b.candler po] def days_in_month(month, year = now.year)
    + 318793 [janfri.rubyf] require 'date'
    + 318794 [janfri.rubyf] require 'date'
      318803 [pal palbergs] That was smart. Thanks!

^ Pro/Cons of Load System
318677 [transfire gm] When a path is added to the $LOAD_PATH, all paths within it become

^ [Q] how to detect if #super exists?
318681 [cremes.devli] I'm writing some modules that I use to replace/extend the
318688 [pit.capitain] defined? super
318695 [shortcutter ] I believe OP rather wanted to test for existence of the same method in
318697 [ara.t.howard] precisely what 'defined?(super)' does....
318712 [shortcutter ] Amazing!  Learn something new every day.  Thanks, Ara, much appreciated.
318751 [pit.capitain] No problem, Robert. I think I learned this here on ruby-talk, too. And

^ format an integer
318682 [emanuelef ti] this is a pretty silly question but I cannot figure it how to do.
318683 [matt moss.na] "%02d" % num
318684 [emanuelef ti] Thanks

^ Re: how to detect if #super exists?
318685 [b.candler po] Hmm, how are you testing instance methods of a module without actually
318716 [cremes.devli] My specs have an anonymous class that I create in the #before block.
318738 [b.candler po] Ah, so perhaps you could 'stub' these methods as

^ Quick Scope Question
318686 [dbw aber.ac.] Q_txt =3D res_q[0][1]
318699 [dblack rubyp] Blocks have a kind of one-way valve local scope. Variables that
+ 318717 [higgs.bozo g] This is one reason I prefer {...} instead of do...end for blocks, since
+ 318796 [shortcutter ] Not what you asked for, but: "Q_txt" != "q_txt".  Also, you should do
  + 318798 [dbw aber.ac.] Thanks Robert,=20
  + 318838 [vjoel path.b] That rules out javascript as modern. Grrr.

^ How to update gem to a version that's not the latest ?
318687 [swearingendw] I posted an earlier question but am amending it with this question
318744 [radek.bulat ] RG93bmxvYWQgaXQgbWFudWFsbHkgYW5kIGluc3RhbGwgZnJvbSBsb2NhbCBmaWxlLgoKLS0gClJh
318747 [swearingendw] Thanks for the response, but the question of "how" was really the heart

^ Hpricot not returning the right html??
318689 [monstars99 g] it shows a table with basketball info at page 1
319248 [monstars99 g] hmmm noone replied... well in case someone hase the same problem.. i

^ "yield" in a virgin CRUD produces no logged info - why?
318694 [RichardDummy] I'm running Rails 2.0.2 over Ruby 1.8.6 on WinXP-Pro/SP3.
318783 [b.candler po] You'd be more likely to get a useful answer from a Rails mailing list -

^ Re: undefined method 'uid' for nil::NilClass when running ge
318696 [swearingendw] Thanks!

^ uninitialized constant UsersController::User
318698 [cbustamante ] I am new to ruby. I got the following error when creating a registation
318769 [james.britt ] You might do better asking Rails questions on the Rails mailing list.

^ float equality
318700 [guilledist g] sorry if this is a very naive question (I'm new to ruby), but I
+ 318701 [caduceass gm] There are several ways around it (using BigDecimal, Rational, Integers, etc.)
| + 318709 [matt moss.na] Ummm... because 1/9 + 8/9 == (1 + 8)/9 == 9/9 == 1 ?
| | + 318719 [guilledist g] Thanks a lot for the answers and references, and sorry for not having
| | | 318725 [AEtzold gmx.] Dear guille,
| | + 318722 [higgs.bozo g] While your answer is correct, you cannot subtract infinities as shown
| |   318732 [matt moss.na] But 0.999... does converge, while 1 - 1 + 1 - 1 +... does not.
| |   318734 [matt moss.na] On re-reading, I see that you weren't so much questioning whether
| + 318724 [tim.pease gm] I figured it out once, but I can't remember precisely how it worked.
|   318727 [ABilyk maxis] Mathematically 1.(0) is the same thing as 0.(9). Computers simply represent=
|   318729 [tim.pease gm] Hmmm ... my humor is a little to obtuse today. I was hoping the word
+ 318702 [higgs.bozo g] Nope.  Floating-point is always inexact.  This is a computer thing, not
| 318765 [jwkenne attg] What you mean is that binary floating point inexactly represents decimal
+ 318703 [sepp2k googl] No. The result of 1 - 0.9 using floating point math is not actually 0.1. In

^ problem catching nested exception
318707 [usenet a13.f] reading them from a database. For each domain, the script opens a TCP
+ 318740 [b.candler po] It's possible the exception is being raised where you do not expect it,
| 318779 [usenet a13.f] You are right, exception was raised by smtp.finish, and I really did
+ 339563 [suntsh gmail] please send a copy this script,thanks

^ A backwards N+1 problem
318708 [thedickster ] Hey, im running into an N+1 problem, but i don't exactly know how to
318743 [contact rhnh] Try asking on the Ruby on Rails list: http://www.ruby-forum.com/forum/3

^ why hash not being passed into method?
318713 [margrymouse-] A rails plugin I'm trying to use has the following pattern of failing
318745 [contact rhnh] Nothing obvious jumps out, please provide more source code (some code we

^ How to find directory of currently running .rb file
318715 [kenneth.m.mc] __FILE__ is just giving me the file name, with no path, and Dir.getwd
+ 318718 [fophillips f] =20
+ 318737 [b.candler po] File.dirname(__FILE__)

^ String Comparison Problems
318720 [mdrisser gma] I'm having a baffling problem with string comparisons in Ruby.
+ 318731 [andringa qui] Looks like the whitespace characters don't match... maybe try replacing
+ 318758 [hgs dmu.ac.u] # Or your could use readlines instead, which would give you the array

^ automatic code conversion from Ruby to C ?
318721 [AEtzold gmx.] Dear all,
+ 318730 [flo andersgr] Why don't you just use Bison/Flex for that task?
+ 318735 [b.candler po] It sounds like you think that you can use Ruby as a shorthand way of
+ 318739 [shortcutter ] Hm, automatic conversion tends to produce not so readable code.
| 318776 [shortcutter ] OTOH, maybe Ruby is just not the right tool for the job. IMHO there is
| 318835 [AEtzold gmx.] Dear Florian, Brian, Robert and Mohit,
| + 318846 [shortcutter ] need to push Ruby into this IMHO.
| + 318854 [mo_mail ongh] I find that sometimes customers don't appreciate a new tool/ device -
| | 318863 [shortcutter ] Given the size of the problem (i.e. small) and the fact that existing
| | 318864 [mo_mail ongh] Point taken! :)
| + 318866 [b.candler po] /*
|   318903 [AEtzold gmx.] Dear Brian,
|   + 318934 [b.candler po] That's one thing that makes Ruby fundamentally different from C/C++. It
|   + 318937 [hgs dmu.ac.u] This message is in MIME format.  The first part should be readable text,
+ 318767 [mo_mail ongh] My recommendation would be to 'prototype' in Ruby to establish the
+ 319003 [eric.mahurin] Have you tried Ruby2Cextension?  It converts ruby to C code (ruby

^ file manipulation
318728 [nairvan gmai] I have one more question with file manipulation.
+ 318733 [peter rubyra] data[/Instance J3(.+?)^\)/m, 1]
+ 318736 [b.candler po] Using (Unix shell command) grep, or using Ruby?
+ 318741 [kbloom gmail] If your file was in XML, you could use REXML::Parsers::SAX2Parser (or

^ pass def to eval
318749 [adamhurlburt] My plan is to have a ruby class with a variety of functions in it and I
+ 318754 [adamhurlburt] This is embarrassing but everything was working correctly and nothing
+ 318757 [ryand-ruby z] test.rb?action=system("rm -rf /")
  318759 [adamhurlburt] Oh thank you Ill try that.

^ [ANN] UnicodeUtils 0.1.0 - more Unicode for Ruby 1.9
318750 [perfectly.no] UnicodeUtils is a new, pure Ruby library that provides additional