397075-412515

396881-414794 subjects 397231-398881

Question re class instance variable anomaly
397075 [rubyhacker@g] I was *certain* I had done this sort of thing before -- can someone
397076 [lists@ru y- ] You're setting @bar in the wrong context. You make @bar an instance
397082 [rubyhacker@g] Of course! Thank you.

ANN: Sequel 3.37.0 Released
397084 [lists@ru y- ] Sequel is a lightweight database access toolkit for Ruby.

Another random idea -- "break" at toplevel
397087 [rubyhacker@g] There have been times that I wanted to just skip to the bottom of
+ 397089 [whitequark@w] Well, this is pretty easy to implement and, I admit, somewhat logical.
+ 397100 [shortcutter@] It is not entirely clear to me what "bottom" actually means.  For
+ 397169 [lists@ru y- ] module Kernel

Using binding + set_trace_func to capture execution state
397093 [lists@ru y- ] callgraph trace of a program and at the same time will allow you to
+ 397097 [whitequark@w] Oh, it's very simple. The `binding' object denotes the variable scope.
| 397103 [matma.rex@gm] Have you tried somehow using continuations?
| 397127 [whitequark@w] A continuation is basically a copy of the current call stack, somewhat
+ 399163 [lists@ru y- ] Reginald,
| 399173 [shortcutter@] You could throw out a prompt.  Maybe IRB can help you with that.  But
+ 399194 [lists@ru y- ] I'm trying to avoid stepping through the code line by line. I'd like to
  + 399211 [shortcutter@] Thank you for the elaborate answer.  I need to muse a bit about this.
  + 399212 [ryand-ruby@z] You make me want to add "should"-level assertions in minitest. ;)

Re: Using binding + set trace func to capture execution state
397098 [lists@ru y- ] Hmm, you're right, it would not be efficient at all to store all those
397099 [shortcutter@] Especially since you would have to store the complete graph of objects
397109 [lists@ru y- ] as just inserting a puts statement in the code or putting logger debug
397111 [shortcutter@] Sort of, just a tad smarter.
397123 [lists@ru y- ] Sure. I want to create a tool that allows me to quickly be familiar with
397139 [lists@ru y- ] ...
397147 [matma.rex@gm] You can use the `local_variables` method to get a list of local
397150 [shortcutter@] That still suffers from the issue of changes in referenced object
397257 [alex@st nk .] behavior of printing stack traces when you hit ctrl-backslash. (The

Remove vowels from a string
397110 [lists@ru y- ] I'm trying to make a program that removes all the vowels in a string
+ 397112 [tony.arcieri] Try str.gsub(/[aeiou]/i, '')
+ 397114 [lists@ru y- ] str.delete 'aeiouAEIOU'
+ 397116 [matma.rex@gm] Tony is right that it's a better solution, but let's try figuring out

Copying Files
397115 [lists@ru y- ] I'm very new to this, but here goes. I need to copy files from one place
+ 397117 [lists@ru y- ] Of course you don't have to write down every file separately. Then the
| 397118 [lists@ru y- ] Thanks for the your help, it works great. I was using backslashes first
| 397130 [ryand-ruby@z] You want to `ri Enumerable.reject`
| 397149 [lists@ru y- ] How do I use that? I can't find any examples
| 397152 [lists@ru y- ] You use it to reject all elements from an Enumerable for which the block
| 397153 [lists@ru y- ] What needs to be changed with the following?
| 397154 [lists@ru y- ] You've used slashes in original_path and backslashes in ignore_folder.
| 397155 [lists@ru y- ] Still doesn't work :(
| 397156 [lists@ru y- ] What doesn't work? If no file is copied, then it's simply because
| 397157 [lists@ru y- ] require 'fileutils'
| + 397158 [jgabrielygal] FileUtils.copy copy_files, target_path
| | 397160 [lists@ru y- ] Thanks!
| + 397159 [lists@ru y- ] Leave out the trailing slash in 'D:/Stuff/Ruby/', it will lead to a
+ 397128 [code@ap th o] MS Windows does directory expansion at the command line -- right?  You
+ 397161 [lists@ru y- ] One more thing - can I specify more than one path to ignore?
  397163 [lists@ru y- ] Supply an array for ignore_folders and use Enumerable#any? to check if

ruby linux tproxy and routing bgp\ospf\others
397119 [eliezer@ng e] i was wondering if there is a way in ruby to handle linux netfilter
397190 [lists@ru y- ] interest in open-sourcing it at some point, but I don't think they have
397242 [eliezer@ng e] thanks.
397261 [lists@ru y- ] manipulating the interface and routing tables.
397313 [eliezer@ng e] well i will see what is going on..

passing ARGV to class methods
397122 [lists@ru y- ] I have been writing command-line programs using a pattern similar to
+ 397124 [lists@ru y- ] You don't have to pass the ARGV to the initialize method, but I'd do it
| 397135 [lists@ru y- ] Thanks for the reply Jan. I agree that passing arguments explicitly
| 397193 [shortcutter@] Definitively.  BUT: I would not place command line parsing inside the
+ 397125 [josh.cheek@g] It kind of depends on the scope of what you're doing. Is it a small one
  397136 [lists@ru y- ] Thanks for the suggestions Josh.

Newbie needs help with parsing a file
397126 [lists@ru y- ] /vol/dept115345K111455K/vol/home1156668K507768K...ad finitum.
397133 [ixti@me be .] str =3D "/vol/dept115345K111455K/vol/home1156668K507768K"
397138 [ryand-ruby@z] There are many tools in the String toolbox. #scan is often a much more =
+ 397151 [ixti@me be .] Oh, man! You're absolutely right. I guess I need to avoid next time
+ 397217 [lists@ru y- ] Ryan this worked beautifully.  Thank you.  However, I can't seem to get
  397218 [jgabrielygal] They are placeholders. Check

if x.condition, set x to y
397129 [lists@ru y- ] if actor_data['biography'].empty?
+ 397131 [whitequark@w] if actor_data['biography'].nil?
+ 397132 [lists@ru y- ] Peter, that's exactly what I was looking for. Much appreciated.
+ 397134 [ryand-ruby@z] Welcome
| 397137 [sduncan@we a] Or you could do;
| 397144 [shortcutter@] Only that this won't work if actor_data is a Hash without default
| 397394 [lists@ru y- ] I like your approach Robert, it would work particularly well for my use
+ 397148 [lists@ru y- ] You should know though, that "||=" doesn't really work with booleans. A

ARGF: No switch to STDIN after all files?
397140 [lists@ru y- ] I've started learning Ruby and trying to do the first (stupid) program
397143 [shortcutter@] ARGF switches to $stdin only if ARGV is empty *initially*, i.e. when
397162 [lists@ru y- ] That's exactly what I want, thanks a lot! :)

[ANN] ruby_parser 3.0.0.a3 Released
397141 [ryand-ruby@z] ruby_parser version 3.0.0.a3 has been released!

Ruby yaml custom domain type does not keep class
397142 [lists@ru y- ] 0 down vote favorite

Ruby for LDAP access?
397145 [lists@ru y- ] In our company the desktop computers are running primarily Windows, the
+ 397194 [zettabyte@gm] First I've just got a tangent/gripe, but when I first looked for a library
+ 397361 [lists@ru y- ] I was hoping for more opinions on this topic. Surely, many more forum

[C exten] issue with rb_barrier_wait() when running within a Thread.new { }
397164 [ibc@al ax ne] It works perfectly but I've realized of a case in which it gets
397264 [ibc@al ax ne] I've fixed this issue by replacing rb_barrier with rb_mutex at C level.

Green threads in 1.9.* ?
397165 [lists@ru y- ] I am new to Ruby.  I am somewhat surprised that I was not able to find
+ 397167 [lists@ru y- ] As far as I understand, Ruby 1.9 has native threads, but they're blocked
| 397168 [fxn@ha hr f.] ...
| 397170 [lists@ru y- ] Are you saying that green threads are used regardless of what is
| + 397171 [lists@ru y- ] This looks like a mistake. Ruby 1.8 has green threads, Ruby 1.9 and
| + 397172 [fxn@ha hr f.] I don't know enough to give a definitive answer (or plainly put, to
|   397197 [tony.arcieri] MRI is still doing the scheduling in 1.9. It runs a timer thread that
|   397243 [drbrain@se m] and JRuby. One-to-one. In the case of MRI there's a GIL. I guess =
|   + 397244 [jos@ca no k.] This would make a good FAQ entry, I think. Thanks, Eric.
|   + 397249 [lists@ru y- ] What is a ruby thread?  A green thread?  A kernel thread?  A green
|     397304 [drbrain@se m] For these answers I am ignoring Windows.  You can probably treat "POSIX =
+ 397173 [lists@ru y- ] If jacques1 is right, then there are no green threads, just kernel
| 397174 [whitequark@w] Ruby 1.9 uses kernel threads and does not have green threads.
| + 397175 [fxn@ha hr f.] Ruby 1.9 uses kernel threads and does not have green threads.
| | 397176 [whitequark@w] The OP's problem is not the scheduler itself but the associated system
| | 397177 [fxn@ha hr f.] Looks so also to me, but Ilya's post makes that clear (and it is a known
| + 397180 [lists@ru y- ] Well, for the purposes here, if Ruby's threads were green threads, yes
|   397182 [lists@ru y- ] Ruby 1.8 *has* green threads. It's explained in Xavier's link, and I
|   397183 [lists@ru y- ] The title of this post is "green threads in 1.9.* ?"  Furthermore, I
|   397195 [matthew@ke w] Couldn't. Unless your level of caring is greater than your minimum. Or
|   397290 [alex@st nk .] One small step would be to stop (gently) mocking people for using
+ 397178 [lists@ru y- ] You could try to emulate green threads using a native thread pool +
+ 397179 [lists@ru y- ] Posted via http://www.ruby-forum.com/.
+ 397196 [tony.arcieri] If you want to use 1.9, you're out of luck. That said, you aren't stating
+ 397224 [lists@ru y- ] <<There are definitely many reasons to prefer native threads over green
| 397227 [tony.arcieri] You want threads as a way to silently swallow exceptions? o_O I'm going to
| + 397229 [flo@an er gr] ...
| | 397230 [tony.arcieri] Fibers are pinned to the threads they are created in and cannot be resumed
| + 397232 [lists@ru y- ] 1.  Tell that to Erlangers.
|   397234 [tony.arcieri] Whenever an OTP process (e.g. gen_server, gen_event) crashes, the reason
|   397239 [lists@ru y- ] 1. I have proposed no system.  I have stated that I'd like to use green
|   397251 [tony.arcieri] Your suggested use case for green threads was firing off background jobs
|   + 397252 [tony.arcieri] I'd also like to reiterate that Erlang is doing the right thing here and
|   | 397254 [lists@ru y- ] If you are saying that there never has been nor never will be a use case
|   + 397253 [lists@ru y- ] I'm not sure if you are someone with reading-comprehension issues, or a
|     397256 [tony.arcieri] So in other words, you don't have a use case for green threads
|     397260 [ryand-ruby@z] with
|     397267 [shortcutter@] I think the point is, that as long as we do not know rex's real use
|     397269 [lists@ru y- ] *Sigh*.  I did not provide a "solution I want to use."  I provided a
|     + 397272 [jam@ja an be] Hey Rex,
|     | 397276 [billpaulson@] Perhaps this discussion would proceed more smoothly if we defined what's meant by a "green" thread, or avoided the term. Ruby programmers usually use the term "green threads" to mean implementations of Ruby's Thread class where the scheduling doesn't use OS support. These threads are otherwise middle-weight, akin to a Linux pthread. The expected use-case for Ruby Thread objects would usually have only a smallish number of objects, often approximating the number of cores in a server. For this sort of model, moving to an OS supported thread means that multicore parallelism is easier to achieve.
|     | 397281 [lists@ru y- ] Very helpful.  Indeed, the green threads I was thinking of were a
|     + 397289 [tony.arcieri] on it anywhere that I'm aware of... except perhaps here I guess.
|     | 397322 [lists@ru y- ] Perhaps it depends on the definition of what is "major."  I won't get
|     | 397340 [tony.arcieri] It's more like Smalltalk VMs used to be state-of-the-art decades ago. Sun
|     | 397347 [lists@ru y- ] I am using the terms I see in the literature, and in the links provided
|     | + 397363 [tony.arcieri] Erlang processes have separate heaps and are independently garbage
|     | | + 397365 [lists@ru y- ] Ah!  I'll take your word for this, and assume my Erlang distribution
|     | | + 397388 [sduncan@we a] ...
|     | + 397366 [wyhaines@gm ] And here is, I think, the crux of the cross communication.
|     + 397385 [shortcutter@] I am sorry, but you are wrong: I am not referring to that example.
|       397390 [lists@ru y- ] What I'm wondering now (and someone who knows is welcome to answer) is
|       397391 [shortcutter@] Just as clarification: my definition of a "green thread" includes a
|       397395 [lists@ru y- ] I believe I have definitive answers now - thanks.
+ 397241 [lists@ru y- ] rex, why are you still here? You don't want to tell your actual reasons
+ 397247 [normalperson] You could try linking Ruby with GNU pth (or GNU nPth).  I think pth

Strange error with net-scp gem installation
397166 [lists@ru y- ] I'm using backup gem to doing some stuff but this gem requires net-scp

Splitting assets in two and what to call them?
397181 [transfire@gm] ...
397192 [shortcutter@] Funny, when reading the article it occurred to me that you actually
397220 [transfire@gm] ...

Compute the lexicographically next bit permutation
397184 [lists@ru y- ] Compute the lexicographically next bit permutation
397189 [lists@ru y- ] Ruby has all the bit operators, so you can actually copy the code. You
397191 [lists@ru y- ] Ignore this, I was wrong.
397273 [lists@ru y- ] Posted via http://www.ruby-forum.com/.
397274 [lists@ru y- ] def next_pattern pattern

Insert letters of the alphabet between the original letters of a string
397185 [lists@ru y- ] What I seek to realize is that having a particular string, I insert
+ 397186 [lists@ru y- ] "STRING".each_char.zip(("A".."Z").cycle).join[0..-2]
| 397203 [ruby-talk@la] I prefer String#chars to String#each_char when not passing a block,
+ 397188 [lists@ru y- ] What's "cad"? It isn't defined anywhere.
+ 397199 [botpena@gm i] try eg,
| 397200 [botpena@gm i] somehow, this seems readable and easy to type,
+ 397201 [list.push@gm] I'm surprised no one tried something like this.
+ 397211 [lists@ru y- ] Posted via http://www.ruby-forum.com/.
  + 397212 [botpena@gm i] best regards -botp
  + 397225 [list.push@gm] zip is available for 1.8

the best way to match these domains.
397198 [eliezer@ng e] thanks in advance i need a bit help to break the ice that my head is in.
397202 [shortcutter@] Ah, interesting!
397245 [eliezer@ng e] i have used greasyspoon as icap server but it's too much for my needs.
397258 [shortcutter@] That sounds fun!
397316 [eliezer@ng e] <SNIP>
397415 [shortcutter@] There's probably so much that can be said to all of them but I am
397464 [eliezer@ng e] Thanks Robert,
+ 397467 [jgabrielygal] If you are not really using the relational part of a RDBMS, and you
| 397470 [eliezer@ng e] does it support indexing?reverse indexing?
| 397475 [jgabrielygal] It's basically a key - value data store, in which the value can be a
| 397481 [eliezer@ng e] <SNIP>
| 397498 [jgabrielygal] Glad to hear that.
| 397509 [eliezer@ng e] <SNIP>
| 397512 [shortcutter@] That is impossible.  You can reduce by hundred percent at most.
+ 397511 [shortcutter@] Well, I did not necessarily mean that you need to do it with another
  397513 [eliezer@ng e] well it is an open-source project at: https://github.com/elico/echelon
  397520 [shortcutter@] Please trim your quotes to contain only that part you are actually referring to.
  397529 [eliezer@ng e] <SNIP>

handle options not used together using optparse
397204 [lists@ru y- ] How to handle options that could not be used together using optparse? Is
397209 [shortcutter@] I don't think so.  You have to check that manually.

question: p expression
397205 [lists@ru y- ] Lately I have been going through some Ruby books and I keep coming up on
+ 397206 [ruby-talk@la] [1] pry(main)> method(:p)
| 397219 [lists@ru y- ] Not very useful :P
+ 397207 [shortcutter@] Try "ri p" instead or http://rdoc.info/stdlib/core/frames
+ 397208 [lists@ru y- ] So are the following two statements equivalent?
| 397215 [matma.rex@gm] Basically, yes.
| 397301 [alex@st nk .] see also
+ 397349 [lists@ru y- ] I did not know that people were still commenting this topic..
  397386 [shortcutter@] While I generally sympathize with that approach (making things
  397387 [matthew@ke w] Not to mention the convenience (with a single extra require) of

[ANN] RubyInline 3.11.3 Released
397210 [ryand-ruby@z] RubyInline version 3.11.3 has been released!

self.clone.replace(super)?
397213 [lists@ru y- ] class RegexAlternation < Array
397214 [shortcutter@] These super class methods will return Array instances but the author
+ 397216 [lists@ru y- ] Thanks. It makes sense now.
+ 397221 [transfire@gm] ...
  397226 [shortcutter@] I think one of the reasons is that you do not know how the sub class

[ANN] test-unit 2.5.1
397222 [kou@co mi ng] test-unit 2.5.1 has been released.

[ANN] test-unit-rails 1.0.2
397223 [kou@co mi ng] test-unit-rails 1.0.2 had been released!

Unable to do the barcode scanning for windows mobile platform
397228 [lists@ru y- ] I am trying to do barcode scanning from the sample api given in
+ 397233 [jam@ja an be] Hey santosh,
| 397263 [lists@ru y- ] Thanx for the response Jams. Could you please provide me any link or any
| 397271 [jam@ja an be] A quick search on google showed there's a google groups posting that deals w=
+ 410669 [lists@ru y- ] Posted via http://www.ruby-forum.com/.
+ 412515 [lists@ru y- ] i use this guide for barcode reader to make it succeed
threads.html
top