174137-175889

173909-178505 subjects 174367-223889

method &block question
174137 [SimonKroeger] could someone please put a finger on the point i'm missing?
174139 [SimonKroeger] It does not, the array is simply splashed when passed to 'p', so p

red cloth question
174142 [sean@ar is g] ...
174188 [rosco@ro co ] require 'redcloth'
174253 [sean@ar is g] ...

fxri incomplete
174145 [x@ve sa ec s] I like fxri but why is it that some very essential libraries, e.g. the
174156 [tmorse@gm il] Fxri is based on ri. Ri by default only contains documentation on the
174161 [x@ve sa ec s] I've just found out that the online "Ruby Standard Library
174201 [james_b@ne r] That page should also have a link for downloading a tarball or zip file

Re: Newbie tearing hair out
174157 [page77.offic] Many thanks to all who responded.  It turned out that the problem was

web examples
174159 [faruqfayaz@g] i'm thinking about getting into Ruby. I want to build web browser based
+ 174162 [leavengood@g] You seem to be one of the rare people who heard about Ruby before
| + 174169 [faruqfayaz@g] Thanks. Ruby sounds good.
| | 174200 [james_b@ne r] Me too.  Better to look stupid than stay stupid.
| + 174226 [perrin@ap th] I'm not so sure it's all that rare . . . it probably just isn't very
|   174342 [slitt@ea th ] I heard about Ruby years ago, but "so many languages, so little time", so I
+ 174164 [balcersk@ws ] What do you mean by web browser based applications?
  + 174170 [faruqfayaz@g] I'm from a Flash actionscript background so used to building rich media
  | 174180 [faruqfayaz@g] Can Ruby produce something like space invaders delivered through a
  | + 174192 [rosco@ro co ] Probably. But whether anyone could actually use it is a different
  | + 174229 [perrin@ap th] Technically . . . yes.  Realistically . . . not so much, at this time,
  |   174270 [faruqfayaz@g] thanks guys,
  + 174227 [perrin@ap th] I get the distinct impression that what's meant here is "a web

Newbie - Problem One - Ruby and MySQL
174160 [page77.offic] I have ruby, apache and MySQL installed via instantrailson Windows XP
+ 174196 [x@ve sa ec s] There is no native Ruby to MySQL adapter under Windows. That is why
+ 174215 [jonbaer@gm i] require 'rubygems'

Newbie - Problem Two - Ruby and Form Variables, re-loading like PHP_SELF
174163 [page77.offic] I am attempting to copy a PHP project I did in Ruby.
174294 [ef@al m. it ] If I remember my PHP correctly, $_SERVER['PHP_SELF'] is simply the
174307 [ryansobol@gm] Actually, you'll also need to call basename().  So,
174393 [page77.offic] Thanks for the replies, and yes PHP_SELF is the name of the running
174406 [ryansobol@gm] basename() is a PHP function, not a Ruby one.
174409 [james@gr yp ] $ ri -T File::basename
174413 [ryansobol@gm] Thanks James.  :)

using irb
174202 [info@ja eo a] So far I've created a ~/bin/rb/dev/foo directory as a place to write and test scripts. After reading the "pick axe" book some more it seems as is irb is a better "place" or "way" to try out stuff. This correct?
+ 174211 [cyclists@nc ] Many (perhaps most) Rubyists use irb to try out simple Ruby stuff. I
| + 174214 [james_b@ne r] I edit in gvim, with the Ruby menu and macro stuff,  and it's trivial to
| | 174255 [gregory.t.br] I use plain old vim and gvim and have both irb and the ruby
| | + 174268 [nbarnes@gm i] After a great deal of annoyance getting started with Ruby, I'm getting
| | + 174273 [rasputnik@gm] Nice, have you got any config snippets you wouldn't mind sharing?
| |   + 174335 [gregory.t.br] I'll paste in my .vimrc and my .irbrc file (the latter was lovingly
| |   | 174337 [ryansobol@gm] ...
| |   | 174338 [james@gr yp ] I was having trouble with IRb at some point and that was the fix.
| |   | 174400 [rosco@ro co ] Still useful though - I use something similar to allow symlinks to launch
| |   + 174336 [gregory.t.br] You probably just wanted this though: ;) (slap in .vimrc)
| + 174237 [hal9000@hy e] But beware. You can get strange results 1% of the time... as a result
+ 174218 [pjlegato@bl ] irb is great for rapidly getting a feel for how things work, since you
  174235 [perrin@ap th] Assuming you mean that using irb alone shouldn't give you the impression

Default block parameter?
174207 [mreed@th re ] Okay, this is probably a dumb question, but how do I declare an
+ 174212 [james@gr yp ] ?>     lambda { puts "Default block" }.call
+ 174219 [pjlegato@bl ] def foo(block = lambda {|i| puts i})
+ 174221 [dblack@wo bl] The &block thing is a special dispensation from Ruby, letting you grab
  174334 [lukfugl@gm i] But keep in mind that assigning to block inside the method doesn't
  174340 [dblack@wo bl] Right -- all that happens in my version is assignment to a variable.
  174491 [mreed@th re ] Thanks to all who posted.  The upshot seems to be that I need to declare

Uploading data to MS SQL Server - problem with quote character
174209 [sam.dela.cru] I'm a ruby newbie.  On one project I have, I need to upload data coming
174216 [warrenbrown@] Sam,
174420 [blargity@gm ] You'll also want to escape the usual SQL special characters, namely

win32ole and mci.mmcontrol failure
174228 [djberg96@gm ] Windows XP, SP2
174283 [vanek@ac .n ] irb(main):001:0> require 'win32ole'
174296 [djberg96@gm ] I don't see it.
174301 [vanek@ac .n ] i think the ocx is automatically installed with Visual C++, Visual Basic, and

Extreme dynamism examples for showing off Ruby power
174234 [dsymonds@gm ] I'm giving a presentation to my research group next month about Ruby
+ 174240 [ryansobol@gm] Many solutions to the latest ruby quiz used breadth-first search, a
+ 174261 [bob.news@gm ] I always like the interchangeability of lambda#[] and Hash#[] which allows
+ 174265 [rosco@ro co ] Well, I don't know how much they'll impress such old salts, but you can

Re: [RUSSELL] Proposed new rule
174239 [james_b@ne r] But of course!

net/ssh: corrupted mac detected
174242 [itsme213@ho ] Never did quite get past this error when using net/ssh. Any suggestions?
174266 [rosco@ro co ] [... snip ...]

Pulling XML from Amazon API
174247 [jonathan.ott] Take Amazon's API for example, returning a XML file. In my application
174248 [lyndon.samso] ...
174249 [jonathan.ott] is that a common way of getting data from an API and manipulating it?
174250 [twifkak@co c] Isn't amazon's API xmlrpc or soap?
174254 [jonathan.ott] OK, I see now how to use Amazon's through SOAP or XML RPC.... but let's
174274 [damphyr@fr e] The use of the proxy is optional (if there is a proxy inbetween then you

Net::Telnet and sysread()
174251 [willshattuck] I'm trying establish a telnet connection to nethack.alt.org.  I canget a connection but Net::Telnet cannot seem to handle the output.  Inreading net/telnet.rb I found out about IO#sysread so i put thislittle tnet.rb file together

Demystifying Symbols.
174257 [groups@gr nd] I was actually doing really well until the strange discussion involving
+ 174258 [perrin@ap th] The integer value can be regarded as a side effect of the way symbols
| 174366 [slitt@ea th ] Internals question: Curious -- why don't they hash with the object id instead?
| 174370 [slitt@ea th ] Oh never mind -- a more careful reading of Evan's internals explanation makes
+ 174286 [dblack@wo bl] That depends.  If you're calling a method that insists on a Symbol
| 174313 [perrin@ap th] I guess that, if you want to compare them to "variables" (things that
+ 174302 [itsme213@ho ] Yet another try ...
+ 174365 [slitt@ea th ] Yeah, that was quite a breakthrough for me too. I coded it to prove it to
| + 174402 [lyndon.samso] ...
| + 174484 [groups@gr nd] Exactly. So if I'm going to try explaining Symbols to somebody who's
| | + 174495 [jim@we ri hh] Hmmm ... see http://onestepback.org/index.cgi/Tech/Ruby/Shoeboxes.rdoc
| | | + 174701 [gavin@re in ] Good point in your article - shoeboxes (or pigeonholes, as I
| | | + 174739 [groups@gr nd] Oh, I definitely agree. But again, my explanation is specifically for
| | |   174742 [gwtmp01@ma .] I think the keychain analogy has some possibilities.
| | |   174762 [alex.combas@] I'll be honest, as a rubynewbie I liked Jim's description of variables
| | |   174763 [lyndon.samso] ...
| | |   174770 [alex.combas@] I don't know if this is what you are looking for, but this is how I
| | + 174506 [rosco@ro co ] f = File.read(:"/etc/passwd")
| |   174728 [groups@gr nd] Hmm. But that's the opposite of what I said. I'm not too dismayed if
| |   174731 [dblack@wo bl] A number of methods in the various Rails libraries only work with
| + 174687 [a.mcguinness] That's true, but only because attr_accessor can convert the Strings it
+ 174386 [jim@we ri hh] The problem with programming is that
+ 174631 [chris@pi e. ] This is why writing a decent tutorial is so hard.  Unless you really
  174736 [perrin@ap th] I tend to assume one knows a little something about strings and variable

About The Pickaxe 2nd ed. and Ruby 2
174262 [biyokuantum@] I have just ordered the Pickaxe 2nd ed. from Amazon. But now I am
+ 174269 [ptkwt@ar cn ] First off, I don't know if anyone really knows when Ruby 2.0 will actually be
+ 174468 [chneukirchen] Should the changes to Ruby 2 be significant enough to make code
+ 174655 [gene.tani@gm] ...

Re: [ANN] Rio 0.3.7
174275 [wybo@se va y] Great! That solved my problem with rio#mkdir with 0.3.4 under linux!
174297 [dave.m@em il] Very nice!
174325 [trashcan@ho ] Bravo !
174326 [duane.johnso] impressed!  I have a few interface questions for you--things that

String utf8 size in kilobytes
174276 [dewie@it l. ] I have a mimemessage in a string.
174284 [f@an re s- .] String#size returns the size in bytes. String#jsize returns the number
174285 [dewie@it l. ] Thanks, then my method is valid, i want to know the bytes, so that's

Redirecting CGI#out to a string
174277 [zyzygy@te st] For my first "production" ruby app, I'm writing a self contained web
174278 [rosco@ro co ] require 'cgi'

Vim two space indentation
174279 [info@ja eo a] This has probably been done before but I've looked through 5000+ emails and I've not seen a simple solution. I'd like to have two space indentation for *.rb files or those whose first line begins with !#/usr/bin/ruby. At the moment vim gives me eight spaces, (or is it a tab?).
+ 174281 [ruby@an hr p] } Hi guys,
| + 174289 [rosco@ro co ] set nocompatible
| + 174293 [info@ja eo a] Thanks!
+ 174299 [oliver.andri] I use a setting like that in my .vimrc file.
+ 174430 [gsinclair@gm] The best answer is to create a file ~/.vim/ftplugin/ruby.vim with the
  174432 [eban@os ri .] In this case, it might be better to use setlocal instead of set.

Field Scope
174282 [forest.aa@gm] what is the scope of @run field in the code below.  Is it module static
174292 [rosco@ro co ] Forget about static and all that, and remember that modules are objects
174298 [forest.aa@gm] Thanks a lot, it explains everything.
174300 [rosco@ro co ] I feel the same way, but I realise now that I feel that way because I

[SUMMARY] Numeric Maze (#60)
174288 [james@gr yp ] As with so many of our Ruby Quiz problems, this is another pathfinding
+ 174308 [kero@ch ll .] Are they really faster? Ruby bits are not directly in CPU registers.
| + 174310 [james@gr yp ] Good point.  Thanks for showing us the real story.
| + 174317 [ryansobol@gm] As I suspected.  Stupid C idioms.  :)
| + 174322 [vanek@ac .n ] The shift operator comes in handy and can save a lot of time.
| | 174372 [SimonKroeger] This is an implementation detail,
| | 174412 [vanek@ac .n ] Then I guess I just love implementation details.
| + 174466 [chneukirchen] IIRC, a bitshift on modern Intel processors is extremely inefficient
+ 174330 [steve@wa ts ] I think that the purely binary pattern/bit-twiddling based solutions

need create RTF-type file and DOC-type file
174305 [keal21@ma l.] i need library to create RTF-type file and DOC-type file.
174319 [mblondel@gm ] huh?

how remove puts inside method?
174312 [  k@eb y. om] I have a method (process_transaction) that uses puts to output a result.
174314 [  k@eb y. om] For example I would like to remove puts from the process_transaction
+ 174316 [bob.news@gm ] I'm not really sure what you're up to.  Can you elaborate?  The only thing
| 174352 [  k@eb y. om] I'd like the output of process_transaction as a long string. But I don't
| + 174435 [bob.news@gm ] The parts after "or" will never be called because each returns the
| | 174459 [  k@eb y. om] thanks Robert ... but it did not work out ...
| | + 174460 [lyndon.samso] ...
| | + 174479 [bob.news@gm ] Somehow I find your design a bit contrived: you store your meta data in
| |   174592 [  k@eb y. om] Thanks Robert! This works beautifull!
| + 174461 [kevin.olbric] Just put this type of structure in whichever function you are trying to
|   174476 [  k@eb y. om] thanks a lot, now it works: http://rafb.net/paste/results/8FsA6E62.html
|   174514 [kevin.olbric] "output" is just a string variable with a confusing name, you could call
+ 174320 [kevin.olbric] You could just mash the output into one long string...
+ 174321 [ara.t.howard] require "yaml"

Trapping errors, a simple example
174318 [info@ja eo a] Hey Chaps,
174324 [bob.news@gm ] p.chomp!
174327 [james@gr yp ] You might also want to take a look at HighLine[1], which can make

Snakes and Rubies Video and Audio Online!
174323 [ng@jo nw on ] It is my pleasure to announce that the video and audio from the Snakes
174449 [Bil.Kleb@NA ] Thank you.
+ 174516 [dan@da sh fe] Those videos were interesting. Thanks for the pointer.
| 174517 [ryansobol@gm] An event like this would _probably_ interest those who already know
| 174586 [ng@jo nw on ] And there is a nice list of other blog entries at the bottom of David's
+ 174584 [ng@jo nw on ] Enjoy! :-)
  175179 [Bil.Kleb@NA ] Excellent.
  175268 [david@va ln ] Oooh, now there's a great gimmick to annoy anyone at uni that restricts

Ruby equivalent of Lex (or Flex)?
174329 [thp@cs uc .e] I'm interested in writing compilers in Ruby.  It appears that Racc is
+ 174362 [collinsj@se ] Rex?
+ 174382 [doug00@gm il] ANTLR 3.0 (still in alpha and likely to remain so for another year or

[ANN] Instant Rails 1.0 Final has been released!
174331 [curt.hibbs@g] ...
+ 174369 [slitt@ea th ] When?
| 174397 [ml.chibbs@gm] Hard to say.
+ 175873 [james_b@ne r] Curt, can you explain how I configure Instant Rails to run MySQL on a
  175886 [ml.chibbs@gm] When you're editing the MySQL config file (from the "I" menu, as you
  175889 [james_b@ne r] Perfect.

Inherit, Delegate, or Forwarding?
174341 [netghost@gm ] When do you guys choose to inherit from a class, use a delegate, or
174390 [james@gr yp ] As the saying goes, "Favor composition over inheritance."  The theory
174395 [Daniel.Berge] Note that, with some help, I revamped forwardable.rb and it has been

Initialization using the Singleton design pattern
174343 [lists@tu ni ] I have a singleton class, as in one that does "include Singleton". I
+ 174345 [james@gr yp ] => true
| 174375 [lists@tu ni ] Okay thanks, I've got it sorted now. I had tried using initialize()
+ 174346 [halostatue@g] Right. Just use #initialize as normal, though.

net/imap idle
174348 [payton@fo lo] Perhaps there's another way to do this without polling, but I added the

 =?euc-kr?B?T3ZlcnJpZGRlbiBBcnJheSNbXT0gbWV0aG9kIHJldHVybnMgdW5leHBlY3RlZCB2YWx1ZQ==?=
174349 [ladylazy@te ] I overrode Array#[]= like this on irb

Re: Overridden Array#[]= method returns unexpected value
174350 [james@gr yp ] Assignment always results in the value that was assigned in Ruby.  We

Can't find ruby after installation
174351 [nirav.dani@g] I skipped ruby selection while installing mandrake 10.1 with an
+ 174353 [tibbettj@ve ] It's probably in your current working directory (i.e. from wherever you
| 174354 [zacharooni@c] During the .configure you can pass the parameters to set that at runtime
+ 174356 [elmo@ho e. j] You might need to run 'make install' as root to actually install it,
  174371 [nirav.dani@g] Strange!! last time I kept the distro version, and

 =?euc-kr?B?UmU6IE92ZXJyaWRkZW4gQXJyYXkjW109IG1ldGhvZCByZXR1cm5zIHVuZXhwZWN0ZWQgdmFsdWU=?=
174355 [ladylazy@te ] I'm just studying now .Thank you.

Is it possible to create a GUI/TUI toolkit using ruby?
174357 [simonharriso] this may be a daft question, but is it possible to create a widget
+ 174363 [dan@da sh fe] I suspect it would be possible but I also suspect it would be quite
| 174723 [znmeb@ce ma ] In addition to Gtk and Fox, Qt is supported, as is Tk. I'm not sure but
| 174869 [tsumeruby@ts] Qt widgets best looking? The GTK widgets look like candy as well when you use
+ 174381 [alec@ar ro s] simonh <simonharrison@fastmail.co.uk> writes
+ 174383 [hynek@us ne ] It is possible. You'd just need an interface to the low-level graphical
| 174407 [kero@ch ll .] (but it's been ages since I worked on it; Xlib is a beast, a monster; lots
+ 174385 [ilmari.heikk] Sure. All you need is a drawing backend and way to get input events.OpenGL for drawing and GLUT / SDL for input & windowsystem handlingwould work I guess.
+ 174415 [hutch@re ur ] It certainly can be done. The thing is it is a huge never-ending

Daemonize like fetchmail
174360 [payton@fo lo] Has anyone used the Daemons library (http://daemons.rubyforge.org/)
+ 174378 [ara.t.howard] ruby queue and dirwatch both do this.
+ 175168 [payton@fo lo] -Payton
  + 175174 [ara.t.howard] it does look useful.  few comments/suggestions though
  | 175190 [payton@fo lo] Would this be correct usage of the file, then?
  | 175194 [ara.t.howard] def pid
  + 175196 [jos@ca no k.] Instead of putting this logic in (every) application, have you considered
  + 175301 [snowzone5@ho] it certainly is :)
threads.html
top