264887-336803 subjects 265273-280424

Problem Installing RMagick
265100 [tom@th mo eh] Okay, so I am setting up a brand new Macbook and can't seem to get
265105 [TimHunter@nc] Check out http://rmagick.rubyforge.org/install-faq.html.

Wanted RoR freelancer
265102 [ coen@hm .n ] We are currently looking for an Ruby on Rails developer that can help

Return first line of parsing
265107 [h4z3@th -c r] mysite.each {|line|
+ 265108 [tim.pease@gm] %r/^(.*)$/.match(mysite)[1]
| 265182 [dangerwillro] Careful,
| 265188 [konrad@ty er] ...
+ 265195 [yermej@gm il] If you want to use essentially the same block as above, but just take

Regexp riddle; escaping escapes
265113 [phlip2005@gm] Someone didn't escape their & in their HTML correctly. Let's fix it.
265119 [tim.pease@gm] str = "yo && dude"
265123 [phlip2005@gm] Thanks!
265132 [tim.pease@gm] I had to pull my pickaxe off the shelf and look it up, too.  Page 327

wishing of reactive programming in ruby
265115 [ashishwave@g] ruby integrates power of functional programming from lisp , purest OO
+ 265134 [transfire@gm] That's interesting --a form of rational programming (like Prolog).
| 265136 [benjohn@fy h] I'm about to go home. Damn.
| + 265137 [garbagecat10] ...
| | + 265140 [james@gr yp ] Are you aware of the Omnibus Concurrency Library?
| | | 265178 [garbagecat10] ...
| | | 265215 [znmeb@ce ma ] Well, I'll certainly offer to *test* it. :)
| | + 265482 [benjohn@fy h] *snip*
| + 265217 [no@sp m. le ] A strongly related, but possibly even more advanced technique is called
|   265220 [ezmobius@gm ] You will probably find this interesting:  http://www.flapjax-lang.org/
+ 265138 [dzwell@gm il] I haven't used reactive languages, but can't this be emulated by using
| 265165 [shortcutter@] I guess there is one major drawback of your approach: it will break as
+ 265332 [overlord@gm ] In a simple and slow implementation you can just put expression in a
+ 265339 [apeiros@gm .] class Expression < BlankSlate
+ 265484 [martindemell] project in that area
+ 265490 [phelan@tt ec] I think this may give you some ideas. A Reactive object
+ 268253 [chneukirchen] Half-way done ideas wrt that, inspired by flapjax.  No warranty.

[C ext to Ruby] how to produce from C, a ruby symbol ???
265118 [yvon.thorava] i'd like to use ruby symbols from C , i've found ID2SYM and SYM2ID but
+ 265120 [tim.pease@gm] ID2SYM( rb_intern( "verbose" ) );
+ 265125 [TimHunter@nc] rb_intern()

Re: how to produce from C, a ruby symbol ???
265126 [yvon.thorava] oop

[ADV] Deploying Rails Applications Beta Book Release
265127 [ezmobius@gm ] I'm happy to announce the beta release of my book for the Pragmatic

method access to the enclosing method's locals?
265130 [rubyforum@kl] How can a method gain access to the enclosing method's locals?
+ 265143 [o.renaud@la ] There is no such thing as a method inside a method. When you wirte 'def hi',
+ 265146 [jan.svitok@g] you may try something using 1. blocks, 2. passing actual binding, 3.
+ 265166 [shortcutter@] What exactly do you need that for?  I am curious because I haven't
+ 265168 [dblack@ru yp] def always starts a new local scope. If you want to define a method
| 265184 [rubyforum@kl] Thank you for your help. To keep things dry, my main method uses one of
| + 265186 [dblack@ru yp] I wouldn't say it doesn't exist; it's just that the lexically inner
| | 265192 [logancapaldo] ISTR def foo; def bar; end; end working in 1.8.4 and possibly even
| | 265924 [dblack@ru yp] I think I meant to type 1.8.4, though I'm semi-guessing anyway. I do
| + 265219 [botp@de mo t] # Btw, I find it a bit lacking that the syntax checker allows me to
+ 265196 [logancapaldo] def initialize
+ 265232 [dkarapetyan@] ...
| 265233 [dkarapetyan@] ...
| 265235 [dkarapetyan@] ...
+ 265238 [dkarapetyan@] ...
  265261 [dblack@ru yp] This isn't quite the same as doing an inner def, because you're
  265335 [dkarapetyan@] ...
  265340 [dblack@ru yp] The class keyword always starts a new local scope, but class_eval

basic RubyTk questions
265133 [siemsen@uc r] display a TkLabel.  It works, but I'd like a bit more control over how
+ 265205 [m_goldberg@a] The -1 requests an indefinite number of timeout events. Since you are
+ 265208 [vvangelovski] You are not very clear of what exaclty you intend to do, place what,
+ 265322 [m_goldberg@a] Now that _has_ has set me straight on how to use the osax library, I

Slave not removing slave_proc_* files
265144 [jos@ca no k.] patched swiftiply_mongrel_rails to use Ara's Slave library. The patch does
265300 [ara.t.howard] what is this code supposed to do exactly?  slave.rb puts an object in
265324 [jos@ca no k.] meaning that (since we are talking about the swiftiplied Mongrel here) it will
265336 [ara.t.howard] how do.
265344 [jos@ca no k.] AfaIk, Mongrel doesn't fork so this won't work. (Hey, that rhymes!)
265353 [ara.t.howard] no that's good - if it doesn't fork this might work great - if it did
265362 [jos@ca no k.] I'm not sure I understand. Are you suggesting that swiftiply_mongrel_rails run
265374 [ara.t.howard] i was just wondering if it might work - i've been suprised both by

Array Difference
265147 [matgott@ti .] # Begin code
+ 265152 [gthiesfeld@g] Prova.new(2) and Prova.new(2) are two different objects.  But with
| 265167 [shortcutter@] irb(main):001:0> class Foo; def eql?(o) true end; def hash() 0 end end
| 265366 [kbloom@gm il] Thanks for the tip, I've tried to do things like
| 265386 [shortcutter@] If by "hackish" you mean that this creates one additional class then
| 265403 [kbloom@gm il] I've tried two ways actually
+ 265169 [kbloom@gm il] A hash is used internally, and hash keys are compared for equality using

removing something from the end of each item in an array
265148 [significants] in this case a "\n"...
+ 265149 [cdcarter@gm ] array.map {|x| x.chomp } will strip whitespace including new-lines.
| + 265150 [jan.svitok@g] If you by chance want to do that in place, use map! instead of map.
| | 265163 [dblack@ru yp] Or each and chomp! which will prevent you from creating extra string
| + 265151 [significants] ahh!  interesting. I tried array.chomp and got a private method error.
| + 265153 [fxn@ha hr f.] That sounds to me as if it meant
| + 265158 [lists@be tr ] Here, this just strips the newlines. Depending on what Simon
+ 265155 [w_a_x_man@ya] array.map{|x| x.strip }
+ 265161 [kaldrenon@gm] As others have already said, probably the best way to remove \n from a

8086 simulator in ruby
265154 [vvangelovski] I'm thinking of writing a simulator for the intel 8086 processor in
+ 265160 [phlip2005@gm] Woo-hoo! Like Larry Wall said (he'd know), Real programmers can write
| 265174 [shortcutter@] I'd rather do
| 265183 [phlip2005@gm] How you get a class name to respond to do? I thought objects couldn't
| + 265185 [pubsub@ru yi] def FOO
| + 265212 [dangerwillro] Nah, it's just a normal block of Ruby!
|   + 265229 [shevegen@li ] Actually, even though this example may be totally useless (although it
|   + 265239 [shortcutter@] Actually it's not the "10" but the "times" because "CPU8086" would be a
|     265281 [phlip2005@gm] Please read my posting history, blogs, Ruby open source, etc. (-;
|     265291 [cdcarter@gm ] 3 	def Hpricot(input = nil, opts = {}, &blk)
|     265295 [dangerwillro] Yep, normal stuff. EXCEPT for the capitalization. You can do it, but
|     265384 [shortcutter@] Phlip, not sure what you meant by this.  It's not different from any
|     265402 [phlip2005@gm] I mis-remembered something. Something about a method that you could create
|     265409 [dblack@ru yp] irb(main):005:0> class C
|     265436 [vvangelovski] How about this?
+ 265162 [wilsonb@gm i] Check out rubinius at http://rubini.us for a Ruby implementation
| 265170 [dangerwillro] Aww, how about a C-64 emulator...
| + 265172 [phlip2005@gm] Dude, there are simulations of Ada & Babbage's "Inference Engine" out there!
| + 265234 [Freeman@Or h] Brings to mind the old punchline about that Commodore tape drive: Records
|   265237 [ashishwave@g] Nice idea Vasil.
+ 265173 [robert.dober] I do not think metaprogramming is of use here, maybe you can get some
+ 265325 [overlord@gm ] That depends on the level of emulation you want. What others propose

Problem with Breakpoint/IRB
265156 [tom@th mo eh] When I insert a breakpoint in my Ruby code, I am unable to see
265225 [a99.googlegr] I recently was playing around with the debugger, and had some

Narray question
265159 [fixedincome1] problem is I try to convert from an array to Narray and it seems like
265164 [fixedincome1] sorry, made a mistake in code.

Filesystem Database
265171 [yottameter@y] I'd like to use a database, but my IT department won't install mysql. I
+ 265175 [wayneeseguin] ...
| 265180 [dangerwillro] What a crappy IT department!
| + 265193 [wayneeseguin] ...
| | 265213 [dangerwillro] Oops! My client didn't properly nest the quote levels! Sorry for the
| + 265200 [yottameter@y] The problem is a rogue IT person did give me sudo, but then our machines
|   265204 [reid.thompso] If the DB is for just you or a small number of people, use sqlite, if
+ 265218 [znmeb@ce ma ] I've seen a number of responses here, some helpful and some rather
| 265272 [fwmailinglis] charset="US-ASCII"
| 265407 [tpo2@so rc p] Might be. But then again, you have a profession. You have a profile. And
+ 265309 [vjoel@pa h. ] Unfortunately, FSDB doesn't have a standard db interface. It's more of a

Call a program
265176 [greg.johnsen] Can anyone help me with the following issue: How can I call a program
+ 265179 [shortcutter@] The easiest forms are these
+ 265181 [wayneeseguin] ...

Sending email using net/smtp
265177 [gabe@dr gf y] Dear Ruby list
265199 [gabe@dr gf y] Well that just goes to show. I spent two days knocking my head

Unloading (or unrequiring) a file
265187 [ari@ar br wn] Hey all,
265190 [logancapaldo] As far as methods go there's remove_method and undef_method. For

ANN: Sequel Released
265189 [ciconia@gm i] Sequel version has just been released. This release includes a

I'm a newcomer
265191 [gramos@re to] My name is Gast?n Ramos (new to this list) and I'm Argentinian I discovered Ruby
+ 265194 [dblack@ru yp] ...
+ 265198 [wayneeseguin] ...
| 265214 [dangerwillro] Welcome!
| 265228 [shevegen@li ] So many dont have english as their native language - even some extremely
+ 265231 [alin.popa@gm] It seems to me that you've made a very good choice ;)

Fun with RACC examples
265202 [barjunk@at g] I've been browsing the Pragmatic Programmer book and was taken by the
265749 [barjunk@at g] when /\A\S+/o
265756 [dave.baldwin] I looked at raac but the lack of docs put me off.  Dhaka too much
265799 [barjunk@at g] Dave,

Using StandardAdditions.osax with appscript
265206 [m_goldberg@a] Can anybody tell me how to execute a command (e.g., beep) implemented
+ 265209 [vvangelovski] 1. Execute applescript in shell command
| 265224 [m_goldberg@a] Yeah, I could do that. But it would kind of spoil the fun. As I see
+ 265250 [has.temp3@vi] require 'osax'
  265315 [m_goldberg@a] It does indeed help. Exactly the info I was looking for. Thanks a lot.

Re: comments in code on eval()
265211 [celtic@sa ry] Not a chance.
265222 [james@gr yp ] Giles, why do I feel like there's only one tool in your toolbox?  ;)

Problem with Array#delete
265223 [weather@sp a] I have an Account class and an external array that keeps them in a list. I'm
+ 265226 [m_goldberg@a] I ran your code and I didn't have a problem: it did what you
| 265230 [weather@sp a] Sorry, I only meant the code I posted as an example of what is happening --
| 265240 [shortcutter@] The crucial bit is missing: how did you define ==, eql? and hash in your
| 265243 [weather@sp a] I went a little different route, but that was indeed the problem. I just
| 265269 [shortcutter@] If you just defined == the way you presented above then the issue should
| 265298 [weather@sp a] Ok, so it looks like this didn't work so well after all. Initially, I thought
| 265321 [dblack@ru yp] ...
| 265334 [weather@sp a] Thank you to everyone who has tried to help me with this today -- I know for
| 265338 [dblack@ru yp] I still can't tell what's happening without seeing actual code that's
| 265352 [weather@sp a] require 'singleton'
| 265355 [dblack@ru yp] I'm feeling a little stupid, but where do you define Character#== ?
| 265358 [weather@sp a] class Character < Mind
| + 265363 [dblack@ru yp] I'm afraid I can't reproduce the error, so I'm not sure where to start
| + 265367 [flori@ni e. ] def ==(other)
+ 265227 [dzwell@gm il] Wow, that was a well-asked question. This seems like a Ruby bug, though

[ANN] RWEB 0.2.0
265236 [ttmrichter@g] The RWEB literate programming tool for Ruby has been updated to version

need help. want to use Net::sh to do sudo command
265242 [wbsurfver@ya] I want to do a sudo command to change permissions on our server
265333 [drbrain@se m] Why bother with Net::SSH?

How do you print the first 5 records in an array?
265244 [small.busine] @people = ["Jim", "Jen", "Jess", "Jay", "Jack", "John", "Jeff", "Jed",
+ 265245 [stefano.croc] puts @people [0..4]
| + 265247 [small.busine] Stefano, you're the best. Thank you!
| + 265249 [djb@wa ad o.] 0.upto(4) { |x| puts @people[x]}
|   + 265253 [sepp2k@go gl] Why do you feel that that's preferable to Stefano's solution?
|   | 265260 [djb@wa ad o.] It's not. I mistakenly placed my reaction on the wrong leaf.
|   | 265265 [dblack@ru yp] I'd avoid iterating through a whole array just to puts its elements,
|   + 265293 [phlip2005@gm] 5.times{ puts @people.shift }
|     265296 [bobgus@rc .c] puts @people[0..4].join("\n")
|     265313 [dblack@ru yp] Assuming people don't end with "\n", that will have the same effect as
+ 265254 [fxn@ha hr f.] You can explicitly say "Take n items starting from index i" with the
| 265255 [small.busine] You all are so helpful. This is why the ruby community rocks. Thank you
+ 265256 [apeiros@gm .] puts(*@people.first(5))
| 265263 [dblack@ru yp] I don't think you need the * there.
| 265266 [apeiros@gm .] Darn, and just when you say it is unsurprising you hit a surprising
+ 265257 [konrad@ty er] ...
| + 265258 [konrad@ty er] ...
| | 265271 [shortcutter@] Although I'm always fond of solutions using #inject in this case I'm
| | 265329 [flori@ni e. ] puts_first_five = (0...5).inject(lambda {}) { |f, i| lambda { |a| f[a];
| + 265308 [Christopher.] require 'rio'
+ 265297 [james@gr yp ] I see you got your answer, but I wanted to add that you can do the
+ 265318 [lists@be tr ] Depending on what you want to do further maybe this is worth
| 265350 [florian.assm] No need to iterate here, just
| 265435 [eric-news@xs] @array.first(5) reads exactly like 'the first 5 things' from the array...
| 265462 [james.herdma] ...
+ 265383 [alin.popa@gm] 5.times{|t| puts @people[t]}

R: How do you print the first 5 records in an array?
265248 [andrea.forli] @people[0..4].each { |item| puts item }
265262 [eric-news@xs] Jim
265264 [andrea.forli] ...

How Can I display XML file?
265251 [wzfg@si gt l] I have a XML string, such as xs="<?xml version='1.0' ?><testh><test1
+ 265252 [wzfg@si gt l] the xml string is xs="<?xml version='1.0' ?><testh><test1> 1
+ 265289 [stephane.wir] You can use the Builder gem, to generate an indented xml stream.
+ 265290 [phlipcpp@ya ] Use XSLT to convert the XML to XHTML describing the XML. This is a common

Visual Paradigm for UML 6.1 supporting Ruby is released!!
265259 [enogrob@gm i] Visual Paradigm International Limited announced the release of Visual

[C ext to Ruby] how to read a ruby symbol from C ?
265267 [yvon.thorava] I'm now able to produce a ruby symbol from C
265368 [nobu@ru y- a] You need to include st.h too.

Working with String
265268 [dipesh_bathe] full path of a file. Example "/foo/foo.gif". I need to just extract the
+ 265270 [fwmailinglis] charset="US-ASCII"
+ 265278 [phaneee5@gm ] irb(main):035:0> "/foo/foo.gif".split("/")[-1]
+ 265279 [phrogz@ma .c] irb(main):001:0> s = "/foo/bar/whee.gif"
| 265282 [dipesh_bathe] Thanks Gavin that really helped.
+ 265287 [o.renaud@la ] You can also use a dedicated lib, for manipulating filenames : pathname