« Back to channel list

#ruby - 15 June 2017

« Back 1 day Forward 1 day »
[00:02:06] Rodya_: has joined #ruby
[00:04:11] kgzm: has joined #ruby
[00:08:29] QpQ4: has joined #ruby
[00:08:46] haylon: has joined #ruby
[00:12:14] AndBobsYourUncle: has joined #ruby
[00:14:34] devyn: has joined #ruby
[00:22:32] duderonomy: has joined #ruby
[00:23:01] ghermit: has joined #ruby
[00:23:23] ghermit: has left #ruby: ()
[00:35:20] marxarelli: has joined #ruby
[00:35:57] mtkd: has joined #ruby
[00:41:07] Rodya_: has joined #ruby
[00:43:56] bauruine: has joined #ruby
[00:45:27] lupine: has joined #ruby
[00:48:35] mathys: has joined #ruby
[00:50:35] nofxx: has joined #ruby
[00:51:21] s2013: has joined #ruby
[00:51:37] mjuszczak: has joined #ruby
[00:53:18] lupine: has joined #ruby
[00:55:58] poloych: has joined #ruby
[00:56:52] TomyLobo: has joined #ruby
[01:01:29] Guest69: has joined #ruby
[01:01:50] rexb0t: has joined #ruby
[01:02:33] railswebdev: has joined #ruby
[01:08:59] brent__: has joined #ruby
[01:11:15] GinoMan: has joined #ruby
[01:15:04] Puffball: has joined #ruby
[01:20:22] nankyokusei: has joined #ruby
[01:24:59] biox: Hi all! I have a homework assignment: Create a ruby script that takes a huge file (20GB) that contains a number on each line. Supply two arguments: filename and N. Output should be the N largest numbers as specified by the user. Here is what I've come up with so far: https://hastebin.com/basefojoji.vbs - I think it works, but it seems to be unbearably slow. Any advice or direction would be appreciated.
[01:28:03] biox: It's been hanging for awhile, I'm not sure if the excessive array sorting is causing it to process slowly or if there is a mistake somewhere in my code.
[01:32:45] Rr4sT: has joined #ruby
[01:40:49] nesoi: has joined #ruby
[01:41:55] hutch34: has joined #ruby
[01:42:15] Jameser: has joined #ruby
[01:43:18] d^sh: has joined #ruby
[01:48:11] bauruine: has joined #ruby
[01:48:17] uZiel: has joined #ruby
[01:49:13] ascarter: has joined #ruby
[01:53:32] eightlimbed: has joined #ruby
[01:53:56] ecuanaso: has joined #ruby
[01:54:07] TinkerTyper: has joined #ruby
[01:56:46] MarkBilk_: has joined #ruby
[01:57:13] ascarter: has joined #ruby
[02:00:10] mim1k: has joined #ruby
[02:02:51] d^sh: has joined #ruby
[02:03:45] uZiel: has joined #ruby
[02:03:59] enterprisey: has joined #ruby
[02:04:00] Jameser`: has joined #ruby
[02:07:25] gothicsouth: has joined #ruby
[02:09:54] Guest69: has joined #ruby
[02:09:58] ascarter: has joined #ruby
[02:11:35] minimalism: has joined #ruby
[02:11:50] lostapathy: biox good luck with the homework. Suggest you add some puts debugging inside the loop to see what's going on and what progress is happening
[02:11:57] railswebdev: has joined #ruby
[02:14:14] charliesome: has joined #ruby
[02:14:26] latemus: has joined #ruby
[02:15:28] poloych: has joined #ruby
[02:17:16] Xakotu: has joined #ruby
[02:20:24] genpaku: has joined #ruby
[02:28:36] Mia: has joined #ruby
[02:28:36] Mia: has joined #ruby
[02:28:41] MarkBilk__: has joined #ruby
[02:29:00] __Yiota: has joined #ruby
[02:31:54] jrafanie: has joined #ruby
[02:34:39] AnoHito: has joined #ruby
[02:35:15] Demo318: has joined #ruby
[02:36:11] Demo318: Testing, 123, is this thing on?
[02:37:50] Demo318: has joined #ruby
[02:38:40] Demo318: has joined #ruby
[02:39:30] Ropeney: has joined #ruby
[02:41:57] eightlimbed: has joined #ruby
[02:42:31] biox: lostapathy: thank you. I got the code working eventually as you can see here: https://github.com/jessebolson/examplescripts
[02:42:57] biox: But the problem is that it takes 30 minutes to process a 16GB file, which seems absurd to me.
[02:44:51] biox: It looks like I may be using readlines, and switching to a different kind of loop might make processing faster. But I cannot understand why a simple sort | tail in bash is orders of magnitude faster than my method
[02:52:26] d^sh: has joined #ruby
[02:53:09] darix: biox: .each_line might be more efficient
[02:53:15] johnzorn: has joined #ruby
[02:58:17] biox: darix: I think that's what I'm doing? f.each_line do |line|
[02:58:55] biox: but I think my problem is that I'm making an array, doing a size comparison against it, and dropping the last value on every single line in the file, which I assume makes it slow.
[02:59:40] biox: https://github.com/jessebolson/examplescripts/blob/master/file-reader.rb line 10 is causing my problem I think, but I can't think of a better way to chunk through a file.
[03:00:14] moei: has joined #ruby
[03:02:10] AnoHito_: has joined #ruby
[03:05:19] empty_cup: has joined #ruby
[03:06:47] arescorpio: has joined #ruby
[03:09:19] __Yiota: has joined #ruby
[03:09:37] ascarter: has joined #ruby
[03:11:40] empty_cup: minitest::expectations which comes with ruby handles most test cases but now the example of mocking File.open is of interest.
[03:11:43] lel: has joined #ruby
[03:13:12] empty_cup: rspec/mocks appears to have an elegant style of mocking method calls. is rspec that much different than what is currently written?
[03:15:41] kies: has joined #ruby
[03:16:12] gothicsouth: has joined #ruby
[03:16:47] Demo318: has joined #ruby
[03:17:27] gix: has joined #ruby
[03:19:22] rohitpaulk: has joined #ruby
[03:19:23] alveric1: has joined #ruby
[03:21:13] empty_cup: after switching between the stdlib of more recent versions of ruby minitest is missing
[03:21:14] nankyokusei: has joined #ruby
[03:27:16] empty_cup: oh hm #9711
[03:29:14] bauruine: has joined #ruby
[03:34:07] astrobunny: has joined #ruby
[03:34:32] astrobunny: has joined #ruby
[03:35:17] patarr: has joined #ruby
[03:35:58] cyphase: has joined #ruby
[03:39:38] cyphase: has joined #ruby
[03:40:06] Guest69: has joined #ruby
[03:40:43] railswebdev: has joined #ruby
[03:43:36] solocshaw: has joined #ruby
[03:45:47] elifoster: has joined #ruby
[03:46:14] rohitpaulk: has joined #ruby
[03:46:37] alveric1: has joined #ruby
[03:51:14] _whitelogger: has joined #ruby
[03:53:47] nhhc: has joined #ruby
[03:56:06] alveric1: has joined #ruby
[03:57:13] nertzy: has joined #ruby
[04:00:36] mim1k: has joined #ruby
[04:02:32] contradictioned: has joined #ruby
[04:09:11] AnoHito: has joined #ruby
[04:17:53] bauruine: has joined #ruby
[04:20:32] webopsx: has joined #ruby
[04:24:33] nupizdets: has joined #ruby
[04:26:07] DeeJayh_: has joined #ruby
[04:26:26] cyphase: has joined #ruby
[04:30:30] cyphase: has joined #ruby
[04:31:06] AnoHito_: has joined #ruby
[04:33:52] Jameser: has joined #ruby
[04:46:35] charliesome: has joined #ruby
[04:57:36] harfangk: has joined #ruby
[05:04:25] blackwind_123: has joined #ruby
[05:07:17] Silthias: has joined #ruby
[05:10:24] LukyCZ: has joined #ruby
[05:15:17] LukyCZ: Hi guys, I've been learning Ruby for some time and still learning, but I ran out of ideas on what to write. Could you suggest me something long but easy ? Thanks
[05:15:41] Bock: has joined #ruby
[05:18:36] konsolebox: try long and difficult
[05:19:58] uZiel: has joined #ruby
[05:20:27] LukyCZ: Nah, I'm not that good to do "difficult"
[05:20:49] LukyCZ: I just want it to be fun
[05:22:05] nankyokusei: has joined #ruby
[05:23:24] Silthias: has joined #ruby
[05:25:40] konsolebox: LukyCZ: you like music? you can write a simple ruby cli that harvests a list of music pathnames from a file and play them randomly using an external cli player, like sox or mplayer. take note of https://ruby-doc.org/core-2.3.1/Kernel.html#method-i-exec.
[05:27:31] LukyCZ: Thanks, will look at it ;-)
[05:30:06] konsolebox: LukyCZ: sorry #exec needs forking. what you want is spawn. https://ruby-doc.org/core-2.3.1/Kernel.html#method-i-spawn
[05:30:46] enterprisey: has joined #ruby
[05:31:35] tastygradient: has joined #ruby
[05:33:38] konsolebox: LukyCZ: or better yet, use system (https://ruby-doc.org/core-2.3.1/Kernel.html#method-i-system) as it automatically waits the child process to finish for you.
[05:35:17] Silthias: has joined #ruby
[05:36:11] patarr: has joined #ruby
[05:37:02] brent__: has joined #ruby
[05:37:07] aupadhye: has joined #ruby
[05:38:30] aupadhye: has joined #ruby
[05:41:14] gothicsouth: has joined #ruby
[05:43:36] Silthias: has joined #ruby
[05:49:18] acalycine: has joined #ruby
[05:49:32] nesoi: has joined #ruby
[05:53:52] Silthias: has joined #ruby
[06:00:37] bruce_lee: has joined #ruby
[06:00:38] bruce_lee: has joined #ruby
[06:01:07] nicesignal: has joined #ruby
[06:01:09] mim1k: has joined #ruby
[06:01:13] anisha: has joined #ruby
[06:05:18] Silthias: has joined #ruby
[06:07:15] charliesome: has joined #ruby
[06:10:42] gigetoo: has joined #ruby
[06:11:53] N0ATN: has joined #ruby
[06:12:23] mahlon: has joined #ruby
[06:15:47] dionysus69: has joined #ruby
[06:17:12] Silthias: has joined #ruby
[06:20:10] Mortomes|Work: has joined #ruby
[06:22:35] Voxxit: has joined #ruby
[06:24:43] ^mtkd: has joined #ruby
[06:26:18] VladGh: has joined #ruby
[06:27:32] conta: has joined #ruby
[06:27:43] rgr: has joined #ruby
[06:30:09] tAn: has joined #ruby
[06:31:18] Olipro: has joined #ruby
[06:37:02] charliesome: has joined #ruby
[06:42:04] latemus: has joined #ruby
[06:48:17] Silthias: has joined #ruby
[06:49:11] AndBobsYourUncle: has joined #ruby
[06:52:00] dviola: has joined #ruby
[06:56:05] ruby-lang108: has joined #ruby
[06:57:06] burgestrand: has joined #ruby
[07:00:17] Silthias: has joined #ruby
[07:06:43] hutch34: has joined #ruby
[07:09:23] woodruffw: has joined #ruby
[07:09:23] woodruffw: has joined #ruby
[07:11:54] Silthias: has joined #ruby
[07:12:38] zenspider: no... minitest is NOT missing. god I'm getting tired of that BS
[07:12:55] TomyWork: has joined #ruby
[07:13:54] vifino: has joined #ruby
[07:15:43] Exagone313: has joined #ruby
[07:17:16] ddffg: has joined #ruby
[07:17:17] charliesome: has joined #ruby
[07:18:36] ionte: has joined #ruby
[07:21:51] Silthias: has joined #ruby
[07:22:56] nankyokusei: has joined #ruby
[07:27:35] acalycine: is it possible to convert JSON/hash to "application/x-www-form-urlencoded" with Net::HTTP?
[07:28:14] nofxx: has joined #ruby
[07:29:29] mark_66: has joined #ruby
[07:30:24] Silthias: has joined #ruby
[07:30:46] dminuoso: acalycine: URI.encode_www_form
[07:33:24] gigetoo: has joined #ruby
[07:34:43] glcx: has joined #ruby
[07:34:43] glcx: has joined #ruby
[07:35:23] aufi: has joined #ruby
[07:37:08] patarr: has joined #ruby
[07:42:43] Silthias: has joined #ruby
[07:44:00] xall: has joined #ruby
[07:44:37] nertzy: has joined #ruby
[07:47:08] Ferdroid: has joined #ruby
[07:48:24] antgel: has joined #ruby
[07:51:56] surrounder: has joined #ruby
[07:52:45] Silthias: has joined #ruby
[07:52:58] uZiel_: has joined #ruby
[07:59:38] mikecmpbll: has joined #ruby
[08:03:15] hs366: has joined #ruby
[08:03:52] jinie: has joined #ruby
[08:05:25] username1: has joined #ruby
[08:05:54] nofxx: has joined #ruby
[08:07:02] Dark_Arc: has joined #ruby
[08:08:04] hutch34: has joined #ruby
[08:13:03] joonty: has joined #ruby
[08:18:37] uZiel: has joined #ruby
[08:20:04] mim1k: has joined #ruby
[08:20:32] Silthias: has joined #ruby
[08:21:30] LightStalker: has joined #ruby
[08:21:59] tAn: has joined #ruby
[08:22:45] megan_: has joined #ruby
[08:23:17] megan_: I have a regex [A-Za-z]:\/\/(www\.)?[A-Za-z0-9] for my URL. But this allows white spaces sadly. How could I disallow white spaces here?
[08:24:07] matthewd: megan_: You probably want some anchors in there. And some repetitions.
[08:24:18] tobiasvl: that's not a good regex to match URLs
[08:24:30] tobiasvl: protocols can be longer than one letter, for example
[08:24:34] matthewd: megan_: Debug it by checking which part of your test string it's matching
[08:24:41] tobiasvl: http://rubular.com/
[08:25:01] megan_: Because I want a regex that also allows 'something://something/something' as an URL
[08:25:28] matthewd: http://rubular.com/r/Ffair26hVV
[08:25:35] tobiasvl: well right now you don't allow any slashes except the double slashes after protocol
[08:25:42] dviola: has joined #ruby
[08:26:20] matthewd: tobiasvl: Well, it allows anything after the first character of the hostname
[08:26:46] tobiasvl: megan_: spaces included. but you don't match on them. if you put a ^ at the beginning and an $ at the end it will be clearer
[08:27:03] tobiasvl: your regex can be in the middle of a string, with anything on either side
[08:27:21] elomatreb: \A and \z are probably what you want, ^/$ match lines, not the entire string
[08:28:10] megan_: Could you try and implement that in "[A-Za-z]:\/\/(www\.)?[A-Za-z0-9]"?
[08:28:16] megan_: Is that possible?
[08:28:45] mtkd: has joined #ruby
[08:28:49] elomatreb: You need to anchor your regex because it would otherwise match anywhere in a string, so "pnfigjdoifj http://a.cool/url asdfasd" would still match
[08:29:28] jenrzzz: has joined #ruby
[08:29:28] jenrzzz: has joined #ruby
[08:29:29] megan_: I really should learn regex a bit more :P
[08:30:23] workmad3: has joined #ruby
[08:30:45] jaruga_________: has joined #ruby
[08:32:15] elomatreb: Mh, how bad an idea would it be to use the interal regex used by the URI class for such validations? (https://github.com/ruby/ruby/blob/202bbda2bf5f25343e286099140fb9282880ecba/lib/uri/rfc3986_parser.rb#L6)
[08:32:15] matthewd: megan_: For this particular case, you may just want /\A#{URI.regexp}\z/
[08:32:31] jaruga_________: has joined #ruby
[08:36:08] biberu: has joined #ruby
[08:43:27] ferr1: has joined #ruby
[08:44:03] roshanavand: has joined #ruby
[08:44:24] sarbs: has joined #ruby
[08:45:18] lxsameer: has joined #ruby
[08:50:40] renchan: has joined #ruby
[08:51:35] rohitpaulk: has joined #ruby
[08:53:35] jinie: has joined #ruby
[08:54:03] quobo: has joined #ruby
[08:57:14] fxa90id: has joined #ruby
[08:59:47] ur5us: has joined #ruby
[09:01:58] whiteline: has joined #ruby
[09:04:00] dionysus69: has joined #ruby
[09:06:45] alfiemax: has joined #ruby
[09:07:10] alfiemax: can anyone help me with this error when trying to run bundler (using rvm ) in a rails app
[09:07:10] alfiemax: You must recompile Ruby with OpenSSL support or change the sources in your Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using RVM are available at
[09:08:10] PresidentBiscuit: has joined #ruby
[09:08:25] anisha_: has joined #ruby
[09:08:42] matthewd: alfiemax: You have an error that is describing what's wrong, and even giving you a URL that [it claims] will tell you how to fix it. What help do you need?
[09:09:00] alfiemax: tried all that...
[09:09:17] alfiemax: curious thing is the source in gemfile is http
[09:09:19] alfiemax: and not https
[09:11:16] zacts: has joined #ruby
[09:17:24] Beams: has joined #ruby
[09:18:44] rohitpaulk: has joined #ruby
[09:19:29] charliesome: has joined #ruby
[09:23:49] nankyokusei: has joined #ruby
[09:24:08] xall: has joined #ruby
[09:27:55] sepp2k: has joined #ruby
[09:30:20] ujjain: has joined #ruby
[09:30:20] ujjain: has joined #ruby
[09:37:32] brent__: has joined #ruby
[09:37:59] patarr: has joined #ruby
[09:40:28] JoshS: has joined #ruby
[09:40:55] Polysics: has joined #ruby
[09:42:12] mim1k: has joined #ruby
[09:45:25] sarbs: has joined #ruby
[09:47:46] burgestrand: has joined #ruby
[09:47:59] psychicist__: has joined #ruby
[09:48:11] Puffball: has joined #ruby
[09:48:45] anisha_: has joined #ruby
[09:49:11] bvcosta: has joined #ruby
[09:51:11] xall_: has joined #ruby
[09:51:19] cfec0b8d: has joined #ruby
[09:55:34] Terens: has joined #ruby
[09:55:50] Terens: should I use require in my gems or autoload ?
[09:59:47] elomatreb: Generally explicit requires are preferred
[10:00:01] dminuoso: Terens: But if you prefer, there's nothing inherently wrong with autoload
[10:00:25] xall_: has joined #ruby
[10:00:41] canton7: autoload was being discouraged a few years ago - mutterings of races, and it eventually being phased out. Has that changed?
[10:00:42] Terens: I eyeballed actioncable code and it was like 100% autoload thats why
[10:00:45] Terens: I am asking
[10:01:01] elomatreb: I've done %w[a lot of gems].each {|g| require g } if I had many gems
[10:01:06] elomatreb: Blurs the line a little
[10:01:14] Terens: https://github.com/rails/rails/blob/master/actioncable/lib/action_cable.rb
[10:02:10] Terens: or this https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/server.rb
[10:02:13] Terens: cadebostany
[10:02:31] apeiros: canton7: races have been eliminated, matz still doesn't like it and wants it out (have that on personal account)
[10:03:22] SaschaVoid: has joined #ruby
[10:03:44] canton7: cool, good to know thanks
[10:03:52] apeiros: I don't remember his reasoning, but iirc it was along the lines of having a fully loaded system early vs. never really knowing whether all is loaded yet (and what you can make if it when a system is fully loaded, probably wrt optimizations)
[10:05:02] nankyokusei: has joined #ruby
[10:06:47] joonty: has joined #ruby
[10:09:55] hutch34: has joined #ruby
[10:11:07] modin: has joined #ruby
[10:11:34] conta: has joined #ruby
[10:14:34] sleetdrop: has joined #ruby
[10:16:42] psychicist__: has joined #ruby
[10:27:29] xall: has joined #ruby
[10:28:59] xall: has joined #ruby
[10:32:11] nickjj: has joined #ruby
[10:33:42] mtkd: has joined #ruby
[10:35:51] patarr: has joined #ruby
[10:37:42] xall: has joined #ruby
[10:40:09] burgestrand: has joined #ruby
[10:40:18] im0nde: has joined #ruby
[10:42:01] Fernando-Basso: has joined #ruby
[10:43:27] Mia: has joined #ruby
[10:43:28] Mia: has joined #ruby
[10:47:26] astrobunny: has joined #ruby
[10:50:34] mim1k: has joined #ruby
[10:53:47] Puffball: has joined #ruby
[10:57:20] AnoHito: has joined #ruby
[10:57:32] cyphase: has joined #ruby
[11:02:37] catphish: has joined #ruby
[11:03:27] joonty: has joined #ruby
[11:07:05] mim1k: has joined #ruby
[11:07:32] gregf_: has joined #ruby
[11:09:38] Doow: has joined #ruby
[11:16:44] wnd: has joined #ruby
[11:21:49] duper: If I have an array of Hashes like { :name => 'abc', :value => 'xyz' } .. then how do I condense so there's only one entry for each :name and :value becomes Array#String (by combining all the strings for existing :name's) ?
[11:22:10] duper: almost sounds so easy that you'd think there would be an existing Hash or Array instance_method that does this
[11:23:58] burgestrand: has joined #ruby
[11:30:39] bvcosta: has joined #ruby
[11:30:41] ecuanaso: has joined #ruby
[11:31:32] hogetaro: has joined #ruby
[11:37:14] govg: has joined #ruby
[11:40:03] Silthias: has joined #ruby
[11:41:38] Terens: having a method def errback &block
[11:42:13] Terens: and use it like errback { code }
[11:42:22] Terens: how can I pass a method?
[11:42:50] Terens: def mymethod end then errback &:mymethod does nothing
[11:43:18] elomatreb: If you don't yield to the block or call it explicitely it won't be executed
[11:44:42] PresidentBiscuit: has joined #ruby
[11:46:35] whiteline: has joined #ruby
[11:50:12] burgestrand: Terens you can do `errback(&method(:mymethod))` or just do `errback { mymethod() }`
[11:51:38] Silthias1: has joined #ruby
[11:52:03] Terens: I did the second one lol
[11:53:22] burgestrand: has joined #ruby
[12:03:30] charliesome: has joined #ruby
[12:06:04] username1: has joined #ruby
[12:06:50] glcx: has joined #ruby
[12:06:50] glcx: has joined #ruby
[12:08:24] GinoMan: has joined #ruby
[12:08:36] synthroid: has joined #ruby
[12:10:56] helpa: has joined #ruby
[12:11:16] hutch34: has joined #ruby
[12:11:56] GinoMan2440: has joined #ruby
[12:13:04] nadir: has joined #ruby
[12:14:13] psychicist__: has joined #ruby
[12:14:35] Polysics_: has joined #ruby
[12:15:14] Asher: has joined #ruby
[12:16:44] jokke: i'm having trouble with activesupport
[12:16:55] jokke: undefined method `months' for Fixnum
[12:17:16] jokke: hours works
[12:18:08] nankyokusei: has joined #ruby
[12:20:42] catphish: jokke: http://guides.rubyonrails.org/active_support_core_extensions.html
[12:21:05] jokke: i've required 'active_support/core_ext/numeric/time'
[12:21:24] catphish: require 'active_support/core_ext' works for me
[12:21:56] catphish: active_support/core_ext/numeric/time does not
[12:22:24] catphish: i'd suggest you got the wrong file
[12:22:51] catphish: with that file i get minutes, but not months
[12:22:57] catphish: so there must be one for "date"
[12:23:06] jokke: activesupport/lib/active_support/core_ext/integer/time.rb
[12:23:21] jokke: there it's defined
[12:23:25] jokke: https://github.com/rails/rails/search?utf8=%E2%9C%93&q=def+months&type=
[12:23:40] gothicsouth: has joined #ruby
[12:24:04] catphish: so try that
[12:24:19] catphish: require 'active_support/core_ext/integer/time' wfm
[12:24:43] catphish: not the best layout
[12:25:07] jokke: i also don't see why it couldn't be defined for floats
[12:25:17] jokke: or rationals
[12:25:23] jokke: 1.5.months
[12:25:31] catphish: i guess nobody needed it :)
[12:26:06] bvcosta: has joined #ruby
[12:26:11] catphish: see also #rubyonrails
[12:26:12] doublemalt_: has joined #ruby
[12:26:27] Darcy: has joined #ruby
[12:26:58] rohitpaulk: has joined #ruby
[12:33:01] Guest68836: has joined #ruby
[12:33:17] im0nde: has joined #ruby
[12:36:51] brent__: has joined #ruby
[12:37:34] pandaant: has joined #ruby
[12:38:37] burgestrand: has joined #ruby
[12:39:38] bauruine: has joined #ruby
[12:42:09] pupsicle: has joined #ruby
[12:49:24] aenialis: has joined #ruby
[12:49:44] burgestrand: has joined #ruby
[12:50:46] gothicsouth: has joined #ruby
[12:54:51] joonty: has joined #ruby
[12:56:41] meshsmith: has joined #ruby
[12:57:48] MarkBilk_: has joined #ruby
[13:01:42] arup_r: has joined #ruby
[13:02:21] dc4: has joined #ruby
[13:02:48] mim1k: has joined #ruby
[13:05:17] Phanes: has joined #ruby
[13:07:43] ben_h: has joined #ruby
[13:08:03] Hunter1: has joined #ruby
[13:09:25] uZiel: has joined #ruby
[13:09:49] cdg: has joined #ruby
[13:13:43] jphase: has joined #ruby
[13:16:26] aenialis_: has joined #ruby
[13:19:22] __Yiota: has joined #ruby
[13:20:05] uZiel: has joined #ruby
[13:20:48] Spydar: has joined #ruby
[13:22:03] PatrikasZvaigzde: has joined #ruby
[13:23:00] Guest73007: has joined #ruby
[13:23:29] govg: has joined #ruby
[13:26:50] LyndsySimon: I know Ruby has the concept of "autoload", and that Rails has a similar concept and builds on it with "eager loading". I'm looking for a way to eager load all files in a directory, preferably without hooking into Rails' `config.eager_load_paths`, since I want it to happen even when Rails' eager loading is turned off (i.e., in local development).
[13:29:05] LyndsySimon: You know what? Scratch that. I was trying to strip out part of a complex problem I'm working on, and I think I just figured out a way to avoid it entirely.
[13:29:19] LyndsySimon: I'm still interested if someone has an answer, but it's not blocking me anymore :)
[13:32:16] Asher: has joined #ruby
[13:33:59] __Yiota: has joined #ruby
[13:40:21] burgestrand: has joined #ruby
[13:45:41] aenialis: has left #ruby: ("Good Bye")
[13:45:45] shinnya: has joined #ruby
[13:45:49] ledestin: has joined #ruby
[13:50:23] ur5us: has joined #ruby
[13:50:43] spectrum: has joined #ruby
[13:56:39] blackwind_123: has joined #ruby
[13:57:25] belmoussaoui: has joined #ruby
[13:58:53] al2o3-cr: has joined #ruby
[14:03:21] Archrover: has joined #ruby
[14:04:15] NickZA: has joined #ruby
[14:05:18] chouhoulis: has joined #ruby
[14:06:26] cout: has joined #ruby
[14:08:23] svkurowski: has joined #ruby
[14:11:11] Fernando-Basso: has joined #ruby
[14:12:53] hutch34: has joined #ruby
[14:17:51] jrafanie: has joined #ruby
[14:19:19] nankyokusei: has joined #ruby
[14:22:25] im0nde: has joined #ruby
[14:25:09] catphish: has left #ruby: ("Leaving")
[14:26:25] gizmore: has joined #ruby
[14:32:32] yeticry: has joined #ruby
[14:36:29] patarr: has joined #ruby
[14:39:55] theunraveler: has joined #ruby
[14:40:57] S007: has joined #ruby
[14:41:02] SpydarOO7: has left #ruby: ()
[14:41:33] ljarvis: LyndsySimon: isn't eager loading just requiring? -- it's a rails thing because it needs to bypass their lazy/auto loading functionality
[14:42:22] ljarvis: so just require all files in a directory and you'll have access to the contents
[14:43:26] ruby-lang559: has joined #ruby
[14:44:38] antgel: has joined #ruby
[14:45:43] Mia: has joined #ruby
[14:45:44] Mia: has joined #ruby
[14:45:58] grymmjack: has joined #ruby
[14:47:25] _mak_: has joined #ruby
[14:47:36] ytti: </win 20
[14:47:37] gothicsouth: has joined #ruby
[14:47:50] LyndsySimon: ljarvis: Is there any easier way to "require all files in a directory" other than enumerating them and building the require statements dynamically?
[14:51:07] gja: has joined #ruby
[14:52:06] muelleme: has joined #ruby
[14:52:07] quobo: has joined #ruby
[14:53:17] _mak_: is there a software pattern for this use case: I want to 'tag' entities based on the state of some properties, for example, if the entity is of the color red and size > 3 then I want to call it 'big_red'. Some other subsystem will be dealing with entities that are big_red. The question is: Should 'big_red' become a property of that entity or should 'big_red' be the return of a function called 'get_entity_tag()'? Where do we draw the line?
[14:54:26] rippa: has joined #ruby
[14:54:37] webopsx: has joined #ruby
[14:58:22] cschneid_: has joined #ruby
[14:58:45] cschneid_: has joined #ruby
[15:00:52] bauruine: has joined #ruby
[15:01:04] s2013: has joined #ruby
[15:03:44] mikecmpbll: has joined #ruby
[15:06:40] ljarvis: LyndsySimon: no, but it's only a one liner. How easier do you want it? :)
[15:07:24] LyndsySimon: ljarvis: You don't happen to have that one-liner handy, do you? My head is full of other context and I'd like at least document this.
[15:07:54] elomatreb: Dir["**/*.rb"].each {|f| require f } or something like that
[15:08:00] ljarvis: LyndsySimon: Dir["my/dir/*.rb"].each { |f| require f }
[15:08:10] LyndsySimon: Woot, thank s:)
[15:08:13] ljarvis: yes, elomatreb's example will go into subdirectories also
[15:08:27] elomatreb: Oh, misread that
[15:08:36] LyndsySimon: Ah, cool, it supports pattern matching then. Even better.
[15:09:17] ljarvis: ACTION waits for someone obtuse to offer each(&method(:require))
[15:09:42] hutch34: has joined #ruby
[15:09:57] elomatreb: Now I want to benchmark &method vs an explicit block
[15:10:45] cschneid_: has joined #ruby
[15:12:17] yeticry_: has joined #ruby
[15:13:02] Hunter1: has joined #ruby
[15:14:07] mim1k: has joined #ruby
[15:15:05] im0nde: has joined #ruby
[15:17:53] biox: Hello everyone. I have an assignment that requires me to: provide two inputs to a ruby file (filename and N). Assuming the file contains newline-separated integers, parse the file and print the largest N numbers. The filesize I'm operating against is very large (16GB) so I can't load it all in memory at once. To speed things up I'm trying to use the Parallel gem, but once I run the code all of the memory on my
[15:17:55] biox: machine (10+GB) is consumed. This is true even with a smaller filesize (100MB) so there must be something wrong with my code. Am I missing something? https://hastebin.com/wexipuhixi.vbs
[15:22:00] chalkmonster: has joined #ruby
[15:23:42] Ropeney: biox, is it the same if you don't sort?
[15:24:33] biox: ropeney: it is. In fact it's the same if all I do nothing inside of the parallel block
[15:24:55] biox: so my guess is that Parallel creates a thread from each line first, then fires off the workers or something.
[15:24:57] lostapathy: biox I thought you had this sorted out yesterday?
[15:25:12] Ropeney: I think line isn't being collected by the GC
[15:25:38] biox: lostapathy: I got it working without parallel operations, I'm trying to make it faster now - running into this new problem
[15:26:28] biox: ropeney: How could I test something like that? The extent of my debugging currently is running stuff in IRB/puts'ing variables, but those methods don't apply here
[15:26:59] aenialis: has joined #ruby
[15:27:05] Ropeney: You can look if the Object Ref count keeps climbing
[15:27:53] ascarter: has joined #ruby
[15:28:01] biox: ropeney: in my case it sounds like that would be array.reference_count or line.reference_count
[15:28:41] Ropeney: I'm not too sure if that's the case, as they should be dangling references at each reference, waiting to be GC'd
[15:28:52] Ropeney: at each iteration*
[15:29:08] enterprisey: has joined #ruby
[15:30:47] Ropeney: biox, watching `GC.stat` might give you some indication if it's the right path.
[15:31:23] __Yiota: has joined #ruby
[15:33:37] biox: ropeney: Okay great, I will give this a test and get back to you.
[15:37:50] brent__: has joined #ruby
[15:38:10] rohitpaulk: has joined #ruby
[15:38:31] hobodave: has joined #ruby
[15:38:37] haylon: has joined #ruby
[15:38:48] texasmynsted: has joined #ruby
[15:39:28] __Yiota: has joined #ruby
[15:48:45] ledestin: has joined #ruby
[15:50:22] matthewd: biox: If you're memory constrained, doing several things in parallel seems unlikely to improve your situation
[15:50:52] MarkBilk: has joined #ruby
[15:51:11] ur5us: has joined #ruby
[15:55:11] marxarelli: has joined #ruby
[15:56:34] biox: matthewd: While I can't load the huge file into memory all at once, I figured that I could chop it up using parallel threads. The original version of my program used maybe 1GB of memory for a 16GB file. With parallelism, 16GB of memory is consumed completely by a 100MB file. To me this is indicative of a different problem.
[15:57:01] biox: (The original version of my program being single-threaded, and ran at 100% of 1 core)
[15:57:32] Ropeney: 16GB for the 100mb file? :\
[15:58:22] synthroid: has joined #ruby
[15:58:33] biox: that's right
[15:58:48] biox: it consumed all 16GB of memory on my local system trying to run against a 100MB file. :/
[15:59:09] Ropeney: maybe try a diff gem
[15:59:10] Ropeney: https://github.com/ruby-concurrency/concurrent-ruby ?
[15:59:12] matthewd: biox: You're obviously free to do whatever you like; I can only strongly suggest that you're going down the wrong path
[15:59:27] biox: matthewd: What path would you recommend if I wanted to improve performance?
[15:59:32] biox: I mean without using GNU sort ;)
[15:59:51] matthewd: Think about what's happening inside the loop [of the non-parallel version]
[16:00:22] matthewd: That loop gets executed for every row in the source file, and there are a lot of those, so it would be advisable to minimize the amount of work therein
[16:01:56] gothicsouth: has joined #ruby
[16:03:27] hosttor: has joined #ruby
[16:03:34] biox: matthewd: Inside of the loop I take each line and toss it into an array. Since I don't have the memory available to toss everything into the array at once my thought was I would periodically sort and trim the array if it grew over a certain size. I found that increasing this size could improve performance slightly, but not greatly (degrading performance at around 10,000,000 array items). Otherwise I can't think
[16:03:36] biox: of a step I can trim out of the process.
[16:04:31] biox: Oh wait, what if I just threw out numbers lesser than array[9] instead of having to sort them
[16:05:05] texasmynsted: has left #ruby: ()
[16:07:09] BTRE: has joined #ruby
[16:07:24] uZiel: has joined #ruby
[16:07:49] matthewd: That does sound like less work
[16:08:56] biox: Huh, I overlooked the heck out of that. One sec, I'll get back to you guys - I'll put a hold on the parallel idea.
[16:09:52] username: has joined #ruby
[16:11:17] Ropeney: lol, I was fixated on why you're using so much memory; not how to avoid it all together :(
[16:11:18] yehowyada: has joined #ruby
[16:13:46] TomyLobo: has joined #ruby
[16:14:45] gdonald: has joined #ruby
[16:15:57] PaulCapestany: has joined #ruby
[16:16:50] gusrub: has joined #ruby
[16:18:15] dc4: has joined #ruby
[16:18:27] pupsicle: has joined #ruby
[16:19:06] __Yiota: has joined #ruby
[16:19:38] skweek: has joined #ruby
[16:21:04] biox: So I came up with this, which looks to process about 500MB in 30s: https://hastebin.com/okokezamuf.vbs
[16:21:52] biox: I don't think that I can make the comparison any more efficient than if (number is smaller than the smallest number in the array) then do nothing
[16:22:49] mim1k: has joined #ruby
[16:23:00] psychicist__: has joined #ruby
[16:24:49] matthewd: Yeah, that's sounding better. You could probably get slightly more out of the inner part, but bounded memory + a sane execution time sound like a fair improvement as is.
[16:25:39] SeepingN: has joined #ruby
[16:27:14] PatrikasZvaigzde: has joined #ruby
[16:27:52] centrx: has joined #ruby
[16:27:52] centrx: has joined #ruby
[16:28:08] ecuanaso: has joined #ruby
[16:28:09] elifoster: has joined #ruby
[16:29:20] cadillac__: has joined #ruby
[16:31:21] synthroid: has joined #ruby
[16:34:58] plujon: has joined #ruby
[16:35:39] bvcosta: has joined #ruby
[16:40:11] unreal: has joined #ruby
[16:40:26] biox: matthewd: given that this is already quite fast, wouldn't it make sense to make the process parallel at this point? the memory would still be bounded (I think) and four-cores could result in a significant improvement over a single core if I'm thinking about this correctly.
[16:40:32] creshiem: has joined #ruby
[16:40:43] nitric: has joined #ruby
[16:41:10] biox: I mean clearly Ruby isn't the right tool for doing this quickly, I just want to see what it can do. :)
[16:41:25] Ropeney: I don't think you'll get anything from parallel
[16:41:38] Ropeney: your mutexes are going to prevent most
[16:42:38] Ropeney: if you go down parallel, split it in 4 with 4 different complete arrays. Then merge at end :)
[16:42:47] Ropeney: so your inner loops aren't sharing a single array.
[16:42:58] matthewd: biox: The challenge I'd anticipate is in usefully parallelizing the work... it should now be mostly I/O
[16:44:00] matthewd: I guess you could divide the whole file into chunks, then scan each of those in parallel... likely more work than I'd personally bother with, without a concrete performance target
[16:45:06] gothicsouth: has joined #ruby
[16:45:16] biox: matthewd: Sure, and I don't have that target - but I'll give it a shot for fun. The Parallel library is having a hayday with my memory still, so I'll have to work through that. I'll give concurrent-ruby a try as suggested by ropeney as well.
[16:45:26] Ropeney: Instant must always be the target.
[16:45:55] biox: ropeney: `sort #{filename} | head -n #{selection}`
[16:45:56] ecuanaso: has joined #ruby
[16:46:20] Ropeney: have you looked at the algorithm they use?
[16:46:29] Ropeney: It is open source.
[16:46:37] biox: I have trouble following C code :/
[16:46:44] biox: I tried yesterday and couldn't figure it out
[16:46:51] Ropeney: That's a fair point lol
[16:47:40] Ryzokuken: has joined #ruby
[16:47:52] biox: The people in #bash say that sort loads the file into memory (preserving maybe 100MB and never dipping into swap intentionally) - then it makes files in /tmp for the rest of the data, so it definitely loads everything at once, does a mergesort (i think) and then prints the output
[16:48:20] Ropeney: Yeah looks like it merge sorts
[16:48:35] Ropeney: and that'd give more accuracy then your code right?
[16:49:01] biox: I have no idea
[16:49:13] Ropeney: youre one would break if first number was 0?
[16:49:22] biox: Hah, good point
[16:49:58] biox: Yeah, a mergesort would probably be good - I looked at a few ruby implementations but they all use arrays, and I can't hold the whole file in an array at once sadly
[16:50:14] Ropeney: your whole file isn't unique
[16:50:40] biox: It is not. Does Ruby automatically compress stuff before it enters memory?
[16:50:47] biox: That question is probably way too vague
[16:51:20] Ropeney: I'd merge sort in from each line
[16:51:23] Neptu: has joined #ruby
[16:51:31] Ropeney: should be rather fast still
[16:51:37] Ropeney: that'd drop duplicates
[16:51:42] biox: Oh interesting
[16:51:56] biox: I'll give that a shot next and compare it to my current code
[16:52:34] Ropeney: you of course have to check if there is a duplicate
[16:53:06] biox: sure, it sounds like that'd require a lot of computation since it'd have to happen on every number
[16:53:27] Ropeney: well, yours happens every number
[16:53:32] Ropeney: it compares
[16:53:42] Ropeney: except yours probably isn't giving the result you want
[16:54:06] biox: it does, but it compares against a var that's already set versus the mergesort method that would have to look for a matching number on each iteration, unless I'm understanding my code wrong
[16:55:20] Ropeney: I think we have different goals is all
[16:55:29] Ropeney: I'd rather a solution that gave the right answer, then didn't :P
[16:55:50] Ropeney: if you have 0 at line 1000, rest of your file is useless
[16:56:14] mtkd: has joined #ruby
[16:56:40] hotpancakes: has joined #ruby
[16:56:49] cbyrda: has joined #ruby
[16:57:01] biox: Yea, I'm also not accounting for negative numbers, really making a lot of assumptions about the input
[16:57:07] vuoto: has joined #ruby
[16:57:17] Ropeney: all depends on your goal
[16:57:57] Ropeney: i'd load the file in chunks, do the loop with 4 seperate arrays in parallel using merge sort, then merge sort them all together at end.
[16:58:10] Ropeney: 4 being the amount of threads you want
[16:58:24] biox: I have never done those things before, so it'd probably be a good practice for me to try. I'll give it a shot and let you know how it turns out.
[16:58:51] Ropeney: I may be passed out before you finish, but goodluck!
[16:59:04] biox: And also, thanks for all of your patience! (and you too matthewd)
[17:00:01] AndBobsYourUncle: has joined #ruby
[17:01:28] Silthias: has joined #ruby
[17:01:29] ecuanaso: has joined #ruby
[17:01:48] cdg: has joined #ruby
[17:03:38] cdg_: has joined #ruby
[17:03:51] rohitpaulk: has joined #ruby
[17:04:34] ivanf: has joined #ruby
[17:06:08] Dimik: has joined #ruby
[17:12:01] gusrub: has joined #ruby
[17:14:28] gusrub: has joined #ruby
[17:16:45] eightlimbed: has joined #ruby
[17:17:25] tAn: has joined #ruby
[17:18:31] Neptu: has joined #ruby
[17:20:59] jrafanie: has joined #ruby
[17:22:54] hotpancakes: has joined #ruby
[17:29:15] konsolebox: has joined #ruby
[17:31:47] bauruine: has joined #ruby
[17:31:50] blackwind_123: has joined #ruby
[17:33:06] hotpancakes: has joined #ruby
[17:37:56] hotpanca_: has joined #ruby
[17:38:07] cadillac__: has joined #ruby
[17:38:51] duderonomy: has joined #ruby
[17:39:49] AndBobsYourUncle: has joined #ruby
[17:41:07] hobodave: has joined #ruby
[17:41:46] FastJack: has joined #ruby
[17:42:47] omab: has joined #ruby
[17:43:14] minimalism: has joined #ruby
[17:46:03] tubuliferous: has joined #ruby
[17:46:34] hotpanca_: has joined #ruby
[17:46:36] uZiel: has joined #ruby
[17:52:02] ur5us: has joined #ruby
[17:52:05] ahrs: has joined #ruby
[17:53:05] jaruga_________: has joined #ruby
[17:54:22] dangerousdave: has joined #ruby
[17:54:36] dangerousdave: Is there an elegant way to strip newlines when reading a file using File readlines?
[17:55:56] havenwood: dangerousdave: On 2.4: File.readlines(filename, chomp: true)
[17:56:12] dangerousdave: havenwood many thanks!
[17:56:42] havenwood: dangerousdave: you're welcome!
[18:05:13] dc4: has joined #ruby
[18:05:48] cfec0b8d: has joined #ruby
[18:07:17] hutch34: has joined #ruby
[18:07:40] bvcosta: has joined #ruby
[18:08:03] tonytr: has joined #ruby
[18:08:33] gothicsouth: has joined #ruby
[18:11:21] sekmo: has joined #ruby
[18:12:15] hotpanca_: has joined #ruby
[18:12:17] pjmelling: has joined #ruby
[18:12:27] tonytr: Hi community. I am a noob with Ruby and am teaching myself, but I want to know if there is a roadmap of subject matter. What should I learn first, second, third etc.
[18:12:38] tonytr: Any input?
[18:13:14] jason^: has joined #ruby
[18:13:15] jrafanie: has joined #ruby
[18:14:10] dangerousdave: Tonyt_ why have you decided to learn Ruby?
[18:14:23] jason^: occasionally i want to join an array but sometimes it's nil, is there an easy way to return an empty string or join an array inline without having to add a bunch of checks or modifying code to set a var to an empty array?
[18:14:48] havenwood: Tonyt_: I can't think of a particular order other than avoiding spending any time on class variables or protected.
[18:14:59] tonytr: In order to make web apps, combined with the flatter learning curve
[18:15:32] dangerousdave: Tonyt_ do you have experience with other languages?
[18:15:42] Rodya_: has joined #ruby
[18:15:54] pjmelling: Tonyt_: the book Programming Ruby 1.0 & 2.0 (4th ed.) is a great primer and reference
[18:16:00] havenwood: Tonyt_: I'd suggest first learning some Ruby. Then create a bare bones Rack app so you understand how that works. Then convert your Rack app to Roda or Sinatra. Then maybe try a Rails tutorial.
[18:16:06] tonytr: I would say I am a beginner with Python as well
[18:16:54] havenwood: Tonyt_: In case you haven't already seen them we have some resource links here: https://ruby-community.com/pages/links
[18:17:06] havenwood: Tonyt_: And here as well: https://www.ruby-lang.org/en/documentation/
[18:17:24] havenwood: Tonyt_: And a book list: https://gist.github.com/baweaver/57a7c8296ca2c03effbd8fac1e7f6b40
[18:17:40] dangerousdave: Tonyt_ For me, I like to learn by solving a real problem, helps keep me interested. I would suggest you create a simple application, and learn Ruby in the process. Perhaps a blog
[18:17:49] havenwood: Tonyt_: Please feel free to ask here if you have any questions as you go along!
[18:18:01] tonytr: <pjmelling> thank you all
[18:18:18] tonytr: I appreciate the feedback
[18:18:36] davidmichaelkarr: has joined #ruby
[18:18:57] havenwood: jason^: Can you #compact the Array before joining?
[18:19:17] gusrub: has joined #ruby
[18:19:42] havenwood: jason^: [nil, nil, nil].compact.join 'whee' #=> ""
[18:20:06] jason^: it would be more like nil.compact.join
[18:20:14] Ryzokuken: has joined #ruby
[18:20:38] havenwood: jason^: nil&.compact&.join
[18:20:53] t-recx: has joined #ruby
[18:21:10] havenwood: It's the lonely person operator because it looks like a lonely person sitting crosslegged staring at a dot: &.
[18:21:17] jason^: what's the ampersand do?
[18:22:26] jason^: ah okay i found some details
[18:22:28] jason^: i'll check that out
[18:22:34] havenwood: jason^: http://mitrev.net/ruby/2015/11/13/the-operator-in-ruby/
[18:22:47] havenwood: >> nil&.not_here&.nope
[18:22:48] ruby[bot]: havenwood: # => nil (https://eval.in/817293)
[18:25:14] antgel: has joined #ruby
[18:25:22] Murda: has joined #ruby
[18:30:21] Murda: has joined #ruby
[18:30:39] hutch34: has joined #ruby
[18:40:15] jsrn: has joined #ruby
[18:42:22] roshanavand: has joined #ruby
[18:49:54] ych: has joined #ruby
[18:50:27] ndrei: has joined #ruby
[18:53:18] dmtd: has joined #ruby
[18:55:32] gusrub: has joined #ruby
[18:55:55] blackwind_123: has joined #ruby
[18:56:08] ResidentBiscuit: has joined #ruby
[19:01:36] Cohedrin: has joined #ruby
[19:02:28] elifoster: has joined #ruby
[19:06:09] workmad3: has joined #ruby
[19:06:34] ForeignBiscuit: has joined #ruby
[19:07:18] hightower2: has joined #ruby
[19:09:09] jenrzzz: has joined #ruby
[19:10:37] Renich: has joined #ruby
[19:11:44] Rodya_: has joined #ruby
[19:12:42] nankyokusei: has joined #ruby
[19:20:53] mikecmpbll: has joined #ruby
[19:21:26] govg: has joined #ruby
[19:22:05] KeyJoo: has joined #ruby
[19:24:38] plujon: has joined #ruby
[19:26:51] hotpancakes: has joined #ruby
[19:28:00] ecuanaso: has joined #ruby
[19:28:05] Xeago: has joined #ruby
[19:29:58] muelleme: has joined #ruby
[19:31:28] SeepingN: has joined #ruby
[19:35:49] kspencer: confused on why I'm getting an 'incompatible library version' for the mysql gem, I know it says 'incompatible' but I don't see any other versions of the libmysqlclient-dev
[19:38:31] eightlimbed: has joined #ruby
[19:40:24] matthewd: kspencer: You may need to recompile the gem if you've updated the library package
[19:40:45] matthewd: kspencer: gem pristine mysql (or mysql2, maybe more likely?)
[19:41:42] kspencer: welp lets stop the app and see if it works
[19:45:42] tAn: has joined #ruby
[19:50:07] kspencer: I'm also rvm it seems, does that do anything different?
[19:50:29] ur5us: has joined #ruby
[19:51:38] tastygradient: has joined #ruby
[20:00:03] ahrs: has joined #ruby
[20:03:04] muelleme_: has joined #ruby
[20:03:19] ben_alman: has joined #ruby
[20:07:03] shinnya: has joined #ruby
[20:08:52] Rodya__: has joined #ruby
[20:09:31] sekmo: has joined #ruby
[20:09:33] zenspider: jason^: it'd be better to not have nils to begin with. always an anti-pattern
[20:10:03] zenspider: "Shouldn't" :P
[20:11:03] poloych: has joined #ruby
[20:11:19] Mia: has joined #ruby
[20:11:19] Mia: has joined #ruby
[20:11:34] lxsameer: has joined #ruby
[20:16:56] Danielss89: has joined #ruby
[20:24:10] vuoto: has joined #ruby
[20:28:52] hightower2: has joined #ruby
[20:29:17] Cohedrin: has joined #ruby
[20:29:21] acalycine: has joined #ruby
[20:33:02] patarr: Is there something like a Range but has no upper bound?
[20:33:08] patarr: e.g. (50...)?
[20:33:16] apeiros: 50..Float::INFINITY
[20:33:31] patarr: ACTION groans
[20:33:35] patarr: Okay thanks apeiros
[20:35:00] patarr: There is no infinity in computers, so I don't like its explicit reference. Idk just seems weird to me.
[20:35:16] patarr: And why does Float only contain this constant, as opposed to Integer as well or something.
[20:35:52] apeiros: because there does not exist an infinity in the domain of integers, but in computers and the domain of rationals (which floats try to approximate)
[20:37:10] dionysus69: has joined #ruby
[20:37:46] jrafanie: has joined #ruby
[20:38:06] bvcosta: has joined #ruby
[20:40:14] workmad3: has joined #ruby
[20:40:28] ascarter: has joined #ruby
[20:41:40] havenwood: patarr: There's also: 50.step
[20:41:47] havenwood: >> 50.step.size
[20:41:52] ruby[bot]: havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[20:41:59] havenwood: #=> Infinity
[20:42:13] Bock: has joined #ruby
[20:42:13] havenwood: >> 50.step.first(3)
[20:42:17] havenwood: #=> [50, 51, 52]
[20:42:19] ruby[bot]: havenwood: I'm terribly sorry, I could not evaluate your code because of an error: OpenURI::HTTPError:500 Internal Server Error
[20:43:19] havenwood: ?cookie ruby[bot]
[20:43:19] ruby[bot]: ruby[bot]: here's your cookie: 🍪
[20:45:42] Bock: has joined #ruby
[20:46:10] async_prince: has joined #ruby
[20:47:20] havenwood: patarr: You can add #lazy for lazy enumeration so it doesn't take infinite time.
[20:47:41] havenwood: patarr: 50.step.lazy.map(&:abs2).select(&:odd?).first(3) #=> [2601, 2809, 3025]
[20:48:36] havenwood: patarr: There is a proposal that is being considered for an endless Range like `1..` that goes to Infinity.
[20:48:42] havenwood: https://bugs.ruby-lang.org/issues/12912
[20:49:07] hotpancakes: has joined #ruby
[20:50:41] Papierkorb: have fun parsing `1...size`
[20:52:20] dc4: has joined #ruby
[20:53:09] havenwood: Papierkorb: Hah, though to be fair ranges already need parens for chaining methods: (1...).size
[20:53:24] havenwood: #=> SlightlyInferiorInfinity
[20:55:41] Papierkorb: not a fan of the syntax, but don't care much in either way. As long that `foo[::-1]` madness doesn't get ported too
[20:57:02] elifoster: has joined #ruby
[20:58:23] zenspider: havenwood: why not just actually use infinity?
[20:58:31] zenspider: 1..Infinity reads really well
[20:58:57] zenspider: oooh. maybe 1.andup
[20:59:06] havenwood: that's basically 1.step though
[20:59:18] havenwood: i do prefer Infinity to Float::INFINTY
[20:59:23] havenwood: i don't like the Float namespace
[20:59:25] Papierkorb: I never needed a range to inf, but 1..Infinity does read nicely
[20:59:49] havenwood: I'd even prefer just Integer::INFINITY if it must be namespaced.
[20:59:53] zenspider: I didn't even know that Number#step existed. I'm not fond of how it reads honestly
[21:00:04] zenspider: probably should be on Math with PI and friends
[21:00:40] zenspider: Papierkorb: I've used it periodically. dunno how long #step has been around
[21:00:52] havenwood: at least since 1.9
[21:00:57] Papierkorb: zenspider: at least since I've been using ruby, around 2.1-ish
[21:01:14] apeiros: havenwood: as said before, there's no infinity in the domain of integers
[21:01:42] havenwood: apeiros: yeah, i just don't like going from an integer upto a float >.>
[21:01:49] havenwood: i get why, i just want some sugar
[21:02:21] apeiros: technically you never go up to it ;-)
[21:02:27] Papierkorb: OTOH, `1..something_big` can act as nice failsafe
[21:02:47] havenwood: I do prefer `1.step` to `1.upto(Float::INFINITY)` but I think Elixir has it slightly better with Stream/iterate/2.
[21:02:54] jrafanie: has joined #ruby
[21:03:04] havenwood: Stream.iterate/2*
[21:03:41] apeiros: >> module Kernel; module_function def ∞; Float::INFINITY; end; end; (1..∞).lazy.first(10)
[21:03:42] ruby[bot]: apeiros: # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] (https://eval.in/817311)
[21:04:09] CPalatine: has joined #ruby
[21:04:43] quobo: has joined #ruby
[21:05:34] jenrzzz: has joined #ruby
[21:05:34] jenrzzz: has joined #ruby
[21:08:33] belmoussaoui: has joined #ruby
[21:09:55] ur5us: has joined #ruby
[21:10:30] havenwood: >> module Stream; module_function def iterate value; Enumerator.new(Float::INFINITY) { |yielder| loop { yielder.yield value; value = yield value } } end end; Stream.iterate(1, &:succ).first 5
[21:10:31] ruby[bot]: havenwood: # => [1, 2, 3, 4, 5] (https://eval.in/817312)
[21:13:33] nankyokusei: has joined #ruby
[21:13:36] bauruine: has joined #ruby
[21:17:49] mtkd: has joined #ruby
[21:19:36] guymanndude: has joined #ruby
[21:20:12] guymanndude: hi, I'm working on a Thor::Group script but am having trouble writing tests for it; are there any resources explaining how to approach testing a Thor::Group script with RSpec or something similar?
[21:20:42] __Yiota: has joined #ruby
[21:20:43] guymanndude: basically I'm shelling out to an external application and moving and manipulating files
[21:21:31] mahlon: has joined #ruby
[21:22:46] Jayson_Virissimo: has joined #ruby
[21:27:46] zenspider: guymanndude: I don't use thor for anything... but when I'm writing tests for this type of thing I just verify that I'm generating the right command strings/arrays, usually by trapping system directly
[21:28:39] guymanndude: ok zenspider, thanks. I guess I can create an instance of my script, call it to manipulate the files and check if they've been created and look right
[21:30:21] zenspider: that is the exact *opposite* of what I just described.
[21:33:37] guymanndude: zenspider: sorry I misunderstood. I'm not sure I follow by "right command string/arrays"
[21:33:56] hotpanca_: has joined #ruby
[21:35:42] jenrzzz: has joined #ruby
[21:35:42] jenrzzz: has joined #ruby
[21:36:00] CPalatine: has left #ruby: ()
[21:36:10] tenderlove: has joined #ruby
[21:39:46] mim1k: has joined #ruby
[21:40:12] __Yiota: has joined #ruby
[21:40:27] weathermaker: has joined #ruby
[21:43:40] tubuliferous: has joined #ruby
[21:49:41] zacts: has joined #ruby
[21:51:01] enterprisey: has joined #ruby
[21:53:05] nocaberi: has joined #ruby
[21:58:22] muelleme_: has joined #ruby
[22:02:15] hotpanca_: has joined #ruby
[22:04:52] Uranio: has joined #ruby
[22:07:37] ecuanaso: has joined #ruby
[22:27:06] skweek: has joined #ruby
[22:28:21] hotpancakes: has joined #ruby
[22:28:44] eightlimbed: has joined #ruby
[22:31:28] marr: has joined #ruby
[22:34:25] weathermaker: has joined #ruby
[22:35:45] millerti: has joined #ruby
[22:35:57] hotpanca_: has joined #ruby
[22:38:35] gothicsouth: has joined #ruby
[22:38:51] MrSparkle: has joined #ruby
[22:40:19] gix: has joined #ruby
[22:42:37] Uranio: has joined #ruby
[22:45:10] hotpanca_: has joined #ruby
[22:45:51] hinbody: has joined #ruby
[22:47:46] bauruine: has joined #ruby
[23:07:12] hotpancakes: has joined #ruby
[23:07:21] muelleme_: has joined #ruby
[23:11:38] statelesscode: has joined #ruby
[23:13:19] borei1: has joined #ruby
[23:13:59] borei1: need some heads-up (don't have too much sxpereince with ruby)
[23:14:26] nankyokusei: has joined #ruby
[23:15:01] borei1: im trying to build hawk2 (wich is webui to mange pacemaker/corosync based clusters) on centos 7. i installed ruby 2.4.
[23:15:22] borei1: but rpmbuild trying to use old version
[23:16:05] borei1: there is variable defined in the rpm spec file - %define vendor_ruby site_ruby - i think it controls wich ruby environemnt is gonna be used
[23:16:27] borei1: question is - how to point it to the own i just instelled
[23:16:29] havenwood: borei1: How'd you install Ruby?
[23:17:41] t-recx: has joined #ruby
[23:17:54] zenspider: seems like more of a centos q
[23:18:03] borei1: downloaded rh-ruby24-*rpm
[23:18:09] zenspider: (which was hell last time I was forced to use it... really ancient packages)
[23:18:10] borei1: and all related rpms
[23:18:38] borei1: well, it's interaction between ruby and os vendor
[23:19:03] borei1: and yes - centos is very very old
[23:19:57] ecuanaso: has joined #ruby
[23:20:52] havenwood: borei1: Did you use update-alternatives to select the RPM you want to use
[23:21:22] havenwood: borei1: Check: update-alternatives --config ruby
[23:21:46] borei1: output is empty
[23:21:57] havenwood: borei1: Err, and both are installed through your package manager?
[23:22:16] borei1: using yum/rpm
[23:22:45] borei1: new ruby is under /opt/rh/rh-ruby24/
[23:24:29] havenwood: borei1: I'm assuming nothing either for?: update-alternatives --display ruby
[23:24:59] borei1: empty as well
[23:25:51] havenwood: borei1: I'd personally probably build Ruby to /usr/local with ruby-install: ruby-install --latest --system ruby
[23:26:32] havenwood: borei1: Or you could setup PATH, GEM_HOME, GEM_PATH, etc yourself.
[23:26:41] borei1: i found there is "enable" script with all variables like PATH LD_LIBRARY etc
[23:27:03] havenwood: I've got to run but someone else might have better ideas. Good luck!
[23:27:06] borei1: i'll use it for now, seems like build process works
[23:27:22] borei1: np, you've already pointed me to right directions
[23:28:16] Demo318: has joined #ruby
[23:28:28] DLSteve: has joined #ruby
[23:30:41] Demo318: has joined #ruby
[23:31:03] darix: borei1: are you using redhats software collections?
[23:31:31] Demo318: has joined #ruby
[23:32:16] Demo318: has joined #ruby
[23:32:21] bauruine: has joined #ruby
[23:33:05] Demo318: has joined #ruby
[23:33:13] hutch34: has joined #ruby
[23:33:55] Demo318: has joined #ruby
[23:34:26] hotpanca_: has joined #ruby
[23:35:56] Hunter1: has joined #ruby
[23:36:38] sebd: has joined #ruby
[23:37:54] postmodern: has joined #ruby
[23:40:13] mim1k: has joined #ruby
[23:40:22] ozcanesen: has joined #ruby
[23:41:38] cyphase: has joined #ruby
[23:43:34] alveric1: has joined #ruby
[23:44:06] whiteline_: has joined #ruby
[23:48:12] solocshaw: has joined #ruby
[23:48:58] Cohedrin: has joined #ruby
[23:49:48] duderonomy: has joined #ruby
[23:50:41] bvcosta: has joined #ruby
[23:53:24] kobain: has joined #ruby
[23:58:31] hlmjr: has joined #ruby
[23:59:07] Hunter1: has joined #ruby