#ruby - 22 November 2018
« Back 1 day Forward 1 day »
[02:41:08] dedavaic898: Hi everyone, first time here, is this a good place to ask a Ruby programming help question?
[02:43:56] dedavaic898: bambanx, thank you, I'm new to multi-threading on Ruby and need some help with a bit of code
[03:09:13] dedavaic898: I need to have 2 threads that sort through the same array, with Thread 1 selecting and printing elements satisfying some condition, while Thread 2 prints the opposite (elements that fail the same condition). For example, imagine an array of letters `('a'..'z').to_a`, where the first thread prints only the vowels, while the 2nd thread prints only the consonants.
[03:09:21] dedavaic898: I'd like to also synchronize the threads so that the elements (letters) are printed in the same order as the array (i.e. "a" -> "b" -> ... -> "z")
[03:10:28] dedavaic898: I'm not sure how to approach this. Do I create two threads that call the selection method on the array? Do I loop through the array elements and call the thread within the loop?
[03:29:48] dymk: E.g., can I pack an array of pairs of (byte, BER encoded number), and unpack it with something like my_arr.pack("Cw*")
[05:21:49] chris349: I install RVM which installs the latest ruby version automaticall. Then I install the version I need and uninstall the one RVM initially installed
[10:56:44] tuor: hi, I did configure rvm and change my terminal to use bash --login instead of bash. But I can't change how my IDE RubyMine invokes bash. In my terminal rvm is working just right but in my IDE I'm getting a warning:
[10:56:57] tuor: Warning! PATH is not properly set up, /home/aaron/.rvm/gems/ruby-2.5.1/bin is not at first place.
[18:42:56] havenwood: bobdobbs: Many folk these days use chruby, but rbenv is still popular as well.
[21:28:41] Iambchop: bobdobbs: you have ruby-build installed as an rbenv plugin via git? update it to get the latest version defs: cd "$(rbenv root)"/plugins/ruby-build && git pull