264898-265856 subjects 265273-280424

^ Problem Installing RMagick
265100 [tom themoleh] 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 hm2.nl] We are currently looking for an Ruby on Rails developer that can help

^ Return first line of parsing
265107 [h4z3 the-c0r] mysite.each {|line|
+ 265108 [tim.pease gm] %r/^(.*)$/.match(mysite)[1]
| 265182 [dangerwillro] Careful,
| 265188 [konrad tyler] protocol="application/pgp-signature";
+ 265195 [yermej gmail] 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 fysh] I'm about to go home. Damn.
| + 265137 [garbagecat10] I'm well aware and very respectful of the respect that many informed people
| | + 265140 [james graypr] Are you aware of the Omnibus Concurrency Library?
| | | 265178 [garbagecat10] Yes, I took a close look at the Erlang concurrency verbs (spawn, and the
| | | 265215 [znmeb cesmai] Well, I'll certainly offer to *test* it. :)
| | + 265482 [benjohn fysh] *snip*
| + 265217 [no spam.plea] A strongly related, but possibly even more advanced technique is called
|   265220 [ezmobius gma] You will probably find this interesting:  http://www.flapjax-lang.org/
+ 265138 [dzwell gmail] 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 gmx] In a simple and slow implementation you can just put expression in a
+ 265339 [apeiros gmx.] class Expression < BlankSlate
+ 265484 [martindemell] project in that area
+ 265490 [phelan tttec] 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 gma] 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 lap] 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 rubyp] 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 rubyp] 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 rubyp] I think I meant to type 1.8.4, though I'm semi-guessing anyway. I do
| + 265219 [botp delmont] # Btw, I find it a bit lacking that the syntax checker allows me to
+ 265196 [logancapaldo] def initialize
+ 265232 [dkarapetyan ] The general concept involved is that of a closure and it is certainly
| 265233 [dkarapetyan ] Here's one way. First define the closure then use define_method to turn the
| 265235 [dkarapetyan ] Sorry, the code below doesn't work. There are problems with variable
+ 265238 [dkarapetyan ] Ok, just ignore all my previous posts. I should have done some more research
  265261 [dblack rubyp] This isn't quite the same as doing an inner def, because you're
  265335 [dkarapetyan ] Maybe you can answer another question. While trying to figure this out I
  265340 [dblack rubyp] The class keyword always starts a new local scope, but class_eval

^ basic RubyTk questions
265133 [siemsen ucar] 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 catnook.] 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 catnook.] meaning that (since we are talking about the swiftiplied Mongrel here) it will
265336 [ara.t.howard] how do.
265344 [jos catnook.] 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 catnook.] 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 tin.] # 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 gmail] 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 gmail] I've tried two ways actually
+ 265169 [kbloom gmail] 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 gma] 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 rubyp] 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 hashref.] That sounds to me as if it meant
| + 265158 [lists bertra] 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 rubyi] def FOO
| + 265212 [dangerwillro] Nah, it's just a normal block of Ruby!
|   + 265229 [shevegen lin] 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 gma] 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 rubyp] irb(main):005:0> class C
|     265436 [vvangelovski] How about this?
+ 265162 [wilsonb gmai] 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 Orth] 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 gmx] That depends on the level of emulation you want. What others propose

^ Problem with Breakpoint/IRB
265156 [tom themoleh] 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] charset=US-ASCII;
| 265180 [dangerwillro] What a crappy IT department!
| + 265193 [wayneeseguin] charset=US-ASCII;
| | 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 cesmai] I've seen a number of responses here, some helpful and some rather
| 265272 [fwmailinglis] charset="US-ASCII"
| 265407 [tpo2 sourcep] Might be. But then again, you have a profession. You have a profile. And
+ 265309 [vjoel path.b] 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] charset=US-ASCII;

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

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

^ ANN: Sequel Released
265189 [ciconia gmai] Sequel version has just been released. This release includes a

^ I'm a newcomer
265191 [gramos recto] My name is Gastóî Ramos (new to this list) and I'm Argentinian I discovered Ruby
+ 265194 [dblack rubyp] This message is in MIME format.  The first part should be readable text,
+ 265198 [wayneeseguin] charset=ISO-8859-1;
| 265214 [dangerwillro] Welcome!
| 265228 [shevegen lin] 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 attg] I've been browsing the Pragmatic Programmer book and was taken by the
265749 [barjunk attg] when /\A\S+/o
265756 [dave.baldwin] I looked at raac but the lack of docs put me off.  Dhaka too much
265799 [barjunk attg] 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 sairy] Not a chance.
265222 [james graypr] Giles, why do I feel like there's only one tool in your toolbox?  ;)

^ Problem with Array#delete
265223 [weather spea] 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 spea] 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 spea] 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 spea] Ok, so it looks like this didn't work so well after all. Initially, I thought
| 265321 [dblack rubyp] This message is in MIME format.  The first part should be readable text,
| 265334 [weather spea] Thank you to everyone who has tried to help me with this today -- I know for
| 265338 [dblack rubyp] I still can't tell what's happening without seeing actual code that's
| 265352 [weather spea] require 'singleton'
| 265355 [dblack rubyp] I'm feeling a little stupid, but where do you define Character#== ?
| 265358 [weather spea] class Character < Mind
| + 265363 [dblack rubyp] I'm afraid I can't reproduce the error, so I'm not sure where to start
| + 265367 [flori nixe.p] def ==(other)
+ 265227 [dzwell gmail] 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 segm] 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 wanadoo.] 0.upto(4) { |x| puts @people[x]}
|   + 265253 [sepp2k googl] Why do you feel that that's preferable to Stefano's solution?
|   | 265260 [djb wanadoo.] It's not. I mistakenly placed my reaction on the wrong leaf.
|   | 265265 [dblack rubyp] I'd avoid iterating through a whole array just to puts its elements,
|   + 265293 [phlip2005 gm] 5.times{ puts @people.shift }
|     265296 [bobgus rcn.c] puts @people[0..4].join("\n")
|     265313 [dblack rubyp] Assuming people don't end with "\n", that will have the same effect as
+ 265254 [fxn hashref.] 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 gmx.] puts(*@people.first(5))
| 265263 [dblack rubyp] I don't think you need the * there.
| 265266 [apeiros gmx.] Darn, and just when you say it is unsurprising you hit a surprising
+ 265257 [konrad tyler] protocol="application/pgp-signature";
| + 265258 [konrad tyler] protocol="application/pgp-signature";
| | 265271 [shortcutter ] Although I'm always fond of solutions using #inject in this case I'm
| | 265329 [flori nixe.p] puts_first_five = (0...5).inject(lambda {}) { |f, i| lambda { |a| f[a];
| + 265308 [Christopher.] require 'rio'
+ 265297 [james graypr] I see you got your answer, but I wanted to add that you can do the
+ 265318 [lists bertra] 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] V293LiAgSSBqdXN0IGxlYXJuZWQgc29tZXRoaW5nIG5ldy4gIEkgZGlkbid0IGtub3cgeW91IGNv
+ 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] if you need only to puts on screen you can use the solution of stefano, but

^ How Can I display XML file?
265251 [wzfg singtel] I have a XML string, such as xs="<?xml version='1.0' ?><testh><test1
+ 265252 [wzfg singtel] 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 yah] 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 gmai] 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 ruby-la] 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 gma] irb(main):035:0> "/foo/foo.gif".split("/")[-1]
+ 265279 [phrogz mac.c] irb(main):001:0> s = "/foo/bar/whee.gif"
| 265282 [dipesh_bathe] Thanks Gavin that really helped.
+ 265287 [o.renaud lap] You can also use a dedicated lib, for manipulating filenames : pathname