264887-336803

264637-374548 subjects 265100-268253

reading byte stream from network
264887 [akifusenet@g] I hope this is an OK place to ask a beginner question. Right now I am
+ 264888 [apeiros@gm .] Take a look at unpack (ri String#unpack)
| 264895 [akifusenet@g] Thank you. Just what am I looking for.
+ 264905 [thomas.mackl] Yeah, look at String#reverse in conjuction w/ unpack.  One of the
| 265768 [akifusenet@g] I didnt think it would work in the first run. But hell it worked!
+ 264939 [vjoel@pa h. ] The suggestions to use pack and unpack are right on target, and learning

[SUMMARY] Cellular Automata (#134)
264898 [james@gr yp ] I chose this quiz because I felt it was easy and interesting.  It seems the jury

Ruby 1.8.6 problem
264901 [ja_bowen@ya ] I've just installed ruby 1.8.6 and my Windows programs
264902 [dblack@ru yp] I'm not sure but I wonder whether Windows is adding an extra extension

Re: smugmug 0.0.1
264903 [deschaefer@g] Very cool.  I look forward to giving it a try!

Subject: What *exactly* does an instance variable in the top level do / mean?
264906 [rps@sa as co] ...
264908 [celtic@sa ry] celtic@sohma:~$ ruby

Double quote escape character
264911 [alvaro.pmart] I'm trying to export a string to a excel file using fastercsv and I
+ 264912 [damnbigman@g] ...
+ 264913 [alvaro.pmart] I think there is not problem at all as it seems that the FasterCSV class
| + 264918 [halostatue@g] Sure there is.
| + 264919 [james@gr yp ] %Q{"hello"}
| + 264920 [hhausman@gm ] irb(main):001:0> puts "\"\"hello\"\""
+ 264914 [james@gr yp ] FasterCSV handles all the quoting for you.  That's why you use it.
+ 264915 [alex@bl ck e] You don't need to quote your output - FasterCSV quotes it iff necessary.
+ 264921 [thomas.mackl] irb
  264924 [alvaro.pmart] It´s a bit strange this.
  264925 [halostatue@g] puts "\"hello\"" # => "hello"
  264927 [alvaro.pmart] that´s very interesting, I had already notice that p and puts work
  264940 [phrogz@ma .c] @a = "foo"

Re: Subject: What *exactly* does an instance variable in the
264917 [jub@so en a.] Any instance variable refers to the object currently being self at the

Does singleton variables have any meaning ?
264923 [jub@so en a.] I would like to have a confirmation about the fact that singleton
+ 264926 [alex@bl ck e] class A
| 264948 [phrogz@ma .c] Your accessor method there is referencing a new class-level instance
| 264952 [alex@bl ck e] You're absolutely right.  Got myself confused in a maze of twisty
+ 264967 [dblack@ru yp] Like all instance variables, it belongs to whatever object is 'self'
  265015 [jub@so en a.] But here self is #<Class:A>. Here it really the same context/self as for
  265022 [dblack@ru yp] self is #<Class:A> (the singleton class of A), so @singleton_variable
  265075 [jub@so en a.] Ok, that's what I guessed
  + 265076 [robert.dober] I have no actual use case and I believe there will be not many save
  | 265078 [robert.dober] I tend to think too complicated :(
  + 265082 [dblack@ru yp] Singleton classes are classes. More importantly, though, it's best to
    265086 [jub@so en a.] Yes, I was just trying to make a slight difference, just like we don't
    + 265089 [dblack@ru yp] Luckily these particular instance variables almost never occur so
    + 265110 [caduceass@gm] The idea of singletons is to allow to add (or subtract) functionality
      265111 [fxn@ha hr f.] Can anyone explain whether there's a direct relationship between the
      265129 [phrogz@ma .c] There is not. It's an unfortunate name collision that can confuse
      265131 [dblack@ru yp] Or just peruse /usr/share/dict/words :-)

a helpful idea if you're looking for something to do
264928 [significants] compile a whole lot of ruby regex examples, with commentary on what's
+ 264934 [konrad@ty er] ...
+ 264935 [dzwell@gm il] This one bothered me a lot, but the solution is simple. At the beginning

Lazy function definition pattern in Ruby?
264936 [sam.s.kong@g] Yesterday, I read a blog about lazy function definition pattern in
+ 264969 [dblack@ru yp] You could do this (and I think it's similar to the "once" technique
| 264974 [cdcarter@gm ] Why not just use a closure, and do it the way you would in JS?
| 264990 [sam.s.kong@g] I also thought of it.
+ 264972 [ed.odanow@wo] You can define a method inside a method directly.
  + 264991 [sam.s.kong@g] On Aug 16, 1:18 pm, "Wolfgang N?dasi-Donner" <ed.oda...@wonado.de>
  + 265002 [dblack@ru yp] ...
    265005 [logancapaldo] That's easily fixable, just s/@/@@/
    265006 [dblack@ru yp] As long as you don't want to do the same thing in a subclass....
    265007 [logancapaldo] Everything is a tradeoff.
    265012 [dblack@ru yp] I'm not sure what the disadvantage of the local variable is, though.

SciTE and 1.8.6
264938 [ja_bowen@ya ] I installed Ruby 1.8.6 this morning.  At first I
264946 [gthiesfeld@g] # make sure the path to ruby.exe is in your path system environment

Ruby 1.8.6 and watir
264941 [ja_bowen@ya ] I see from a posting on watir page that other are

[gem] Problem installing dependecy log4r for ruby-net-nntp
264942 [eric-news@xs] To be able to interact with a news server (NNTP) I try to install
264958 [tim.pease@gm] I would recommend installing log4r by hand. You can download the gem
264981 [eric-news@xs] I'll give it a shot and report my findings. Thanks!
264986 [eric-news@xs] [root@scooby2 ~]# gem install Desktop/log4r-1.0.5.gem -l
264994 [drbrain@se m] One of the mirrors was probably busted.  I don't think you can easily
265000 [eric-news@xs] I'll look into it whenever (if ever) I leave my Ruby-noob-status behind.

Passing two functions as parameters
264943 [lolz.llolz@g] Is it possible to pass a function as a parameter?
+ 264944 [lolz.llolz@g] call_fncs( Proc.new { my_fnc1 }, Proc.new { my_fnc2 } )
| + 265037 [botp@de mo t] [mailto:list-bounce@example.com] On Behalf Of Frank Meyer
| | + 265050 [dkarapetyan@] ...
| | | 265055 [botp@de mo t] # I don't think what you are doing is valid code. Ruby is call
| | + 265054 [phrogz@ma .c] def test2( a=x, b=y, c=x )
| + 265061 [botp@de mo t] #
|   265114 [lolz.llolz@g] Thanks for all your work, but unfortunately when I created this topic I
+ 264945 [phrogz@ma .c] irb(main):001:0> def hi; puts "hello"; end
  264949 [lolz.llolz@g] Thank you that's exactly what I need.

shorten SHA1-hash
264951 [vebihl@gm il] In one of my railsapplications I have system for up/downloading files.
+ 264957 [port001@gm i] ...
+ 264973 [pubsub@ru yi] Modified Base64 for URLs is probably your best and easiest route.

Problems compiling Ruby 1.8.6 on AIX
264956 [cjs226@ya oo] ...
265057 [kinpoco@gm i] It seemed that you've installed gcc for AIX 5.1 to AIX 5.3.

Fastest CSV parsing?
264959 [w_a_x_man@ya] This is the best I've come up with so far.  It should handle any CSV
264962 [james@gr yp ] You are pretty much rewriting FasterCSV here.  Why do that when we
265026 [w_a_x_man@ya] That is a dishonest comment.
+ 265033 [david.mullet] Point made. However...
| 265043 [botp@de mo t] # http://blog.grayproductions.net/articles/2007/04/16/no-longer-
+ 265034 [TimHunter@nc] Hmmm...and here I was thinking that FasterCSV was free software. Have
+ 265040 [james@gr yp ] Not honest?  I guess I'm not sure how you meant that.
+ 265044 [lists@be tr ] Coding is a kind of sports to me. Besides that it is not my
  265473 [bilyy_bury@f] Just a pointer to yet another CSV parsing regex: http://snippets.dzone.com/posts/show/4430

character to hex/binary/etc...
264963 [dangerwillro] Hmm... I can turn a number into a character with .chr
+ 264966 [ed.odanow@wo] I don't understand what you mean - "to_s(b)" builds a string. What do
| 264970 [dangerwillro] yes it builds a string representation of a number.
| + 264975 [ed.odanow@wo] irb(main):002:0> 0x49.chr
| + 264976 [stefano.croc] 0x49.chr
|   264978 [dangerwillro] Oops, no, that's not what I need. I can do that.
|   + 264980 [gavin.kistne] irb(main):001:0> "I"[0]
|   + 264982 [adam.shelly@] like this?
|   | 264987 [dangerwillro] Hmm... that first technique is useful! Returning elements of a string.
|   | 265030 [overlord@gm ] Gut that won't work in Ruby 1.9. "haha"[0] is 104 in 1.8 but "h" in 1.9.
|   + 264983 [pubsub@ru yi] ?I
+ 264977 [pubsub@ru yi] You may be looking for Array#pack. It's useful for converting an array
  264995 [dangerwillro] The creator of god! I must listen carefully.

file grep
264964 [abhi_don@ya ] I have a file that has a list of filenames- filenames.txt
264971 [fwmailinglis] charset="us-ascii"
+ 265021 [abhi_don@ya ] Thanks Felix I just had to change one line
+ 265103 [shortcutter@] Here's another solution that avoids reading the large file into mem
  265116 [kaldrenon@gm] On Aug 17, 9:47 am, "Robert Klemme" <shortcut...@googlemail.com>
  265141 [shortcutter@] The more compact version does not properly close the file.  Although you
  265142 [kaldrenon@gm] That's good to know, glad I asked. Thanks!
  336803 [amcconaughey] begin

[ANN] Ruby East Registration is Open
264988 [aok@ch ri ts] ...

termios
264993 [ja_bowen@ya ] Anyone using termios?  I've installed it at
264999 [robert.dober] that should give enough hints to track this down. That is the standard anwser ;)

Gems problem
264996 [h4z3@th -c r] Ok sorry if this is in the wrong place, didn't really know where to
264998 [h4z3@th -c r] Also, i have just checked and /usr/lib/ruby/gems exists with ALL of my

Calls between methods of application.rb
264997 [kanellopoulo] In a rails application,
265020 [jub@so en a.] - post your code

DROID / PRONOM
265001 [dangerwillro] Anyone know of Ruby bindings or API for DROID / PRONOM ?

backticks
265003 [dangerwillro] Wow, seems that you can use double-quoted string style substitution
+ 265004 [ben@bl yt in] For added fun, try string interpolation inside regular expressions!
| 265009 [significants] whoa, can you explain a little what's going on here? I tried it and
| 265011 [logancapaldo] If it helps clear it up, /#{needle}/ is roughly equivalent to
| + 265023 [chris.worral] Simon --
| + 265046 [significants] ahhh, haha. well, the part that got me was it returning a "3" because
+ 265032 [james@gr yp ] You can do these tricks even in languages that don't support

regex quick ? solved, actually, move along.
265008 [significants] afile = "2007-08-10.152314-0700PDT.txt"
+ 265014 [dblack@ru yp] afile.scan(/\d{6}/)   # 6 digits
+ 265079 [shortcutter@] That bit looks like a time zone offset with the name ("PDT" which is

shared scripts and ruby gems
265010 [michael@do d] If I'm writing a ruby script that uses a certain library (e.g.
265038 [globyy3000@h] so long as you include the library / gem in ur script then so long as
265128 [michael@do d] Michael,
265581 [ snk@gn .o g] Add the path of the embedded gem's lib/ directory to the $: array (if

File.move command
265013 [barjunk@at g] File.move("mydir","mynewdir")
+ 265017 [logancapaldo] I can't find a File::move, I dunno where you got it from (some lib?).
| 265028 [barjunk@at g] But I'll try what you have suggested.
| 265029 [logancapaldo] Odd that it didn't work then, although I seem to recall that ftools is
+ 265019 [barjunk@at g] I forgot to add that it is ruby 1.8.4.

Visual Studio 6 (VC6) for Extension Development
265016 [mr.danielaqu] Does anyone have vc6 so I can develop an extension for windows ?

mysql gem reporting deadlock
265024 [andrew@ge i.] and the ruby code in question uses the mysql-2.7 gem directly.  Not

Help with Arrays...
265036 [jon539@gm il] words = []
265039 [dzwell@gm il] Jonathan,
265042 [jon539@gm il] thanks very much for the response.  The program does not seem to get to
265045 [dzwell@gm il] Not at all, the thickness is mine...
265047 [jon539@gm il] Dan,
265065 [shortcutter@] words = []
265145 [w_a_x_man@ya] On Aug 17, 3:49 am, "Robert Klemme" <shortcut...@googlemail.com>
+ 265216 [botp@de mo t] # From: Robert Klemme <shortcut...@googlemail.com>
+ 265221 [lojicdotcom@] words = []

Newbie Question on the Basics
265041 [vikr@mi ds r] (I hope I'm in the right forum. This is the site linked to as the forum
265048 [gthiesfeld@g] While someone might be able to help you here, you'll probably have

Web developement
265058 [jeyaprabhuj@] I am about to develope a web application which will have many hits per
+ 265066 [chris.lowis@] caboose published an interesting article on scaling up a rails app
+ 265106 [znmeb@ce ma ] I'm not familiar with DB2 Express Edition and whether or not it works
  265109 [outintospace] Another thing you can do is check out IronRuby, the .NET
  265207 [alexey.verkh] A bit too early for that.

ruport
265059 [globyy3000@h] alright im going about this in the blind so ima throw down my whole task
265104 [znmeb@ce ma ] I am faced with similar problems. Two words: "relational database". Two

Displaying currency symbols in select
265060 [killertoaste] I can't seem to get a £ symbol to display correctly in a form select
+ 265342 [eric-news@xs] Are u using a character set that contains the pound sign? (Like UTF-8)
+ 265359 [apeiros@gm .] Well, you should close it with a ;, "&pound;", not "&pound".
  265391 [killertoaste] I have tried it with the ';' and its still doesn't work. Has anybody
  265401 [apeiros@gm .] I don't have any problem with neither &pound; nor with charset set to
  265475 [killertoaste] Rails is outputting &amp;pound;
  265496 [killertoaste] I have managed to fix this using the CGI::unescapeHTML() method :-)

deleting an object in array, based on object.attribute
265063 [josselin@wa ] I have an array    anArray = [ object_1, object_2, ......  object_n]
+ 265064 [shortcutter@] irb(main):001:0> %w{foo bar peter mountain}.delete_if {|s| s.length > 3}
| 265068 [josselin@wa ] thanks Robert.. missed the delete_if { block }   in reading my doc !
+ 265067 [botp@de mo t] # I have an array    anArray = [ object_1, object_2, ......  object_n]

MultiValuedHash
265069 [ozric@we .d ] I have a lot  of files in an folder and want loop over the files in a
265071 [shortcutter@] hash = Hash.new {|h,k| h[k] = []}
265112 [ozric@we .d ] many thanks  for the trick
265122 [gthiesfeld@g] If you use the hash idiom Robert showed you, you won't have to worry

[C ext to Ruby] how to get the key, value pairs of  RHASH ???
265070 [yvon.thorava] i'd like to have, in my module options (is in FileUtils for ex) like
265073 [drbrain@se m] Use rb_hash_aset and rb_hash_aref from hash.c.  Jump down to the

How to build offline documentation about FileUtils ??
265072 [yvon.thorava] for the time being i'm indirectly connected to the net then, i need a
265077 [jan.svitok@g] Download sources (in case you don't have them already), run rdoc -o
265081 [yvon.thorava] thanks a lot !

Ldap search not succeding in a single attempt
265074 [rahulc1982@g] I am writing a code for user authentication from ldapserver in ruby.
265087 [garbagecat10] ...

Re: how to get the key, value pairs of RHASH ???
265080 [yvon.thorava] thanks a lot !
265117 [yvon.thorava] it's OK now for hash keys being strings NOT symbol, i did'nt found a
265124 [tim.pease@gm] If any of the methods in hash.c are preceded by the keyword "static",
265246 [yvon.thorava] OK, thanks again and again u'r a hole of science ;-)

Ruby-doc.org slow?
265083 [cliffrowley@] ...
+ 265084 [celtic@sa ry] No, reeaalllly slow.
| 265085 [robert.dober] If I recall correctly they are quite short on HW and without a
| 265201 [james.britt@] That's wrong.
| 265241 [robert.dober] You well never get donations with this honest attitude ;)
+ 265098 [alex.gorbatc] I recommend http://www.noobkit.com or http://www.gotapi.com
+ 265121 [florian.assm] and install it locally from http://www.ruby-doc.org/downloads :)
  265203 [james.britt@] People are probably better off running rdoc over the source for their

"Shoes"
265088 [transfire@gm] Hey _why, I found you a theme song :-)
265094 [port001@gm i] ...

how to heredoc without interpolation and backslash interpretation with arbitrary length delimiter support
265090 [ashishwave@g] how to do heredoc without interpolation and backslashes interpretation
+ 265091 [jan.svitok@g] Here Docs
+ 265092 [nickclare@gm] ...
+ 265093 [stefano.croc] Are you sure? If I remember correctly, %Q works like a double quoted string,
  265095 [ashishwave@g] ya, i actually meant %q (not %Q) i mistyped

[QUIZ] Process Rings (#135)
265096 [james@gr yp ] 1.  Please do not post any solutions or spoiler discussion for this quiz until
+ 265444 [tom@po os ic] Ok.... this is my first attempt at using callcc in ruby.  The code
| + 265450 [james@gr yp ] Neat idea.
| + 265472 [tom@po os ic] oops, a slight copy/paste error there..... run() will call
|   265497 [tom@po os ic] I'll resubmit my entry,
|   265704 [robert.dober] It is too rare that I find time to solve the Quiz, but this time I
+ 265815 [adam.shelly@] I've been thinking about virtual machines recently, so I decided to
  265835 [james@gr yp ] That gets my vote for the craziest Ruby Quiz solution ever.  Wow!
  265856 [adam.shelly@] You have no idea how much I regret that I had a bunch of real work to
threads.html
top