341701-399890 subjects 342066-342620

^ Job less? Start Minting Money!
341869 [naresh4ads g] Searching for a job?

^ Re: remembered_evals 0.0.4 -- debugging help for eval
341873 [rogerpack200] Yeah it turned out to be deftly useful at least once for me.

^ Issues with inheritance
341881 [justondavies] I'm building a large system that needs to have a data structure of
+ 341882 [jcoglan goog] In Ruby, you just call super() to call the parent method. There are three
| 341884 [justondavies] You nailed it. I tip my hat to you. I also figured out why child2
+ 341883 [sepp2k googl] You want super("Batman") here.

^ contest
341895 [cristina.dra] Can you help me win a trip? Please hit the button =93Voteaza=94, meaning

^ getting char from string as fixnum in 1.8 and 1.9
341898 [vjoel path.b] What's the best way to write this program so that it will run correctly
+ 341900 [dblack rubyp] I'm sure someone will have something more elegant but I'll get the
| 341902 [vjoel path.b] s[2,1].unpack("C").first
| 341905 [vjoel path.b] require 'benchmark'
+ 341910 [glennj ncf.c] ...
| 341915 [brabuhr gmai] ly
| 341919 [vjoel path.b] That seems like a pretty good approach, actually, and it happens to be
| + 341921 [vjoel path.b] The reason I wanted to avoid adding anything to String was that I
| + 341926 [dblack rubyp] There's always a bit of fragility, since someone else might have added
+ 341942 [list.push gm] This may not be pretty, but you do not need to add anything.

^ including newlines in a .sub
341906 [amunn msu.ed] ...
+ 341907 [sepp2k googl] In ruby "\n" is a newline, while '\n' is backslash followed by an n.
| 341911 [amunn msu.ed] ...
| 341913 [sepp2k googl] Well you could also use double quotes exclusively and use \\1, \\2 etc. to
+ 341922 [fxn hashref.] Just in case... "\n" is a newline in any operating system.
  341930 [bbxx789_05ss] You don't know what you are talking about.
  341931 [fxn hashref.] Huh?
  341934 [ryand-ruby z] Ignore him. He's a dick.
  342172 [jackycheung.] 2009/7/21 Ryan Davis <ryand-ruby@zenspider.com>
  342183 [fxn hashref.] Don't know what you mean.
  342393 [jackycheung.] r u a programmer ? don't know '\n' is what mean???
  342435 [lists askree] You're a programmer and you can't type well???  Please don't be rude.

^ Dir.entries showing . and .. , how come?
341912 [mmc_collins ] Why is it that there are '.' and '..' in my output? I want to create a
341914 [ninja slapha] Those are hidden directories on Unix, pointing to the current and parent
+ 341916 [mmc_collins ] Thanks David, I try them out now! -Misty
+ 341917 [imphasing gm] Dir.entries(dir).reject{|entry| entry =3D~ /^\.{1,2}$/}
  341933 [bbxx789_05ss] dirname = "whatever"
  + 341935 [Rob AgileCon] Dir.glob("*")                       #=> ["config.h", "main.rb"]
  + 342328 [mmc_collins ] this returned  1 nil since first file in the directory was not the file
    342331 [mmc_collins ] disregard this, replied to wrong post - sorry :-)

^ [RCR] Thread.abort_on_exception default to true
341924 [rogerpack200] currently if you have a thread that "dies" without being cleaned up
341925 [matz ruby-la] What do you mean by "clean up" here?  If you care about the thread
341929 [vjoel path.b] If you don't know when a thread will finish, it's hard to know when to
341936 [justincollin] There is ThreadsWait#all_waits which can execute a block as each thread
341943 [vjoel path.b] Yep, that's what I was looking for. Thanks!

^ Re: Thread.abort_on_exception default to true
341927 [rogerpack200] I agree that using #join here would result in cleanup that would allow
+ 341938 [matz ruby-la] I think you'd better handle the exception in the thread block.
| 341997 [rogerpack200] Hmm. True (I've even thought before that Thread#raise should be
| 342004 [matz ruby-la] Something to stderr is only useful in debugging, but no good for
| 342014 [rogerpack200] Sounds good.  I suppose the -d option is underused by most people
+ 341980 [b.candler po] You don't care if or when it finishes, but you also don't mind if it

^ Ruby oriented JavaCC-like parser generator?
341939 [eric sempere] ...
+ 341952 [gustav rails] Hey Eric,
| 341962 [no spam.plea] Unless things have changed radically, ANTLR's Ruby support
+ 341959 [yugui yugui.] Racc (http://i.loveruby.net/en/projects/racc/) is similar to Yacc.
+ 342029 [ryand-ruby z] most of us use racc (for better or worse)... aaron and I are

^ XML output (urgent)
341940 [longmai2402 ] => {"type"=>"abc", "numbers"=>{"number"=>[333], "src"=>"glasses"}}
+ 341949 [   me ell.io] I???m not familiar with `XmlSimple`, but may I suggest Nokogiri?
+ 341967 [mark thomasz] =3D> 'glasses'}}

^ safe move/copy with incrementing filenames?
341941 [paul paularc] So, I'm working on some DAM (digital asset management) scripts, and I want
342027 [xenogenesis ] def unique(filename)
+ 342049 [paul paularc] ...
+ 342219 [paul paularc] ...

^ unsubscribe
341947 [vikas.deep y] ...
342073 [synfinatic g] et Explorer 8. http://downloads.yahoo.com/in/internetexplorer/

^ Bytestream parsing in Ruby
341950 [   me ell.io] So, I???ve a problem. I???m using ncurses (or possibly not, might just
341979 [b.candler po] => [195, 188, 98, 101, 114]
342062 [   me ell.io] Hrm, #valid_encoding? is very helpful. But how can I stuff numerical
+ 342088 [bbxx789_05ss] hex_str = "\\x%x" % 195
| 342095 [   me ell.io] That is not exactly ideal. Is there a cleaner way.
+ 342143 [b.candler po] If you're doing STDIN.read(1), you get a String. Just use << to
  342144 [b.candler po] Incidentally, I needed to do something similar in ruby-1.8 recently, and
  342260 [b.candler po] That's the whole point. The OP wanted to append bytes to a string, and
  342342 [b.candler po] I've briefly read sections 8 to 11 again.

^ create a variable number of loop
341953 [chen_li3 yah] if the input is 1, I will create a loop ( I call it 1-loop);
+ 341954 [vikassarin q] Would recursive methods be allowed in Ruby?
+ 341955 [jcoglan goog] 2009/7/21 Li Chen <chen_li3@yahoo.com>
+ 341958 [jcoglan goog] 2009/7/21 Li Chen <chen_li3@yahoo.com>
  342012 [chen_li3 yah] Thank you very much for the codes. It solves part of my problem. I try
  342156 [zyzygy telst] irb(main):001:0> "DDDD".tr("DCBA","3210").to_i(4)
  342184 [chen_li3 yah] Steve,

^ Inheritance problem with dynamic methods
341961 [stefano.grio] I'm tying to create a method which would allow me to get and set
341965 [dblack rubyp] One metaprogramming trick you could use is attr_accessor :-) Another
341966 [stefano.grio] Your solution is brilliant :D

^ Mean method
341968 [jdezenzio gm] I'm working on a lot of math in my projects so I thought I would convert
+ 341972 [dblack rubyp] ...
+ 341973 [cremes.devli] The pastie is missing your extension of Array to add the #sum method, =20=
+ 341976 [b.candler po] Are you posting here because you want comments/suggestions? If so,
| 341977 [jdezenzio gm] thanks everyone - looking over the suggestions and rewriting it to be
| 342000 [jdezenzio gm] Okay round 2,..
| 342002 [b.candler po] #<Mean:0xb7bc6904 @arr=[1, 2, 3, 4, 5]>
| + 342006 [jdezenzio gm] Sorry, Brian check again.
| + 342007 [b.candler po] Here's an approach which avoids to_a and size entirely, and iterates
|   342009 [jdezenzio gm] I adjusted the code a bit to handle the size factor with @size in
|   + 342019 [jdezenzio gm] Okay on Standard Deviation..
|   | 342021 [b.candler po] foo.inject { |a,b| ... }
|   | 342031 [dblack rubyp] ...
|   + 342024 [cremes.devli] I've written some code to compute skew and kurtosis (the 3rd and 4th =20
|   + 342087 [usenet in.tu] Unfortunately this produces wrong results when the array changes in
+ 342028 [glennj ncf.c] You might enjoy perusing code examples at
  342039 [jdezenzio gm] This is the new Standard Deviation class I created.  It's very
  342040 [jdezenzio gm] a = [1,2,3,4,5]
  342042 [jdezenzio gm] class Stddev

^ Ruby/Oracle connectivity
341969 [checktesting] I have tried my level best to connect to oracle using ruby but all in
+ 341970 [charles.john] Are you running ruby on linux, windows, aix, freebsd, what version of
+ 341971 [b.candler po] 1. Show us what you have tried (exact copy-paste of irb sessions or code
| 341975 [checktesting] First of all, thanks a lot for replying so quickly.
| 341981 [usenet2009 z] ...
| 341982 [b.candler po] But he also said he was running ruby 1.8.6, which is not JRuby. And he
| + 341984 [checktesting] If i run this code to check whether i am able to connect to the Oracle
| | + 341988 [usenet2009 z] ...
| | + 341995 [b.candler po] This is probably worth raising on the ruby-oci8 list, where I suggest
| + 341987 [usenet2009 z] ...
|   341992 [usenet2009 z] ...
|   342127 [checktesting] When i run the above code i.e.
|   + 342141 [b.candler po] If nobody can answer here, try taking this to the ruby-oci8 forum.
|   + 342142 [usenet2009 z] ...
|   + 342160 [kubo jiubao.] The following URL may help you.
|     342556 [checktesting] I tried it also, but no gain :(,
|     + 342558 [kubo jiubao.] 78
|     + 342567 [usenet2009 z] ...
+ 341974 [charles.john] You can also try reading this: http://is.gd/1GoIG

^ Another TCPSocket Question
341978 [gregory.w.ch] Sorry to bother you guys about this again.  So my main problem right now
341983 [gwtmp01 mac.] I suspect that you are thinking about this problem
341989 [gregory.w.ch] Okay, not too bad.  Wait, if I send the fixnum ahead of time, is the
+ 341993 [gwtmp01 mac.] Look at Array#pack and String#unpack if you want to send binary
| 342165 [b.candler po] Such as: http://en.wikipedia.org/wiki/Netstrings
+ 341994 [eleanor game] Post us some code so that we can see what you're doing and make
  342033 [gregory.w.ch] script was kind of made last second just to test this out.
  342037 [vjoel path.b] size_struct.message_length = data_struct.length
  + 342041 [gregory.w.ch] In the words of Homer Simpson, "D'Oh!"  Thanks for all your help guys!
  + 342044 [vjoel path.b] (doesn't even depend on BitStruct, and includes a C version and tests!)

^ OCIError: OCI Library Initialization Error
341985 [checktesting] If i run this code to check whether i am able to connect to the Oracle
342133 [checktesting] Ruby 1.8.6

^ please help me with your vote
341986 [loredana.gab] please help me with your vote here http://www.infoturism.ro/acorda-puncte/82406/

^ Parsing XML in Ruby
341990 [adamlor o2.p] I'm new in this forum, so i'm be very gratefull, you won't be angry if I
+ 342001 [elitecoding ] Check out hpricot: http://wiki.github.com/why/hpricot
| 342005 [adamlor o2.p] thank you very much Milan, I found this web, but I'm still be very
+ 342010 [lists bertra] REXML belongs to the Ruby standard library.
  + 342093 [elitecoding ] Regards,
  + 342149 [adamlor o2.p] ok thanks very much, I decided to use REXML, but i have problem with
    + 342158 [lists bertra] Did you try "xmldoc.root.elements.each( ..."?
    | 342161 [adamlor o2.p] I try Your proposition, but it also doesn't work, because SciTe only
    | 342175 [lists bertra] Could you provide the movies.xml file in any way?
    + 342171 [brabuhr gmai] irb(main):001:0> require 'rexml/document'
      342176 [adamlor o2.p] thank you very much, first way is correct, and I'll  use it. but I have
      342177 [adamlor o2.p] I forgot add, It is right way?

^ *%w[..lib]
341991 [wdjingga gma] $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
+ 342003 [rmagick gmai] %w[.. lib] creates an array of words. The result is ["..", "lib"]. The
| 342026 [kbloom gmail] Which just comes to show you can write perl in any language.
+ 342008 [lists bertra] An array expands to an argument list.

^ Best practice question: logging
341996 [rps salas.co] I want to sprinkle my code (Ruby, not Rails) liberally with logging
+ 341999 [pjb informat] Ok, directly in the category "other tips", if you want to see
| 342022 [rogerpack200] Checkout ruby -rtracer, too.
+ 342023 [cremes.devli] I asked this same question about a year ago and got lots of help. Here
+ 342025 [vjoel path.b] log.debug { "a message about #{topics.join.inspect}" }
+ 342993 [ shot hot.pl] ...

^ String spliting and inclusion
342013 [stuart.clark] I am having trouble working out some logic for my problem. I basically
+ 342018 [robert.dober] s =3D "a bad day in the office today, " * 3
+ 342035 [bbxx789_05ss] '{' would define cardinality
| 342038 [bbxx789_05ss] ["Hello world.  Hello moon.\nGoodbye world. Goodbye ", "moon.\n\nHello
+ 342090 [list.push gm] str = "I did not test this completely so you may need to make some
+ 342096 [dblack rubyp] Try this. I don't guarantee robustness.
  + 342125 [bbxx789_05ss] Oh my.
  | 342167 [dblack rubyp] It's got some problems; see the message I just posted about word
  + 342145 [robert.dober] Hmm my \b at the end of my solution might have been a problem in some
    + 342151 [robert.dober] ly
    | + 342153 [robert.dober] s.split( /(.{,10}\S)\s/ ).reject( &:empty? )
    | | 342155 [robert.dober] good enough? Certainly not :(
    | + 342265 [list.push gm] p str.scan(/\s*(.{1,50})(?!\S)/)
    + 342166 [dblack rubyp] The idea was to start every scan at a \b. It's definitely not an
    + 342168 [bbxx789_05ss] Yes. Please explain that.  Also please explain why you don't have
      342169 [dblack rubyp] I won't claim anything. Feel free to experiment with the code, which
      342173 [robert.dober] Indeed this is very tricky, I had some doubts about your leading \b

^ HTTPClient::SSLConfig uses "puts" ??
342015 [ibc aliax.ne] I've realized that HTTPClient includes a class SSLConfig which prints
342016 [ibc aliax.ne] /usr/local/lib/ruby1.9/gems/1.9.1/gems/httpclient-$ grep -r puts*

^ Bug in HTTPClient (shouldn't look for body in 304 response)
342020 [ibc aliax.ne] Content-Length.
342104 [drbrain segm] Did you file a bug?
342152 [ibc aliax.ne] Unfortunately I get no response for this report.
342157 [ryand-ruby z] One thing I can suggest is more code/patch, less English. Sometimes =20

342030 [livni.itay g] 1.  Download ftp file.

^ Problems reading a text file with unusual encoding
342032 [randygeneral] I have a pcap file that I simply changed the file extension to text on.
342092 [phasis gmail] I guess your OS is Windows.

^ [ANN] Sunspot 0.9 released
342034 [mat patch.co] Sunspot version 0.9 has been released!

^ Simple problem with Regular Expression
342046 [maxnorman co] This simple application is an extension of an exercise from Peter
+ 342047 [ibc aliax.ne] fruit[0] => returns the first char of fruit.
+ 342051 [ibc aliax.ne] fruit = gets.chomp.downcase
  + 342053 [maxnorman co] Thanks for this. I've just come across a few of these concepts, like
  | 342054 [ibc aliax.ne] ["a", "e", "i", "o", "u"]
  + 342055 [maxnorman co] Unfortunately I'm not using 1.9, but I would appreciate any explanation
  | 342060 [ibc aliax.ne] 'fruit' is not an array, but a string.
  | 342064 [maxnorman co] This works perfectly.
  + 342059 [vikkous gmai] FRUIT2COLOR=3D{
  + 342068 [dblack rubyp] ...

^ [ANN] ri_cal 0.7.4 Released
342048 [rick.denatal] ri_cal version 0.7.4 has been released!

^ define_method in inheritance
342052 [justondavies] I had a quick question about something I had read in a book "The Ruby
342056 [dblack rubyp] It will define the method in self.class, which will be the class of
342063 [justondavies] Awesome, thats what I wanted to hear. Thanks for the help!

^ [ADV] Black/Kastner Ruby training: for non-beginners?
342057 [dblack rubyp] If you're thinking about taking our Ruby training (me and Erik

^ Default parameter values for methods in Ruby 1.9
342058 [ibc aliax.ne] def get_element(auid, document=nil, selector, check_etag=true)
+ 342061 [vjoel path.b] What do you expect
| 342065 [ibc aliax.ne] auid = 1
+ 342070 [jl235 kent.a] You couldn't you rearrange it to?
| 342076 [ibc aliax.ne] Yes, I could, but I prefer to keep the order.
+ 342163 [b.candler po] def get_element(auid, *rest)